smartsens 2.0.0.0
smartsens.h File Reference

This file contains API for Smart Sens 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  smartsens_fifo_parse_data_info
 Parsing data info. More...
 
union  smartsens_u16_conv
 U16 converter union. More...
 
union  smartsens_u32_conv
 U32 converter union. More...
 
union  smartsens_float_conv
 Float converter union. More...
 
struct  smartsens_sensor_info
 Sensor info. More...
 
struct  smartsens_fifo_parse_callback_table
 Callback prase. More...
 
struct  smartsens_fifo_buffer
 Fifo buffer. More...
 
struct  smartsens_s
 Smart Sens Click context object. More...
 
struct  smartsens_cfg_t
 Smart Sens Click configuration object. More...
 

Macros

#define SMARTSENS_FLASHIMG   0 /*< Firmware image for flash include */
 Smart Sens application preset.
 
#define SMARTSENS_FLASH   1 /*< Boot firmware from flash */
 
#define SMARTSENS_RAM   0 /*< Upload and boot firmware from RAM */
 
#define SMARTSENS_REG_COMMAND_INPUT   0x00
 Smart Sens description register.
 
#define SMARTSENS_REG_WAKE_UP_FIFO   0x01
 
#define SMARTSENS_REG_NON_WAKE_UP_FIFO   0x02
 
#define SMARTSENS_REG_STATUS_DEBUG_FIFO   0x03
 
#define SMARTSENS_REG_CHIP_CTRL   0x05
 
#define SMARTSENS_REG_HOST_INTERFACE_CTRL   0x06
 
#define SMARTSENS_REG_HOST_INTERRUPT_CTRL   0x07
 
#define SMARTSENS_REG_RESET_REQUEST   0x14
 
#define SMARTSENS_REG_TIMESTAMP_EVENT_REQUEST   0x15
 
#define SMARTSENS_REG_HOST_CTRL   0x16
 
#define SMARTSENS_REG_HOST_STATUS   0x17
 
#define SMARTSENS_REG_HOST_CRC   0x18191A1B
 
#define SMARTSENS_REG_FUSER2_PRODUCT_ID   0x1C
 
#define SMARTSENS_REG_FUSER2_REVISION_ID   0x1D
 
#define SMARTSENS_REG_ROM_VERSION   0x1E1F
 
#define SMARTSENS_REG_KERNEL_VERSION   0x2021
 
#define SMARTSENS_REG_USER_VERSION   0x2223
 
#define SMARTSENS_REG_FEATURE_STATUS   0x24
 
#define SMARTSENS_REG_BOOT_STATUS   0x25
 
#define SMARTSENS_REG_HOST_INTERRUPT_TIMESTAMP   0x26
 
#define SMARTSENS_REG_CHIP_ID   0x2B
 
#define SMARTSENS_REG_INTERRUPT_STATUS   0x2D
 
#define SMARTSENS_REG_ERROR_VALUE   0x2E
 
#define SMARTSENS_REG_ERROR_AUX   0x2F
 
#define SMARTSENS_REG_DEBUG_VALUE   0x30
 
#define SMARTSENS_REG_DEBUG_STATE   0x31
 
#define SMARTSENS_CMD_DOWNLOAD_POST_MORTEM_DATA   0x0001
 Smart Sens control commands.
 
#define SMARTSENS_CMD_UPLOAD_TO_RAM   0x0002
 
#define SMARTSENS_CMD_BOOT_RAM   0x0003
 
#define SMARTSENS_CMD_ERASE_FLASH   0x0004
 
#define SMARTSENS_CMD_WRITE_FLASH   0x0005
 
#define SMARTSENS_CMD_BOOT_FLASH   0x0006
 
#define SMARTSENS_CMD_SET_SENSOR_DATA_INJECTION   0x0007
 
#define SMARTSENS_CMD_INJECT_SENSOR_DATA   0x0008
 
#define SMARTSENS_CMD_FIFO_FLUSH   0x0009
 
#define SMARTSENS_CMD_SOFT_PASS_THROUGH   0x000A
 
#define SMARTSENS_CMD_REQUEST_SENSOR_SELF_TEST   0x000B
 
#define SMARTSENS_CMD_REQUEST_SENSOR_FAST_OFFSET_COMPENSATION   0x000C
 
