smartdof 2.0.0.0
smartdof.h File Reference

This file contains API for Smart DOF 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  smartdof_t
 Click ctx object definition. More...
 
struct  smartdof_cfg_t
 Click configuration structure definition. More...
 
struct  smartdof_pir_t
 Click product id response definition. More...
 
struct  smartdof_rr_t
 Click FRS read response definition. More...
 
struct  smartdof_sfc_t
 Click set feature command definition. More...
 

Macros

#define SMARTDOF_MAP_MIKROBUS(cfg, mikrobus)
 
#define SMARTDOF_RETVAL   uint8_t
 
#define SMARTDOF_OK   0x00
 
#define SMARTDOF_INIT_ERROR   0xFF
 
#define SLAVE_ADDRESS   0x4A
 
#define SMARTDOF_BMODE_FW_UPDATE   0x00
 
#define SMARTDOF_BMODE_NORMAL   0x01
 
#define SMARTDOF_QPOINT_RAW_ACCEL   0
 
#define SMARTDOF_QPOINT_ACCEL   8
 
#define SMARTDOF_QPOINT_LINEAR_ACCEL   8
 
#define SMARTDOF_QPOINT_GRAVITY   8
 
#define SMARTDOF_QPOINT_RAW_GYRO   0
 
#define SMARTDOF_QPOINT_GYRO_CALIB   9
 
#define SMARTDOF_QPOINT_GYRO_UNCALIB   9
 
#define SMARTDOF_QPOINT_RAW_MAGNETO   0
 
#define SMARTDOF_QPOINT_MAGNET_CALIB   4
 
#define SMARTDOF_QPOINT_MAGNET_UNCALIB   4
 
#define SMARTDOF_QPOINT_ROT_VECT   14
 
#define SMARTDOF_QPOINT_GAME_ROT_VECT   14
 
#define SMARTDOF_QPOINT_GEOMAG_ROT_VECT   14
 
#define SMARTDOF_QPOINT_TAP_DETECT   0
 
#define SMARTDOF_QPOINT_STEP_DETECT   0
 
#define SMARTDOF_QPOINT_STEP_COUNT   0
 
#define SMARTDOF_QPOINT_SIG_MOTION   0
 
#define SMARTDOF_QPOINT_STABIL_CLASS   0
 
#define SMARTDOF_QPOINT_SHAKE_DETECT   0
 
#define SMARTDOF_QPOINT_STABIL_DETECT   0
 
#define SMARTDOF_QPOINT_PERS_ACT_CLASS   0
 
#define SMARTDOF_QPOINT_ARVR_STABIL_ROT_VECT   14
 
#define SMARTDOF_QPOINT_ARVR_STABIL_GAME_ROT_VECT   14
 
#define SMARTDOF_QPOINT_GYRO_INT_ROT_VECT   14
 
#define SMARTDOF_CHAN_CMD   0
 
#define SMARTDOF_CHAN_EXE   1
 
#define SMARTDOF_CHAN_CTRL   2
 
#define SMARTDOF_CHAN_INPUT_REP   3
 
#define SMARTDOF_CHAN_WAKE_REP   4
 
#define SMARTDOF_CHAN_GYRO_ROT_VECT   5
 
#define SMARTDOF_CMD_ERR   0x01
 
#define SMARTDOF_CMD_COUNT   0x02
 
#define SMARTDOF_CMD_TARE   0x03
 
#define SMARTDOF_CMD_INIT   0x04
 
#define SMARTDOF_CMD_UNS_INIT   0x84
 
#define SMARTDOF_CMD_SAVE_DCD   0x06
 
#define SMARTDOF_CMD_ME_CALIB   0x07
 
#define SMARTDOF_CMD_DCD_PERIOD_SAVE   0x09
 
#define SMARTDOF_CMD_OSCIL   0x0A
 
#define SMARTDOF_CMD_CLEAR_DCD   0x0B
 
#define SMARTDOF_CMD_CTR_SCMD_GET_CNT   0x00
 
