mlvibrosens  2.1.0.0
Data Structures | Macros | Enumerations | Functions
mlvibrosens.h File Reference

This file contains API for ML Vibro Sens Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  mlvibrosens_t
 ML Vibro Sens Click context object. More...
 
struct  mlvibrosens_cfg_t
 ML Vibro Sens Click configuration object. More...
 
struct  mlvibrosens_data_t
 ML Vibro Sens Click Axes data structure. More...
 

Macros

#define MLVIBROSENS_REG_INT_STATUS   0x00
 ML Vibro Sens register list. More...
 
#define MLVIBROSENS_REG_TEMP_OUT   0x01
 
#define MLVIBROSENS_REG_VECM_LSB   0x02
 
#define MLVIBROSENS_REG_VECM_MSB   0x03
 
#define MLVIBROSENS_REG_OUT_X_LSB   0x04
 
#define MLVIBROSENS_REG_OUT_X_MSB   0x05
 
#define MLVIBROSENS_REG_OUT_Y_LSB   0x06
 
#define MLVIBROSENS_REG_OUT_Y_MSB   0x07
 
#define MLVIBROSENS_REG_OUT_Z_LSB   0x08
 
#define MLVIBROSENS_REG_OUT_Z_MSB   0x09
 
#define MLVIBROSENS_REG_BUF_STATUS   0x0B
 
#define MLVIBROSENS_REG_BUF_X_LSB   0x0C
 
#define MLVIBROSENS_REG_BUF_X_MSB   0x0D
 
#define MLVIBROSENS_REG_BUF_Y_LSB   0x0E
 
#define MLVIBROSENS_REG_BUF_Y_MSB   0x0F
 
#define MLVIBROSENS_REG_BUF_Z_LSB   0x10
 
#define MLVIBROSENS_REG_BUF_Z_MSB   0x11
 
#define MLVIBROSENS_REG_PROD_REV   0x12
 
#define MLVIBROSENS_REG_WHO_AM_I   0x13
 
#define MLVIBROSENS_REG_SYS_MODE   0x14
 
#define MLVIBROSENS_REG_SENS_CONFIG1   0x15
 
#define MLVIBROSENS_REG_SENS_CONFIG2   0x16
 
#define MLVIBROSENS_REG_SENS_CONFIG3   0x17
 
#define MLVIBROSENS_REG_SENS_CONFIG4   0x18
 
#define MLVIBROSENS_REG_SENS_CONFIG5   0x19
 
#define MLVIBROSENS_REG_WAKE_IDLE_LSB   0x1A
 
#define MLVIBROSENS_REG_WAKE_IDLE_MSB   0x1B
 
#define MLVIBROSENS_REG_SLEEP_IDLE_LSB   0x1C
 
#define MLVIBROSENS_REG_SLEEP_IDLE_MSB   0x1D
 
#define MLVIBROSENS_REG_ASLP_COUNT_LSB   0x1E
 
#define MLVIBROSENS_REG_ASLP_COUNT_MSB   0x1F
 
#define MLVIBROSENS_REG_INT_EN   0x20
 
#define MLVIBROSENS_REG_INT_PIN_SEL   0x21
 
#define MLVIBROSENS_REG_OFF_X   0x22
 
#define MLVIBROSENS_REG_OFF_Y   0x23
 
#define MLVIBROSENS_REG_OFF_Z   0x24
 
#define MLVIBROSENS_REG_BUF_CONFIG1   0x26
 
#define MLVIBROSENS_REG_BUF_CONFIG2   0x27
 
#define MLVIBROSENS_REG_ORIENT_STATUS   0x28
 
#define MLVIBROSENS_REG_ORIENT_CONFIG   0x29
 
#define MLVIBROSENS_REG_ORIENT_DBCOUNT   0x2A
 
#define MLVIBROSENS_REG_ORIENT_BF_ZCOMP   0x2B
 
#define MLVIBROSENS_REG_ORIENT_THS_REG   0x2C
 
#define MLVIBROSENS_REG_SDCD_INT_SRC1   0x2D
 
#define MLVIBROSENS_REG_SDCD_INT_SRC2   0x2E
 