#define SMARTSENS_CMD_CONFIGURE_SENSOR   0x000D
 
#define SMARTSENS_CMD_CHANGE_SENSOR_DYNAMIC_RANGE   0x000E
 
#define SMARTSENS_CMD_SET_CHANGE_SENSITIVITY   0x000F
 
#define SMARTSENS_CMD_DEBUG_TEST   0x0010
 
#define SMARTSENS_CMD_DUT_CONTINUE   0x0011
 
#define SMARTSENS_CMD_DUT_START_TEST   0x0012
 
#define SMARTSENS_CMD_CTRL_FIFO_FORMAT   0x0015
 
#define SMARTSENS_CMD_RAISE_SPEED   0x0017
 
#define SMARTSENS_CMD_SYSTEM_PARAMETERS_READ_MASK   0x1000
 
#define SMARTSENS_CMD_META_EVENT_CTRL_NON_WAKE_UP_FIFO   0x0101
 
#define SMARTSENS_CMD_META_EVENT_CTRL_WAKE_UP_FIFO   0x0102
 
#define SMARTSENS_CMD_META_EVENT_CTRL_FIFO_CTRL   0x0103
 
#define SMARTSENS_CMD_META_EVENT_CTRL_FIRMWARE_VERSION   0x0104
 
#define SMARTSENS_CMD_META_EVENT_CTRL_TIMESTAMPS   0x0105
 
#define SMARTSENS_CMD_META_EVENT_CTRL_FRAMEWORK_STATUS   0x0106
 
#define SMARTSENS_CMD_META_EVENT_CTRL_VIRUAL_SENSOR_PRESENT   0x011F
 
#define SMARTSENS_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_PRESENT   0x0120
 
#define SMARTSENS_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_INFO   0x0121
 
#define SMARTSENS_CMD_CALIBRATION_STATE_ACCELEROMETER   0x0201
 
#define SMARTSENS_CMD_CALIBRATION_STATE_GYROSCOPE   0x0203
 
#define SMARTSENS_CMD_CALIBRATION_STATE_MAGNETOMETER   0x0205
 
#define SMARTSENS_CMD_SIC_MATRIX   0x027D
 
#define SMARTSENS_CMD_BSX_VERSION   0x027E
 
#define SMARTSENS_CMD_VIRTUAL_SENSOR_INFO   0x0300
 
#define SMARTSENS_START_FLASH_ADR   0x00001F84
 Smart Sens flash start adress for firmware.
 
#define SMARTSENS_SENSOR_ID_CUSTOM_START   160
 Smart Sens virtual sensor IDs.
 
#define SMARTSENS_SENSOR_ID_CUSTOM_END   191
 
#define SMARTSENS_SENSOR_ID_MAX   200
 
#define SMARTSENS_SENSOR_ID_TBD   SMARTSENS_SENSOR_ID_MAX - 1
 
#define SMARTSENS_SENSOR_ID_ACC_PASS   1 /* Accelerometer passthrough */
 
#define SMARTSENS_SENSOR_ID_ACC_RAW   3 /* Accelerometer uncalibrated */
 
#define SMARTSENS_SENSOR_ID_ACC   4 /* Accelerometer corrected */
 
#define SMARTSENS_SENSOR_ID_ACC_BIAS   5 /* Accelerometer offset */
 
#define SMARTSENS_SENSOR_ID_ACC_WU   6 /* Accelerometer corrected wake up */
 
#define SMARTSENS_SENSOR_ID_ACC_RAW_WU   7 /* Accelerometer uncalibrated wake up */
 
#define SMARTSENS_SENSOR_ID_GYRO_PASS   10 /* Gyroscope passthrough */
 
#define SMARTSENS_SENSOR_ID_GYRO_RAW   12 /* Gyroscope uncalibrated */
 
#define SMARTSENS_SENSOR_ID_GYRO   13 /* Gyroscope corrected */
 
#define SMARTSENS_SENSOR_ID_GYRO_BIAS   14 /* Gyroscope offset */
 
#define SMARTSENS_SENSOR_ID_GYRO_WU   15 /* Gyroscope wake up */
 
#define SMARTSENS_SENSOR_ID_GYRO_RAW_WU   16 /* Gyroscope uncalibrated wake up */
 