#define SMARTDOF_CMD_CTR_SCMD_CLEAR_CNT   0x01
 
#define SMARTDOF_CMD_TARE_SCMD_TARE_NOW   0x00
 
#define SMARTDOF_CMD_TARE_SCMD_PERS_TARE   0x01
 
#define SMARTDOF_CMD_TARE_SCMD_SET_REORIENT   0x02
 
#define SMARTDOF_CMD_INIT_SCMD_NO_OP   0x00
 
#define SMARTDOF_CMD_INIT_SCMD_ENT_SENS_HUB   0x01
 
#define SMARTDOF_REP_ID_GET_FEAT_REQ   0xFE
 
#define SMARTDOF_REP_ID_SET_FEAT_CMD   0xFD
 
#define SMARTDOF_REP_ID_GET_FEAT_RESP   0xFC
 
#define SMARTDOF_REP_ID_PROD_ID_REQ   0xF9
 
#define SMARTDOF_REP_ID_PROD_ID_RESP   0xF8
 
#define SMARTDOF_REP_ID_FRS_WR_REQ   0xF7
 
#define SMARTDOF_REP_ID_FRS_WR_DATA   0xF6
 
#define SMARTDOF_REP_ID_FRS_WR_RESP   0xF5
 
#define SMARTDOF_REP_ID_FRS_RD_REQ   0xF4
 
#define SMARTDOF_REP_ID_FRS_RD_RESP   0xF3
 
#define SMARTDOF_REP_ID_CMD_REQ   0xF2
 
#define SMARTDOF_REP_ID_CMD_RESP   0xF1
 
#define SMARTDOF_FEAT_REP_ID_BASE_TIMESTAMP   0xFB
 
#define SMARTDOF_FEAT_REP_ID_TIMESTAMP_REBASE   0xFA
 
#define SMARTDOF_FEAT_REP_ID_ACCEL   0x01
 
#define SMARTDOF_FEAT_REP_ID_GYRO   0x02
 
#define SMARTDOF_FEAT_REP_ID_MAGNET   0x03
 
#define SMARTDOF_FEAT_REP_ID_LINEAR_ACCEL   0x04
 
#define SMARTDOF_FEAT_REP_ID_ROT_VECTOR   0x05
 
#define SMARTDOF_FEAT_REP_ID_GRAVITY   0x06
 
#define SMARTDOF_FEAT_REP_ID_UNCALIB_GYRO   0x07
 
#define SMARTDOF_FEAT_REP_ID_GAME_ROT_VECTOR   0x08
 
#define SMARTDOF_FEAT_REP_ID_GEOMAG_ROT_VECTOR   0x09
 
#define SMARTDOF_FEAT_REP_ID_PRESSURE   0x0A
 
#define SMARTDOF_FEAT_REP_ID_AMBI_LIGHT   0x0B
 
#define SMARTDOF_FEAT_REP_ID_HIMIDITY   0x0C
 
#define SMARTDOF_FEAT_REP_ID_PROXY   0x0D
 
#define SMARTDOF_FEAT_REP_ID_TEMPERATURE   0x0E
 
#define SMARTDOF_FEAT_REP_ID_UNCALIB_MAG_FIELD   0x0F
 
#define SMARTDOF_FEAT_REP_ID_TAP_DETECT   0x10
 
#define SMARTDOF_FEAT_REP_ID_STEP_COUNT   0x11
 
#define SMARTDOF_FEAT_REP_ID_SIG_MOTION   0x12
 
#define SMARTDOF_FEAT_REP_ID_STABIL_CLASS   0x13
 
#define SMARTDOF_FEAT_REP_ID_RAW_ACCEL   0x14
 
#define SMARTDOF_FEAT_REP_ID_RAW_GYRO   0x15
 
#define SMARTDOF_FEAT_REP_ID_RAW_MAGNETO   0x16
 
#define SMARTDOF_FEAT_REP_ID_SAR   0x17
 
#define SMARTDOF_FEAT_REP_ID_STEP_DETECT   0x18
 
