inclinometer2 2.0.0.0
inclinometer2.h File Reference

This file contains API for Inclinometer 2 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  inclinometer2_s
 Inclinometer 2 Click context object. More...
 
struct  inclinometer2_cfg_t
 Inclinometer 2 Click configuration object. More...
 

Macros

#define INCLINOMETER2_REG_FUNC_CFG_ACCESS   0x01
 Inclinometer 2 register map.
 
#define INCLINOMETER2_REG_PIN_CTRL   0x02
 
#define INCLINOMETER2_REG_FIFO_CTRL1   0x07
 
#define INCLINOMETER2_REG_FIFO_CTRL2   0x08
 
#define INCLINOMETER2_REG_FIFO_CTRL3   0x09
 
#define INCLINOMETER2_REG_FIFO_CTRL4   0x0A
 
#define INCLINOMETER2_REG_COUNTER_BDR_REG1   0x0B
 
#define INCLINOMETER2_REG_COUNTER_BDR_REG2   0x0C
 
#define INCLINOMETER2_REG_INT1_CTRL   0x0D
 
#define INCLINOMETER2_REG_INT2_CTRL   0x0E
 
#define INCLINOMETER2_REG_WHO_AM_I   0x0F
 
#define INCLINOMETER2_REG_CTRL1_XL   0x10
 
#define INCLINOMETER2_REG_CTRL3_C   0x12
 
#define INCLINOMETER2_REG_CTRL4_C   0x13
 
#define INCLINOMETER2_REG_CTRL5_C   0x14
 
#define INCLINOMETER2_REG_CTRL6_C   0x15
 
#define INCLINOMETER2_REG_CTRL7_XL   0x16
 
#define INCLINOMETER2_REG_CTRL8_XL   0x17
 
#define INCLINOMETER2_REG_CTRL9_XL   0x18
 
#define INCLINOMETER2_REG_CTRL10_C   0x19
 
#define INCLINOMETER2_REG_ALL_INT_SRC   0x1A
 
#define INCLINOMETER2_REG_WAKE_UP_SRC   0x1B
 
#define INCLINOMETER2_REG_TAP_SRC   0x1C
 
#define INCLINOMETER2_REG_DEN_SRC   0x1D
 
#define INCLINOMETER2_REG_STATUS   0x1E
 
#define INCLINOMETER2_REG_OUT_TEMP_L   0x20
 
#define INCLINOMETER2_REG_OUT_TEMP_H   0x21
 
#define INCLINOMETER2_REG_OUTX_L_A   0x28
 
#define INCLINOMETER2_REG_OUTX_H_A   0x29
 
#define INCLINOMETER2_REG_OUTY_L_A   0x2A
 
#define INCLINOMETER2_REG_OUTY_H_A   0x2B
 
#define INCLINOMETER2_REG_EMB_FUNC_STATUS_MAINPAGE   0x35
 
#define INCLINOMETER2_REG_FSM_STATUS_A_MAINPAGE   0x36
 
#define INCLINOMETER2_REG_FSM_STATUS_B_MAINPAGE   0x37
 
#define INCLINOMETER2_REG_MLC_STATUS_MAINPAGE   0x38
 
#define INCLINOMETER2_REG_STATUS_MASTER_MAINPAGE   0x39
 
#define INCLINOMETER2_REG_FIFO_STATUS1   0x3A
 
#define INCLINOMETER2_REG_FIFO_STATUS2   0x3B
 
#define INCLINOMETER2_REG_TIMESTAMP0   0x40
 
#define INCLINOMETER2_REG_TIMESTAMP1   0x41
 
#define INCLINOMETER2_REG_TIMESTAMP2   0x42
 
#define INCLINOMETER2_REG_TIMESTAMP3   0x43
 
#define INCLINOMETER2_REG_TAP_CFG0   0x56
 
#define INCLINOMETER2_REG_TAP_CFG1   0x57
 
#define INCLINOMETER2_REG_TAP_CFG2   0x58
 
#define INCLINOMETER2_REG_INT_DUR2   0x5A
 
#define INCLINOMETER2_REG_WAKE_UP_THS   0x5B
 
#define INCLINOMETER2_REG_WAKE_UP_DUR   0x5C
 
#define INCLINOMETER2_REG_MD1_CFG   0x5E
 