#define SMARTSENS_SENSOR_ID_MAG_PASS   19 /* Magnetometer passthrough */
 
#define SMARTSENS_SENSOR_ID_MAG_RAW   21 /* Magnetometer uncalibrated */
 
#define SMARTSENS_SENSOR_ID_MAG   22 /* Magnetometer corrected */
 
#define SMARTSENS_SENSOR_ID_MAG_BIAS   23 /* Magnetometer offset */
 
#define SMARTSENS_SENSOR_ID_MAG_WU   24 /* Magnetometer wake up */
 
#define SMARTSENS_SENSOR_ID_MAG_RAW_WU   25 /* Magnetometer uncalibrated wake up */
 
#define SMARTSENS_SENSOR_ID_GRA   28 /* Gravity vector */
 
#define SMARTSENS_SENSOR_ID_GRA_WU   29 /* Gravity vector wake up */
 
#define SMARTSENS_SENSOR_ID_LACC   31 /* Linear acceleration */
 
#define SMARTSENS_SENSOR_ID_LACC_WU   32 /* Linear acceleration wake up */
 
#define SMARTSENS_SENSOR_ID_RV   34 /* Rotation vector */
 
#define SMARTSENS_SENSOR_ID_RV_WU   35 /* Rotation vector wake up */
 
#define SMARTSENS_SENSOR_ID_GAMERV   37 /* Game rotation vector */
 
#define SMARTSENS_SENSOR_ID_GAMERV_WU   38 /* Game rotation vector wake up */
 
#define SMARTSENS_SENSOR_ID_GEORV   40 /* Geo-magnetic rotation vector */
 
#define SMARTSENS_SENSOR_ID_GEORV_WU   41 /* Geo-magnetic rotation vector wake up */
 
#define SMARTSENS_SENSOR_ID_ORI   43 /* Orientation */
 
#define SMARTSENS_SENSOR_ID_ORI_WU   44 /* Orientation wake up */
 
#define SMARTSENS_SENSOR_ID_TILT_DETECTOR   48 /* Tilt detector */
 
#define SMARTSENS_SENSOR_ID_STD   50 /* Step detector */
 
#define SMARTSENS_SENSOR_ID_STC   52 /* Step counter */
 
#define SMARTSENS_SENSOR_ID_STC_WU   53 /* Step counter wake up */
 
#define SMARTSENS_SENSOR_ID_SIG   55 /* Significant motion */
 
#define SMARTSENS_SENSOR_ID_WAKE_GESTURE   57 /* Wake gesture */
 
#define SMARTSENS_SENSOR_ID_GLANCE_GESTURE   59 /* Glance gesture */
 
#define SMARTSENS_SENSOR_ID_PICKUP_GESTURE   61 /* Pickup gesture */
 
#define SMARTSENS_SENSOR_ID_AR   63 /* Activity recognition */
 
#define SMARTSENS_SENSOR_ID_WRIST_TILT_GESTURE   67 /* Wrist tilt gesture */
 
#define SMARTSENS_SENSOR_ID_DEVICE_ORI   69 /* Device orientation */
 
#define SMARTSENS_SENSOR_ID_DEVICE_ORI_WU   70 /* Device orientation wake up */
 
#define SMARTSENS_SENSOR_ID_STATIONARY_DET   75 /* Stationary detect */
 
#define SMARTSENS_SENSOR_ID_MOTION_DET   77 /* Motion detect */
 
#define SMARTSENS_SENSOR_ID_ACC_BIAS_WU   91 /* Accelerometer offset wake up */
 
#define SMARTSENS_SENSOR_ID_GYRO_BIAS_WU   92 /* Gyroscope offset wake up */
 
#define SMARTSENS_SENSOR_ID_MAG_BIAS_WU   93 /* Magnetometer offset wake up */
 
#define SMARTSENS_SENSOR_ID_STD_WU   94 /* Step detector wake up */
 
#define SMARTSENS_SENSOR_ID_TEMP   128 /* Temperature */
 
#define SMARTSENS_SENSOR_ID_BARO   129 /* Barometer */
 
#define SMARTSENS_SENSOR_ID_HUM   130 /* Humidity */
 