#define MLVIBROSENS_REG_SDCD_CONFIG1   0x2F
 
#define MLVIBROSENS_REG_SDCD_CONFIG2   0x30
 
#define MLVIBROSENS_REG_SDCD_OT_DBCNT   0x31
 
#define MLVIBROSENS_REG_SDCD_WT_DBCNT   0x32
 
#define MLVIBROSENS_REG_SDCD_LTHS_LSB   0x33
 
#define MLVIBROSENS_REG_SDCD_LTHS_MSB   0x34
 
#define MLVIBROSENS_REG_SDCD_UTHS_LSB   0x35
 
#define MLVIBROSENS_REG_SDCD_UTHS_MSB   0x36
 
#define MLVIBROSENS_REG_SELF_TEST_CONFIG1   0x37
 
#define MLVIBROSENS_REG_SELF_TEST_CONFIG2   0x38
 
#define MLVIBROSENS_INT_STATUS_SRC_DRDY   0x80
 ML Vibro Sens INT_STATUS register setting. More...
 
#define MLVIBROSENS_INT_STATUS_SRC_OVF   0x40
 
#define MLVIBROSENS_INT_STATUS_SRC_BUF   0x20
 
#define MLVIBROSENS_INT_STATUS_SRC_SDCD_OT   0x10
 
#define MLVIBROSENS_INT_STATUS_SRC_SDCD_WT   0x08
 
#define MLVIBROSENS_INT_STATUS_SRC_ORIENT   0x04
 
#define MLVIBROSENS_INT_STATUS_SRC_ASLP   0x02
 
#define MLVIBROSENS_INT_STATUS_SRC_BOOT   0x01
 
#define MLVIBROSENS_WHO_AM_I   0x86
 ML Vibro Sens WHO_AM_I register setting. More...
 
#define MLVIBROSENS_SENS_CONFIG1_RST   0x80
 ML Vibro Sens SENS_CONFIG1 register setting. More...
 
#define MLVIBROSENS_SENS_CONFIG1_ST_AXIS_SEL_DIS   0x00
 
#define MLVIBROSENS_SENS_CONFIG1_ST_AXIS_SEL_X   0x20
 
#define MLVIBROSENS_SENS_CONFIG1_ST_AXIS_SEL_Y   0x40
 
#define MLVIBROSENS_SENS_CONFIG1_ST_AXIS_SEL_Z   0x60
 
#define MLVIBROSENS_SENS_CONFIG1_ST_AXIS_SEL_MASK   0x60
 
#define MLVIBROSENS_SENS_CONFIG1_ST_POL   0x10
 
#define MLVIBROSENS_SENS_CONFIG1_SPI_M_4_WIRE   0x00
 
#define MLVIBROSENS_SENS_CONFIG1_SPI_M_3_WIRE   0x08
 
#define MLVIBROSENS_SENS_CONFIG1_SPI_M_MASK   0x08
 
#define MLVIBROSENS_SENS_CONFIG1_FSR_2G   0x00
 
#define MLVIBROSENS_SENS_CONFIG1_FSR_4G   0x02
 
#define MLVIBROSENS_SENS_CONFIG1_FSR_8G   0x04
 
#define MLVIBROSENS_SENS_CONFIG1_FSR_16G   0x06
 
#define MLVIBROSENS_SENS_CONFIG1_FSR_MASK   0x06
 
#define MLVIBROSENS_SENS_CONFIG1_MODE_STANDBY   0x00
 
#define MLVIBROSENS_SENS_CONFIG1_MODE_ACTIVE   0x01
 
#define MLVIBROSENS_SENS_CONFIG1_MODE_MASK   0x01
 
#define MLVIBROSENS_SENS_CONFIG3_WAKE_ODR_MASK   0xF0
 ML Vibro Sens SENS_CONFIG3 register setting. More...
 
#define MLVIBROSENS_SENS_CONFIG3_SLEEP_ODR_MASK   0x0F
 
#define MLVIBROSENS_SENS_CONFIG4_EXT_TRIG_M   0x80
 ML Vibro Sens SENS_CONFIG4 register setting. More...
 