#define INCLINOMETER2_REG_MD2_CFG   0x5F
 
#define INCLINOMETER2_REG_INTERNAL_FREQ_FINE   0x63
 
#define INCLINOMETER2_REG_X_OFS_USR   0x73
 
#define INCLINOMETER2_REG_Y_OFS_USR   0x74
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_TAG   0x78
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_X_L   0x79
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_X_H   0x7A
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_Y_L   0x7B
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_Y_H   0x7C
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_Z_L   0x7D
 
#define INCLINOMETER2_REG_FIFO_DATA_OUT_Z_H   0x7E
 
#define INCLINOMETER2_FUNC_REG_PAGE_SEL   0x02
 Inclinometer 2 embedded functions register map.
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_EN_B   0x05
 
#define INCLINOMETER2_FUNC_REG_PAGE_ADDRESS   0x08
 
#define INCLINOMETER2_FUNC_REG_PAGE_VALUE   0x09
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_INT1   0x0A
 
#define INCLINOMETER2_FUNC_REG_FSM_INT1_A   0x0B
 
#define INCLINOMETER2_FUNC_REG_FSM_INT1_B   0x0C
 
#define INCLINOMETER2_FUNC_REG_MLC_INT1   0x0D
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_INT2   0x0E
 
#define INCLINOMETER2_FUNC_REG_FSM_INT2_A   0x0F
 
#define INCLINOMETER2_FUNC_REG_FSM_INT2_B   0x10
 
#define INCLINOMETER2_FUNC_REG_MLC_INT2   0x11
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_STATUS   0x12
 
#define INCLINOMETER2_FUNC_REG_FSM_STATUS_A   0x13
 
#define INCLINOMETER2_FUNC_REG_FSM_STATUS_B   0x14
 
#define INCLINOMETER2_FUNC_REG_MLC_STATUS   0x15
 
#define INCLINOMETER2_FUNC_REG_PAGE_RW   0x17
 
#define INCLINOMETER2_FUNC_REG_FSM_ENABLE_A   0x46
 
#define INCLINOMETER2_FUNC_REG_FSM_ENABLE_B   0x47
 
#define INCLINOMETER2_FUNC_REG_FSM_LONG_COUNTER_L   0x48
 
#define INCLINOMETER2_FUNC_REG_FSM_LONG_COUNTER_H   0x49
 
#define INCLINOMETER2_FUNC_REG_FSM_LONG_COUNTER_CLR   0x4A
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS1   0x4C
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS2   0x4D
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS3   0x4E
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS4   0x4F
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS5   0x50
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS6   0x51
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS7   0x52
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS8   0x53
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS9   0x54
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS10   0x55
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS11   0x56
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS12   0x57
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS13   0x58
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS14   0x59
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS15   0x5A
 
#define INCLINOMETER2_FUNC_REG_FSM_OUTS16   0x5B
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_ODR_CFG_B   0x5F
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_ODR_CFG_C   0x60
 
#define INCLINOMETER2_FUNC_REG_EMB_FUNC_INIT_B   0x67
 
#define INCLINOMETER2_FUNC_REG_MCL0_SRC   0x70
 
#define INCLINOMETER2_FUNC_REG_MCL1_SRC   0x71
 
#define INCLINOMETER2_FUNC_REG_MCL2_SRC   0x72
 
#define INCLINOMETER2_FUNC_REG_MCL3_SRC   0x73
 
#define INCLINOMETER2_FUNC_REG_MCL4_SRC   0x74
 
#define INCLINOMETER2_FUNC_REG_MCL5_SRC   0x75
 
#define INCLINOMETER2_FUNC_REG_MCL6_SRC   0x76
 
#define INCLINOMETER2_FUNC_REG_MCL7_SRC   0x77
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_1   0x02
 Inclinometer 2 sensor hub register map.
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_2   0x03
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_3   0x04
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_4   0x05
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_5   0x06
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_6   0x07
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_7   0x08
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_8   0x09
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_9   0x0A
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_10   0x0B
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_11   0x0C
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_12   0x0D
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_13   0x0E
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_14   0x0F
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_15   0x10
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_16   0x11
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_17   0x12
 
#define INCLINOMETER2_SHUB_REG_SENSOR_HUB_18   0x13
 
#define INCLINOMETER2_SHUB_REG_MASTER_CONFIG   0x14
 