#define SMARTSENS_SENSOR_ID_GAS   131 /* Gas */
 
#define SMARTSENS_SENSOR_ID_TEMP_WU   132 /* Temperature wake up */
 
#define SMARTSENS_SENSOR_ID_BARO_WU   133 /* Barometer wake up */
 
#define SMARTSENS_SENSOR_ID_HUM_WU   134 /* Humidity wake up */
 
#define SMARTSENS_SENSOR_ID_GAS_WU   135 /* Gas wake up */
 
#define SMARTSENS_SENSOR_ID_STC_HW   136 /* Hardware Step counter */
 
#define SMARTSENS_SENSOR_ID_STD_HW   137 /* Hardware Step detector */
 
#define SMARTSENS_SENSOR_ID_SIG_HW   138 /* Hardware Significant motion */
 
#define SMARTSENS_SENSOR_ID_STC_HW_WU   139 /* Hardware Step counter wake up */
 
#define SMARTSENS_SENSOR_ID_STD_HW_WU   140 /* Hardware Step detector wake up */
 
#define SMARTSENS_SENSOR_ID_SIG_HW_WU   141 /* Hardware Significant motion wake up */
 
#define SMARTSENS_SENSOR_ID_ANY_MOTION   142 /* Any motion */
 
#define SMARTSENS_SENSOR_ID_ANY_MOTION_WU   143 /* Any motion wake up */
 
#define SMARTSENS_SENSOR_ID_EXCAMERA   144 /* External camera trigger */
 
#define SMARTSENS_SENSOR_ID_GPS   145 /* GPS */
 
#define SMARTSENS_SENSOR_ID_LIGHT   146 /* Light */
 
#define SMARTSENS_SENSOR_ID_PROX   147 /* Proximity */
 
#define SMARTSENS_SENSOR_ID_LIGHT_WU   148 /* Light wake up */
 
#define SMARTSENS_SENSOR_ID_PROX_WU   149 /* Proximity wake up */
 
#define SMARTSENS_IS_SYS_ID(sid)   ( ( sid ) >= 224 )
 
#define SMARTSENS_SYS_ID_PADDING   0
 
#define SMARTSENS_SYS_ID_TS_SMALL_DELTA   251
 
#define SMARTSENS_SYS_ID_TS_LARGE_DELTA   252
 
#define SMARTSENS_SYS_ID_TS_FULL   253
 
#define SMARTSENS_SYS_ID_META_EVENT   254
 
#define SMARTSENS_SYS_ID_TS_SMALL_DELTA_WU   245
 
#define SMARTSENS_SYS_ID_TS_LARGE_DELTA_WU   246
 
#define SMARTSENS_SYS_ID_TS_FULL_WU   247
 
#define SMARTSENS_SYS_ID_META_EVENT_WU   248
 
#define SMARTSENS_SYS_ID_FILLER   255
 
#define SMARTSENS_SYS_ID_DEBUG_MSG   250
 
#define SMARTSENS_SYS_ID_SMARTSENS_LOG_UPDATE_SUB   243
 
#define SMARTSENS_SYS_ID_SMARTSENS_LOG_DOSTEP   244
 
#define SMARTSENS_N_VIRTUAL_SENSOR_MAX   256 /* Maximum no of available virtual sensor */
 
#define SMARTSENS_SPECIAL_SENSOR_ID_OFFSET   245 /* Special & debug virtual sensor id starts at 245 */
 
#define SMARTSENS_META_EVENT_FLUSH_COMPLETE   1
 Smart Sens meta event definitions.
 
#define SMARTSENS_META_EVENT_SAMPLE_RATE_CHANGED   2
 
#define SMARTSENS_META_EVENT_POWER_MODE_CHANGED   3
 
#define SMARTSENS_META_EVENT_ALGORITHM_EVENTS   5
 
#define SMARTSENS_META_EVENT_SENSOR_STATUS   6
 
#define SMARTSENS_META_EVENT_BSX_DO_STEPS_MAIN   7
 
#define SMARTSENS_META_EVENT_BSX_DO_STEPS_CALIB   8
 
#define SMARTSENS_META_EVENT_BSX_GET_OUTPUT_SIGNAL   9
 
#define SMARTSENS_META_EVENT_RESERVED1   10
 