#define MLVIBROSENS_SENS_CONFIG4_WAKE_SDCD_WT   0x40
 
#define MLVIBROSENS_SENS_CONFIG4_WAKE_SDCD_OT   0x20
 
#define MLVIBROSENS_SENS_CONFIG4_WAKE_ORIENT   0x10
 
#define MLVIBROSENS_SENS_CONFIG4_DRDY_PUL   0x08
 
#define MLVIBROSENS_SENS_CONFIG4_INT2_FUNC   0x04
 
#define MLVIBROSENS_SENS_CONFIG4_INT_PP_OD   0x02
 
#define MLVIBROSENS_SENS_CONFIG4_INT_POL   0x01
 
#define MLVIBROSENS_SENS_CONFIG4_INT_PP_LOW   0x00
 
#define MLVIBROSENS_INT_EN_DRDY   0x80
 ML Vibro Sens INT_EN register setting. More...
 
#define MLVIBROSENS_INT_EN_BUF   0x40
 
#define MLVIBROSENS_INT_EN_SDCD_OT   0x20
 
#define MLVIBROSENS_INT_EN_SDCD_WT   0x10
 
#define MLVIBROSENS_INT_EN_ORIENT   0x08
 
#define MLVIBROSENS_INT_EN_ASLP   0x04
 
#define MLVIBROSENS_INT_EN_BOOT_DIS   0x02
 
#define MLVIBROSENS_INT_EN_WAKE_OUT   0x01
 
#define MLVIBROSENS_INT_PIN_SEL_DRDY_INT2   0x80
 ML Vibro Sens INT_PIN_SEL register setting. More...
 
#define MLVIBROSENS_INT_PIN_SEL_BUF_INT2   0x40
 
#define MLVIBROSENS_INT_PIN_SEL_SDCD_OT_INT2   0x20
 
#define MLVIBROSENS_INT_PIN_SEL_SDCD_WT_INT2   0x10
 
#define MLVIBROSENS_INT_PIN_SEL_ORIENT_INT2   0x08
 
#define MLVIBROSENS_INT_PIN_SEL_ASLP_INT2   0x04
 
#define MLVIBROSENS_INT_PIN_SEL_BOOT_INT2   0x02
 
#define MLVIBROSENS_INT_PIN_SEL_WAKE_OUT_INT2   0x01
 
#define MLVIBROSENS_INT_PIN_SEL_ALL_INT1   0x00
 
#define MLVIBROSENS_MODE_STANDBY   0
 ML Vibro Sens operating mode setting. More...
 
#define MLVIBROSENS_MODE_ACTIVE   1
 
#define MLVIBROSENS_FSR_2G   0
 ML Vibro Sens FSR setting. More...
 
#define MLVIBROSENS_FSR_4G   1
 
#define MLVIBROSENS_FSR_8G   2
 
#define MLVIBROSENS_FSR_16G   3
 
#define MLVIBROSENS_ODR_3200_HZ   0
 ML Vibro Sens ODR setting. More...
 
#define MLVIBROSENS_ODR_1600_HZ   1
 
#define MLVIBROSENS_ODR_800_HZ   2
 
#define MLVIBROSENS_ODR_400_HZ   3
 
#define MLVIBROSENS_ODR_200_HZ   4
 
#define MLVIBROSENS_ODR_100_HZ   5
 
#define MLVIBROSENS_ODR_50_HZ   6
 
#define MLVIBROSENS_ODR_25_HZ   7
 
#define MLVIBROSENS_ODR_12_5_HZ   8
 
#define MLVIBROSENS_ODR_6_25_HZ   9
 
#define MLVIBROSENS_ODR_3_125_HZ   10
 
#define MLVIBROSENS_ODR_1_563_HZ   11
 
#define MLVIBROSENS_ODR_0_781_HZ   12
 
#define MLVIBROSENS_LSB_PER_G_FSR_2G   1024
 ML Vibro Sens LSB/g setting. More...
 
#define MLVIBROSENS_LSB_PER_G_FSR_4G   512
 
#define MLVIBROSENS_LSB_PER_G_FSR_8G   256
 
#define MLVIBROSENS_LSB_PER_G_FSR_16G   128
 