#define SMARTDOF_FEAT_REP_ID_SHAKE_DETECT   0x19
 
#define SMARTDOF_FEAT_REP_ID_FLIP_DETECT   0x1A
 
#define SMARTDOF_FEAT_REP_ID_PICKUP_DETECT   0x1B
 
#define SMARTDOF_FEAT_REP_ID_STABIL_DETECT   0x1C
 
#define SMARTDOF_FEAT_REP_ID_PERS_ACT_CLASS   0x1E
 
#define SMARTDOF_FEAT_REP_ID_SLEEP_DETECT   0x1F
 
#define SMARTDOF_FEAT_REP_ID_TILT_DETECT   0x20
 
#define SMARTDOF_FEAT_REP_ID_POCKET_DETECT   0x21
 
#define SMARTDOF_FEAT_REP_ID_CIRCLE_DETECT   0x22
 
#define SMARTDOF_FEAT_REP_ID_HART_RATE_MONITOR   0x23
 
#define SMARTDOF_FEAT_REP_ID_ARVR_STABIL_ROT_VECT   0x28
 
#define SMARTDOF_FEAT_REP_ID_ARVR_GAME_STABIL_ROT_VECT   0x29
 
#define SMARTDOF_FRS_REP_ID_STATIC_CALIB_AGM   0x7979
 
#define SMARTDOF_FRS_REP_ID_NOMINAL_CALIB_AGM   0x4D4D
 
#define SMARTDOF_FRS_REP_ID_STATIC_CALIB_SRA   0x8A8A
 
#define SMARTDOF_FRS_REP_ID_NOMINAL_CALIB_SRA   0x4E4E
 
#define SMARTDOF_FRS_REP_ID_DYNAMIC_CALIB   0x1F1F
 
#define SMARTDOF_FRS_REP_ID_MOTION_ENG_POW_MGMT   0xD3E2
 
#define SMARTDOF_FRS_REP_ID_SYS_ORIENT   0x2D3E
 
#define SMARTDOF_FRS_REP_ID_PRIM_ACCEL_ORIENT   0x2D41
 
#define SMARTDOF_FRS_REP_ID_SCREEN_ROT_ACCEL_ORIENT   0x2D43
 
#define SMARTDOF_FRS_REP_ID_GYRO_ORIENT   0x2D46
 
#define SMARTDOF_FRS_REP_ID_MAGNETO_ORIENT   0x2D4C
 
#define SMARTDOF_FRS_REP_ID_ARVR_STABIL_ROT_VEC   0x3E2D
 
#define SMARTDOF_FRS_REP_ID_ARVR_STABIL_GAME_ROT_VEC   0x3E2E
 
#define SMARTDOF_FRS_REP_ID_SIG_MOTION_DETECT_CFG   0xC274
 
#define SMARTDOF_FRS_REP_ID_SHAKE_DETECT_CFG   0x7D7D
 
#define SMARTDOF_FRS_REP_ID_MAX_FUSION_PERIOD   0xD7D7
 
#define SMARTDOF_FRS_REP_ID_SERIAL_NUM   0x4B4B
 
#define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_PRESS   0x39AF
 
#define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_TEMP   0x4D20
 
#define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_HUMI   0x1AC9
 
#define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_AMBI   0x39B1
 
#define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_PROXI   0x4DA2
 
#define SMARTDOF_FRS_REP_ID_ALS_CALIB   0xD401
 
#define SMARTDOF_FRS_REP_ID_PROXI_SENS_CALIB   0xD402
 
#define SMARTDOF_FRS_REP_ID_PICKUP_DETECT_CFG   0x1B2A
 
#define SMARTDOF_FRS_REP_ID_FLIP_DETECT_CFG   0xFC94
 
#define SMARTDOF_FRS_REP_ID_STAB_DETECT_CFG   0xED85
 
#define SMARTDOF_FRS_REP_ID_ACT_TRACK_CFG   0xED88
 
#define SMARTDOF_FRS_REP_ID_SLEEP_DETECT_CFG   0xED87
 