#define SMARTSENS_META_EVENT_SENSOR_ERROR   11
 
#define SMARTSENS_META_EVENT_FIFO_OVERFLOW   12
 
#define SMARTSENS_META_EVENT_DYNAMIC_RANGE_CHANGED   13
 
#define SMARTSENS_META_EVENT_FIFO_WATERMARK   14
 
#define SMARTSENS_META_EVENT_RESERVED2   15
 
#define SMARTSENS_META_EVENT_INITIALIZED   16
 
#define SMARTSENS_META_TRANSFER_CAUSE   17
 
#define SMARTSENS_META_EVENT_SENSOR_FRAMEWORK   18
 
#define SMARTSENS_META_EVENT_RESET   19
 
#define SMARTSENS_META_EVENT_SPACER   20
 
#define SMARTSENS_CHIP_ID_VALUE   0x70
 Smart Sens IDs.
 
#define SMARTSENS_FUSER2_PRODUCT_ID_VALUE   0x89
 
#define SMARTSENS_BOOTSTATUS_FLASH_DETECTED   0x01
 Boot status.
 
#define SMARTSENS_BOOTSTATUS_FLASH_VERIFY_DONE   0x02
 
#define SMARTSENS_BOOTSTATUS_FLASH_VERIFY_ERROR   0x04
 
#define SMARTSENS_BOOTSTATUS_NO_FLASH   0x08
 
#define SMARTSENS_BOOTSTATUS_HOST_INTERFACE_READY   0x10
 
#define SMARTSENS_BOOTSTATUS_HOST_FW_VERIFY_DONE   0x20
 
#define SMARTSENS_BOOTSTATUS_HOST_FW_VERIFY_ERROR   0x40
 
#define SMARTSENS_BOOTSTATUS_HOST_FW_IDLE   0x80
 
#define SMARTSENS_HOSTSTATUS_POWER_STATE   0x01
 Host status.
 
#define SMARTSENS_HOSTSTATUS_HOST_PROTOCOL   0x02
 
#define SMARTSENS_HOSTSTATUS_HOST_CHANNEL_0   0x10
 
#define SMARTSENS_HOSTSTATUS_HOST_CHANNEL_1   0x20
 
#define SMARTSENS_HOSTSTATUS_HOST_CHANNEL_2   0x40
 
#define SMARTSENS_HOSTSTATUS_HOST_CHANNEL_3   0x80
 
#define SMARTSENS_IST_MASK_ASSERTED   0x1
 Interrupt status.
 
#define SMARTSENS_IST_MASK_FIFO_W   0x6
 
#define SMARTSENS_IST_MASK_FIFO_NW   0x18
 
#define SMARTSENS_IST_MASK_STATUS   0x20
 
#define SMARTSENS_IST_MASK_DEBUG   0x40
 
#define SMARTSENS_IST_MASK_RESET_FAULT   0x80
 
#define SMARTSENS_IST_FIFO_W_DRDY   0x2
 
#define SMARTSENS_IST_FIFO_W_LTCY   0x4
 
#define SMARTSENS_IST_FIFO_W_WM   0x6
 
#define SMARTSENS_IST_FIFO_NW_DRDY   0x8
 
#define SMARTSENS_IST_FIFO_NW_LTCY   0x10
 
#define SMARTSENS_IST_FIFO_NW_WM   0x18
 
#define SMARTSENS_IS_INT_FIFO_W(status)   ( status & SMARTSENS_IST_MASK_FIFO_W )
 
#define SMARTSENS_IS_INT_FIFO_NW(status)   ( status & SMARTSENS_IST_MASK_FIFO_NW )
 
#define SMARTSENS_IS_INT_STATUS(status)   ( status & SMARTSENS_IST_MASK_STATUS )
 
#define SMARTSENS_IS_INT_ASYNC_STATUS(status)   ( status & SMARTSENS_IST_MASK_DEBUG )
 
#define SMARTSENS_IS_INT_RESET(status)   ( status & SMARTSENS_IST_MASK_RESET_FAULT )
 
#define SMARTSENS_IST_MASK_FIFO   ( SMARTSENS_IST_MASK_FIFO_W | SMARTSENS_IST_MASK_FIFO_NW )
 