#define INCLINOMETER2_SHUB_REG_SLV0_ADD   0x15
 
#define INCLINOMETER2_SHUB_REG_SLV0_SUBADD   0x16
 
#define INCLINOMETER2_SHUB_REG_SLV0_CONFIG   0x17
 
#define INCLINOMETER2_SHUB_REG_SLV1_ADD   0x18
 
#define INCLINOMETER2_SHUB_REG_SLV1_SUBADD   0x19
 
#define INCLINOMETER2_SHUB_REG_SLV1_CONFIG   0x1A
 
#define INCLINOMETER2_SHUB_REG_SLV2_ADD   0x1B
 
#define INCLINOMETER2_SHUB_REG_SLV2_SUBADD   0x1C
 
#define INCLINOMETER2_SHUB_REG_SLV2_CONFIG   0x1D
 
#define INCLINOMETER2_SHUB_REG_SLV3_ADD   0x1E
 
#define INCLINOMETER2_SHUB_REG_SLV3_SUBADD   0x1F
 
#define INCLINOMETER2_SHUB_REG_SLV3_CONFIG   0x20
 
#define INCLINOMETER2_SHUB_REG_DATAWRITE_SLV0   0x21
 
#define INCLINOMETER2_SHUB_REG_STATUS_MASTER   0x22
 
#define INCLINOMETER2_INT1_CTRL_DEN_DRDY   0x80
 Inclinometer 2 INT1_CTRL register settings.
 
#define INCLINOMETER2_INT1_CTRL_CNT_BDR   0x40
 
#define INCLINOMETER2_INT1_CTRL_FIFO_FULL   0x20
 
#define INCLINOMETER2_INT1_CTRL_FIFO_OVR   0x10
 
#define INCLINOMETER2_INT1_CTRL_FIFO_TH   0x08
 
#define INCLINOMETER2_INT1_CTRL_BOOT   0x04
 
#define INCLINOMETER2_INT1_CTRL_DRDY_XL   0x01
 
#define INCLINOMETER2_STATUS_TEMP_DRDY   0x04
 Inclinometer 2 STATUS register values.
 
#define INCLINOMETER2_STATUS_ACCEL_DRDY   0x01
 
#define INCLINOMETER2_ACCEL_FSR_0p5G_RES   0.015f
 Inclinometer 2 calculation values.
 
#define INCLINOMETER2_ACCEL_FSR_1G_RES   0.031f
 
#define INCLINOMETER2_ACCEL_FSR_2G_RES   0.061f
 
#define INCLINOMETER2_ACCEL_FSR_3G_RES   0.122f
 
#define INCLINOMETER2_ROOM_TEMP   25.0f
 
#define INCLINOMETER2_TEMP_SENS   256.0f
 
#define INCLINOMETER2_WHO_AM_I   0x6B
 Inclinometer 2 WHO_AM_I register value.
 
#define INCLINOMETER2_DEVICE_ADDRESS_0   0x6A
 Inclinometer 2 device address setting.
 
#define INCLINOMETER2_DEVICE_ADDRESS_1   0x6B
 
#define INCLINOMETER2_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define INCLINOMETER2_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define INCLINOMETER2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* inclinometer2_master_io_t) (struct inclinometer2_s *, uint8_t, uint8_t *, uint8_t)
 
typedef struct inclinometer2_s inclinometer2_t
 Inclinometer 2 Click context object.
 

Enumerations

enum  inclinometer2_drv_t { INCLINOMETER2_DRV_SEL_SPI , INCLINOMETER2_DRV_SEL_I2C }
 Inclinometer 2 Click driver selector. More...
 
enum  inclinometer2_fsr_t {
  INCLINOMETER2_FSR_0p5G = 0x00 , INCLINOMETER2_FSR_3G , INCLINOMETER2_FSR_1G , INCLINOMETER2_FSR_2G ,
  INCLINOMETER2_FSR_BIT_MASK = 0x0C
}
 Inclinometer 2 Click accel full-scale range selection. More...
 