#define SMARTDOF_FRS_REP_ID_TILT_DETECT_CFG   0xED89
 
#define SMARTDOF_FRS_REP_ID_POCK_DETECT_CFG   0xEF27
 
#define SMARTDOF_FRS_REP_ID_CIRC_DETECT_CFG   0xEE51
 
#define SMARTDOF_FRS_REP_ID_USER_REC   0x74B4
 
#define SMARTDOF_FRS_REP_ID_MOTION_ENG_TIME_SRC_SEL   0xD403
 
#define SMARTDOF_FRS_REP_ID_UART_OUT_FORMAT_SEL   0xA1A1
 
#define SMARTDOF_FRS_REP_ID_GYROINT_ROT_VEC_CFG   0xA1A2
 
#define SMARTDOF_FRS_REP_ID_FUSION_CTRL_FLAGS   0xA1A3
 
#define SMARTDOF_FRS_REP_ID_RAW_ACCEL   0xE301
 
#define SMARTDOF_FRS_REP_ID_ACCEL   0xE302
 
#define SMARTDOF_FRS_REP_ID_LINEAR_ACCEL   0xE303
 
#define SMARTDOF_FRS_REP_ID_GRAVITY   0xE304
 
#define SMARTDOF_FRS_REP_ID_RAW_GYRO   0xE305
 
#define SMARTDOF_FRS_REP_ID_GYRO_CALIB   0xE306
 
#define SMARTDOF_FRS_REP_ID_GYRO_UNCALIB   0xE307
 
#define SMARTDOF_FRS_REP_ID_RAW_MAGNETO   0xE308
 
#define SMARTDOF_FRS_REP_ID_MAGNETO_CALIB   0xE309
 
#define SMARTDOF_FRS_REP_ID_MAGNETO_UNCALIB   0xE30A
 
#define SMARTDOF_FRS_REP_ID_ROT_VECTOR   0xE30B
 
#define SMARTDOF_FRS_REP_ID_GAME_ROT_VECTOR   0xE30C
 
#define SMARTDOF_FRS_REP_ID_GEO_ROT_VECTOR   0xE30D
 
#define SMARTDOF_FRS_REP_ID_PRESSURE   0xE30E
 
#define SMARTDOF_FRS_REP_ID_AMBIENT_LIGHT   0xE30F
 
#define SMARTDOF_FRS_REP_ID_HUMIDITY   0xE310
 
#define SMARTDOF_FRS_REP_ID_PROXY   0xE311
 
#define SMARTDOF_FRS_REP_ID_TEMPERATURE   0xE312
 
#define SMARTDOF_FRS_REP_ID_TAP_DETECT   0xE313
 
#define SMARTDOF_FRS_REP_ID_STEP_DETECT   0xE314
 
#define SMARTDOF_FRS_REP_ID_STEP_COUNT   0xE315
 
#define SMARTDOF_FRS_REP_ID_SIG_MOTION   0xE316
 
#define SMARTDOF_FRS_REP_ID_STABIL_CLASS   0xE317
 
#define SMARTDOF_FRS_REP_ID_SHAKE_DETECT   0xE318
 
#define SMARTDOF_FRS_REP_ID_FLIP_DETECT   0xE319
 
#define SMARTDOF_FRS_REP_ID_PICK_DETECT   0xE31A
 
#define SMARTDOF_FRS_REP_ID_STABIL_DETECT   0xE31B
 
#define SMARTDOF_FRS_REP_ID_PERS_ACT_CLASS   0xE31C
 
#define SMARTDOF_FRS_REP_ID_SLEEP_DETECT   0xE31D
 
#define SMARTDOF_FRS_REP_ID_TILT_DETECT   0xE31E
 
#define SMARTDOF_FRS_REP_ID_POCKET_DETECT   0xE31F
 
#define SMARTDOF_FRS_REP_ID_CIRCLE_DETECT   0xE320
 
#define SMARTDOF_FRS_REP_ID_HEART_RATE_MON   0xE321
 