#define SMARTSENS_IS_INT_FIFO(status)   ( status & SMARTSENS_IST_MASK_FIFO )
 
#define SMARTSENS_ICTL_DISABLE_FIFO_W   0x01
 Interrupt control.
 
#define SMARTSENS_ICTL_DISABLE_FIFO_NW   0x02
 
#define SMARTSENS_ICTL_DISABLE_STATUS_FIFO   0x04
 
#define SMARTSENS_ICTL_DISABLE_DEBUG   0x08
 
#define SMARTSENS_ICTL_DISABLE_FAULT   0x10
 
#define SMARTSENS_ICTL_ACTIVE_LOW   0x20
 
#define SMARTSENS_ICTL_EDGE   0x40
 
#define SMARTSENS_ICTL_OPEN_DRAIN   0x80
 
#define SMARTSENS_HIF_CTRL_ABORT_TRANSFER_CHANNEL_0   0x01
 Host interface control.
 
#define SMARTSENS_HIF_CTRL_ABORT_TRANSFER_CHANNEL_1   0x02
 
#define SMARTSENS_HIF_CTRL_ABORT_TRANSFER_CHANNEL_2   0x04
 
#define SMARTSENS_HIF_CTRL_ABORT_TRANSFER_CHANNEL_3   0x08
 
#define SMARTSENS_HIF_CTRL_AP_SUSPENDED   0x10
 
#define SMARTSENS_HIF_CTRL_TIMESTAMP_EV_CTRL   0x40
 
#define SMARTSENS_HIF_CTRL_ASYNC_STATUS_CHANNEL   0x80
 
#define SMARTSENS_LE2U16(x)   ( ( uint16_t )( ( x )[ 0 ] | ( x )[ 1 ] << 8 ) )
 Converter macros.
 
#define SMARTSENS_LE2S16(x)   ( ( int16_t )SMARTSENS_LE2U16( x ) )
 
#define SMARTSENS_LE2U24(x)
 
#define SMARTSENS_LE2U32(x)
 
#define SMARTSENS_LE2S32(x)   ( ( int32_t )SMARTSENS_LE2U32( x ) )
 
#define SMARTSENS_LE2U40(x)   ( SMARTSENS_LE2U32( x ) | ( uint32_t )( x )[ 4 ] << 32 )
 
#define SMARTSENS_TIMESTAMP_TO_SEC(x)   ( ( uint32_t ) ( x * ( 15625.0 / UINT32_C( 1000000000 ) ) ) )
 
#define SMARTSENS_SLAVE_ADDRESS_1   0x29
 Smart Sens device address setting.
 
#define SMARTSENS_SLAVE_ADDRESS_0   0x28
 
#define SMARTSENS_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define SMARTSENS_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define SMARTSENS_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* smartsens_master_io_t) (struct smartsens_s *, uint8_t, uint8_t *, uint8_t)
 Smart Sens Click driver interface.
 
typedef void(* smartsens_fifo_parse_callback_t) (struct smartsens_fifo_parse_data_info *callback_info, void *private_data)
 
typedef struct smartsens_s smartsens_t
 Smart Sens Click context object.
 

Enumerations

enum  smartsens_drv_t { SMARTSENS_DRV_SEL_SPI , SMARTSENS_DRV_SEL_I2C }
 Smart Sens Click driver selector. More...
 
enum  smartsens_fifo_type { SMARTSENS_FIFO_TYPE_WAKEUP , SMARTSENS_FIFO_TYPE_NON_WAKEUP , SMARTSENS_FIFO_TYPE_STATUS , SMARTSENS_FIFO_TYPE_MAX }
 Fifo type enum. More...
 
enum  smartsens_return_value_t { SMARTSENS_OK = 0 , SMARTSENS_ERROR = -1 , SMARTSENS_ERROR_TIMEOUT = -2 }
 Smart Sens Click return value data. More...
 

Functions

void smartsens_cfg_setup (smartsens_cfg_t *cfg)
 Smart Sens configuration object setup function.
 
void smartsens_drv_interface_selection (smartsens_cfg_t *cfg, smartsens_drv_t drv_sel)
 Smart Sens driver interface setup function.
 
err_t smartsens_init (smartsens_t *ctx, smartsens_cfg_t *cfg)
 Smart Sens initialization function.
 