enum  inclinometer2_odr_t {
  INCLINOMETER2_ODR_POWER_DOWN = 0x00 , INCLINOMETER2_ODR_12p5HZ , INCLINOMETER2_ODR_26HZ , INCLINOMETER2_ODR_52HZ ,
  INCLINOMETER2_ODR_104HZ , INCLINOMETER2_ODR_208HZ , INCLINOMETER2_ODR_416HZ , INCLINOMETER2_ODR_833HZ ,
  INCLINOMETER2_ODR_BIT_MASK = 0xF0
}
 Inclinometer 2 Click output data rate. More...
 
enum  inclinometer2_return_value_t { INCLINOMETER2_OK = 0 , INCLINOMETER2_ERROR = -1 }
 Inclinometer 2 Click return value data. More...
 

Functions

void inclinometer2_cfg_setup (inclinometer2_cfg_t *cfg)
 Inclinometer 2 configuration object setup function.
 
void inclinometer2_drv_interface_selection (inclinometer2_cfg_t *cfg, inclinometer2_drv_t drv_sel)
 Inclinometer 2 driver interface setup function.
 
err_t inclinometer2_init (inclinometer2_t *ctx, inclinometer2_cfg_t *cfg)
 Inclinometer 2 initialization function.
 
err_t inclinometer2_default_cfg (inclinometer2_t *ctx)
 Inclinometer 2 default configuration function.
 
err_t inclinometer2_generic_write (inclinometer2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Inclinometer 2 data writing function.
 
err_t inclinometer2_generic_read (inclinometer2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Inclinometer 2 data reading function.
 
err_t inclinometer2_write_register (inclinometer2_t *ctx, uint8_t reg, uint8_t data_in)
 Inclinometer 2 write register function.
 
err_t inclinometer2_read_register (inclinometer2_t *ctx, uint8_t reg, uint8_t *data_out)
 Inclinometer 2 read register function.
 
err_t inclinometer2_check_communication (inclinometer2_t *ctx)
 Inclinometer 2 check communication function.
 
uint8_t inclinometer2_get_int_pin (inclinometer2_t *ctx)
 Inclinometer 2 get int pin function.
 
err_t inclinometer2_set_fsr_and_odr (inclinometer2_t *ctx, inclinometer2_fsr_t fsr, inclinometer2_odr_t odr)
 Inclinometer 2 set fsr and odr function.
 
err_t inclinometer2_get_accel (inclinometer2_t *ctx, float *x_axis, float *y_axis)
 Inclinometer 2 get accel function.
 
err_t inclinometer2_get_temperature (inclinometer2_t *ctx, float *temperature)
 Inclinometer 2 get temperature function.
 

Detailed Description

This file contains API for Inclinometer 2 Click Driver.

Typedef Documentation

◆ inclinometer2_master_io_t

typedef err_t(* inclinometer2_master_io_t) (struct inclinometer2_s *, uint8_t, uint8_t *, uint8_t)

Driver serial interface.

◆ inclinometer2_t

Inclinometer 2 Click context object.

Context object definition of Inclinometer 2 Click driver.

Enumeration Type Documentation

◆ inclinometer2_drv_t

Inclinometer 2 Click driver selector.

Selects target driver interface of Inclinometer 2 Click driver.

Enumerator
INCLINOMETER2_DRV_SEL_SPI 

SPI driver descriptor.

INCLINOMETER2_DRV_SEL_I2C 

I2C driver descriptor.

◆ inclinometer2_fsr_t

Inclinometer 2 Click accel full-scale range selection.

Predefined enum values for driver accel full-scale range selection.

Enumerator
INCLINOMETER2_FSR_0p5G 
INCLINOMETER2_FSR_3G 
INCLINOMETER2_FSR_1G 
INCLINOMETER2_FSR_2G 
INCLINOMETER2_FSR_BIT_MASK 

◆ inclinometer2_odr_t

Inclinometer 2 Click output data rate.

Predefined enum values for driver output data rate.

Enumerator
INCLINOMETER2_ODR_POWER_DOWN 
INCLINOMETER2_ODR_12p5HZ 
INCLINOMETER2_ODR_26HZ 
INCLINOMETER2_ODR_52HZ 
INCLINOMETER2_ODR_104HZ 
INCLINOMETER2_ODR_208HZ 
INCLINOMETER2_ODR_416HZ 
INCLINOMETER2_ODR_833HZ 
INCLINOMETER2_ODR_BIT_MASK 

◆ inclinometer2_return_value_t

Inclinometer 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
INCLINOMETER2_OK 
INCLINOMETER2_ERROR