#define MLVIBROSENS_TEMP_OFFSET   25
 ML Vibro Sens temperature offset setting. More...
 
#define MLVIBROSENS_VIBRO_STATE_IDLE   0
 ML Vibro Sens vibro motor state setting. More...
 
#define MLVIBROSENS_VIBRO_STATE_BALANCED   1
 
#define MLVIBROSENS_VIBRO_STATE_UNBALANCED   2
 
#define MLVIBROSENS_VIBRO_STATE_BOTH   3
 
#define MLVIBROSENS_DEVICE_ADDRESS_0   0x18
 ML Vibro Sens device address setting. More...
 
#define MLVIBROSENS_DEVICE_ADDRESS_1   0x19
 
#define MLVIBROSENS_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  mlvibrosens_return_value_t { MLVIBROSENS_OK = 0, MLVIBROSENS_ERROR = -1 }
 ML Vibro Sens Click return value data. More...
 

Functions

void mlvibrosens_cfg_setup (mlvibrosens_cfg_t *cfg)
 ML Vibro Sens configuration object setup function. More...
 
err_t mlvibrosens_init (mlvibrosens_t *ctx, mlvibrosens_cfg_t *cfg)
 ML Vibro Sens initialization function. More...
 
err_t mlvibrosens_default_cfg (mlvibrosens_t *ctx)
 ML Vibro Sens default configuration function. More...
 
err_t mlvibrosens_write_regs (mlvibrosens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 ML Vibro Sens write regs function. More...
 
err_t mlvibrosens_read_regs (mlvibrosens_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 ML Vibro Sens read regs function. More...
 
err_t mlvibrosens_write_reg (mlvibrosens_t *ctx, uint8_t reg, uint8_t data_in)
 ML Vibro Sens write reg function. More...
 
err_t mlvibrosens_read_reg (mlvibrosens_t *ctx, uint8_t reg, uint8_t *data_out)
 ML Vibro Sens read reg function. More...
 
void mlvibrosens_balanced_enable (mlvibrosens_t *ctx)
 ML Vibro Sens balanced enable function. More...
 
void mlvibrosens_balanced_disable (mlvibrosens_t *ctx)
 ML Vibro Sens balanced disable function. More...
 
void mlvibrosens_unbalanced_enable (mlvibrosens_t *ctx)
 ML Vibro Sens unbalanced enable function. More...
 
void mlvibrosens_unbalanced_disable (mlvibrosens_t *ctx)
 ML Vibro Sens unbalanced disable function. More...
 
uint8_t mlvibrosens_get_int_pin (mlvibrosens_t *ctx)
 ML Vibro Sens get int1 pin function. More...
 
void mlvibrosens_set_vibro_state (mlvibrosens_t *ctx, uint8_t state)
 ML Vibro Sens set vibro state function. More...
 
err_t mlvibrosens_check_comm (mlvibrosens_t *ctx)
 ML Vibro Sens check comm function. More...
 
err_t mlvibrosens_get_status (mlvibrosens_t *ctx, uint8_t *status)
 ML Vibro Sens get status function. More...
 
err_t mlvibrosens_sw_reset (mlvibrosens_t *ctx)
 ML Vibro Sens sw reset function. More...
 
err_t mlvibrosens_set_mode (mlvibrosens_t *ctx, uint8_t mode)
 ML Vibro Sens set mode function. More...
 
err_t mlvibrosens_set_fsr (mlvibrosens_t *ctx, uint8_t fsr)
 ML Vibro Sens set fsr function. More...
 
err_t mlvibrosens_set_odr (mlvibrosens_t *ctx, uint8_t odr)
 ML Vibro Sens set odr function. More...
 
err_t mlvibrosens_get_data (mlvibrosens_t *ctx, mlvibrosens_data_t *data_out)
 ML Vibro Sens get data function. More...
 

Detailed Description

This file contains API for ML Vibro Sens Click Driver.

Enumeration Type Documentation

◆ mlvibrosens_return_value_t

ML Vibro Sens Click return value data.

Predefined enum values for driver return values.

Enumerator
MLVIBROSENS_OK 
MLVIBROSENS_ERROR