#define SMARTDOF_FRS_REP_ID_ARVR_STABIL_ROT_VECTOR   0xE322
 
#define SMARTDOF_FRS_REP_ID_ARVR_STABIL_GAME_ROT_VECTOR   0xE323
 
#define SMARTDOF_FRS_REP_ID_GYRO_INTEG_ROT_VEC   0xE324
 

Functions

void smartdof_cfg_setup (smartdof_cfg_t *cfg)
 Config Object Initialization function.
 
SMARTDOF_RETVAL smartdof_init (smartdof_t *ctx, smartdof_cfg_t *cfg)
 Initialization function.
 
uint8_t smartdof_default_cfg (smartdof_t *ctx)
 Click Default Configuration function.
 
void smartdof_i2c_write (smartdof_t *ctx, uint8_t *write_data, uint16_t n_bytes)
 Sending data bytes via I2C.
 
void smartdof_i2c_read (smartdof_t *ctx, uint8_t *read_data, uint16_t n_bytes)
 Receiving data bytes via I2C.
 
uint8_t smartdof_int_get (smartdof_t *ctx)
 Getting state of INT pin.
 
void smartdof_rst_set (smartdof_t *ctx, uint8_t pin_state)
 Setting RST pin state.
 
void smartdof_bt_set (smartdof_t *ctx, uint8_t pin_state)
 Setting BT pin state.
 
void smartdof_device_reset (smartdof_t *ctx, uint8_t boot_mode)
 Device reset.
 
float smartdof_q_point_to_float (int16_t sensor_data, uint8_t sensor_q_point)
 Q point (fixed point) value to float conversion.
 
void smartdof_send_packet (smartdof_t *ctx, uint8_t channel_number, uint16_t data_length, uint8_t *packet_data)
 Sending data packet.
 
uint8_t smartdof_receive_packet (smartdof_t *ctx, uint32_t n_cycles_timeout)
 Receiving data packet.
 
void smartdof_get_data (smartdof_t *ctx, uint8_t *data_header, uint16_t *data_length, uint8_t *data_buffer)
 Getting received data.
 
void smartdof_product_id_request (smartdof_t *ctx)
 Requesting product id.
 
uint8_t smartdof_product_id_response (smartdof_t *ctx, smartdof_pir_t *pir)
 Receiving product id response.
 
void smartdof_frs_write_request (smartdof_t *ctx, uint16_t data_length, uint16_t frs_type)
 Requesting FRS write.
 
void smartdof_frs_write_data_request (smartdof_t *ctx, uint16_t data_offset, uint32_t *data_buffer)
 Requesting FRS write data.
 
uint8_t smartdof_frs_write_response (smartdof_t *ctx, uint8_t *frs_status, uint16_t *data_offset)
 Receiving FRS write response.
 
void smartdof_frs_read_request (smartdof_t *ctx, uint16_t data_offset, uint16_t frs_type, uint16_t data_size)
 Requesting FRS read.
 
uint8_t smartdof_frs_read_response (smartdof_t *ctx, smartdof_rr_t *rr)
 Receiving FRS read response.
 
void smartdof_command_request (smartdof_t *ctx, uint8_t command_type, uint8_t *command_parameters)
 Requesting command.
 
uint8_t smartdof_command_response (smartdof_t *ctx, uint8_t *response_parameters)
 Receiving command response.
 
void smartdof_get_feature_request (smartdof_t *ctx, uint8_t feature_report_id)
 Requesting get feature request.
 
void smartdof_set_feature_command (smartdof_t *ctx, smartdof_sfc_t *sfc)
 Requesting set feature command.
 
uint8_t smartdof_get_feature_response (smartdof_t *ctx, smartdof_sfc_t *sfc)
 Receiving get feature response.
 
void smartdof_force_sensor_flush (smartdof_t *ctx, uint8_t sensor_id)
 Requesting force sensor flush.
 
uint8_t smartdof_flush_completed (smartdof_t *ctx, uint8_t *sensor_id)
 Receiving flush completed response.
 

Detailed Description

This file contains API for Smart DOF Click driver.