err_t smartsens_default_cfg (smartsens_t *ctx)
 Smart Sens default configuration function.
 
err_t smartsens_generic_write (smartsens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Smart Sens data writing function.
 
err_t smartsens_generic_read (smartsens_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Smart Sens data reading function.
 
err_t smartsens_byte_write (smartsens_t *ctx, uint8_t reg, uint8_t data_in)
 Byte writing function.
 
err_t smartsens_byte_read (smartsens_t *ctx, uint8_t reg, uint8_t *data_out)
 Byte reading function.
 
uint8_t smartsens_get_interrupt (smartsens_t *ctx)
 Get interrupt.
 
err_t smartsens_cmd_write (smartsens_t *ctx, uint16_t cmd, uint8_t *cmd_buf, uint16_t cmd_len)
 Send command.
 
err_t smartsens_status_read (smartsens_t *ctx, uint16_t *cmd, uint8_t *cmd_buf, uint16_t *cmd_len)
 Read Status and Debug FIFO.
 
err_t smartsens_get_parameter (smartsens_t *ctx, uint16_t parameter, uint8_t *parameter_buf, uint16_t *parameter_len)
 Get command parameters response.
 
void smartsens_reset (smartsens_t *ctx)
 Reset device.
 
err_t smartsens_sw_reset (smartsens_t *ctx)
 SW Reset device.
 
err_t smartsens_update_firmware (smartsens_t *ctx)
 Upload firmware image to the device.
 
err_t smartsens_boot_firmware (smartsens_t *ctx)
 Boot firmware image.
 
err_t smartsens_power_on_device (smartsens_t *ctx)
 Power on device boot/upload firmware to device.
 
err_t smartsens_update_virtual_sensor_list (smartsens_t *ctx)
 Update the callback table's information.
 
err_t smartsens_get_virt_sensor_list (smartsens_t *ctx, uint8_t *sensor_list)
 Get the virtual sensor list.
 
err_t smartsens_set_virt_sensor_cfg (smartsens_t *ctx, uint8_t sensor_id, float sample_rate, uint32_t latency)
 Set configuration fro virtual sensor.
 
err_t smartsens_get_and_process_fifo (smartsens_t *ctx, uint8_t *work_buffer, uint32_t buffer_size)
 Get and process the FIFO.
 
err_t smartsens_register_fifo_parse_callback (smartsens_t *ctx, uint8_t sensor_id, smartsens_fifo_parse_callback_t callback, void *callback_ref)
 Link a callback to virtual sensor.
 

Detailed Description

This file contains API for Smart Sens Click Driver.

Typedef Documentation

◆ smartsens_fifo_parse_callback_t

typedef void(* smartsens_fifo_parse_callback_t) (struct smartsens_fifo_parse_data_info *callback_info, void *private_data)

◆ smartsens_master_io_t

typedef err_t(* smartsens_master_io_t) (struct smartsens_s *, uint8_t, uint8_t *, uint8_t)

Smart Sens Click driver interface.

Definition of driver interface of Smart Sens Click driver. < Driver serial interface. Driver callback interface.

◆ smartsens_t

typedef struct smartsens_s smartsens_t

Smart Sens Click context object.

Context object definition of Smart Sens Click driver.

Enumeration Type Documentation

◆ smartsens_drv_t

Smart Sens Click driver selector.

Selects target driver interface of Smart Sens Click driver.

Enumerator
SMARTSENS_DRV_SEL_SPI 

SPI driver descriptor.

SMARTSENS_DRV_SEL_I2C 

I2C driver descriptor.

◆ smartsens_fifo_type

Fifo type enum.

Enum types of FIFO of the Smart Sens Click driver.

Enumerator
SMARTSENS_FIFO_TYPE_WAKEUP 
SMARTSENS_FIFO_TYPE_NON_WAKEUP 
SMARTSENS_FIFO_TYPE_STATUS 
SMARTSENS_FIFO_TYPE_MAX 

◆ smartsens_return_value_t

Smart Sens Click return value data.

Predefined enum values for driver return values.

Enumerator
SMARTSENS_OK 
SMARTSENS_ERROR 
SMARTSENS_ERROR_TIMEOUT