39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52#include "drv_spi_master.h"
83#define SMARTSENS2_FLASHIMG 0
84#define SMARTSENS2_FLASH 1
85#define SMARTSENS2_RAM 0
91#define SMARTSENS2_REG_COMMAND_INPUT 0x00
92#define SMARTSENS2_REG_WAKE_UP_FIFO 0x01
93#define SMARTSENS2_REG_NON_WAKE_UP_FIFO 0x02
94#define SMARTSENS2_REG_STATUS_DEBUG_FIFO 0x03
95#define SMARTSENS2_REG_CHIP_CTRL 0x05
96#define SMARTSENS2_REG_HOST_INTERFACE_CTRL 0x06
97#define SMARTSENS2_REG_HOST_INTERRUPT_CTRL 0x07
98#define SMARTSENS2_REG_RESET_REQUEST 0x14
99#define SMARTSENS2_REG_TIMESTAMP_EVENT_REQUEST 0x15
100#define SMARTSENS2_REG_HOST_CTRL 0x16
101#define SMARTSENS2_REG_HOST_STATUS 0x17
102#define SMARTSENS2_REG_HOST_CRC 0x18191A1B
103#define SMARTSENS2_REG_FUSER2_PRODUCT_ID 0x1C
104#define SMARTSENS2_REG_FUSER2_REVISION_ID 0x1D
105#define SMARTSENS2_REG_ROM_VERSION 0x1E1F
106#define SMARTSENS2_REG_KERNEL_VERSION 0x2021
107#define SMARTSENS2_REG_USER_VERSION 0x2223
108#define SMARTSENS2_REG_FEATURE_STATUS 0x24
109#define SMARTSENS2_REG_BOOT_STATUS 0x25
110#define SMARTSENS2_REG_HOST_INTERRUPT_TIMESTAMP 0x26
111#define SMARTSENS2_REG_CHIP_ID 0x2B
112#define SMARTSENS2_REG_INTERRUPT_STATUS 0x2D
113#define SMARTSENS2_REG_ERROR_VALUE 0x2E
114#define SMARTSENS2_REG_ERROR_AUX 0x2F
115#define SMARTSENS2_REG_DEBUG_VALUE 0x30
116#define SMARTSENS2_REG_DEBUG_STATE 0x31
122#define SMARTSENS2_CMD_DOWNLOAD_POST_MORTEM_DATA 0x0001
123#define SMARTSENS2_CMD_UPLOAD_TO_RAM 0x0002
124#define SMARTSENS2_CMD_BOOT_RAM 0x0003
125#define SMARTSENS2_CMD_ERASE_FLASH 0x0004
126#define SMARTSENS2_CMD_WRITE_FLASH 0x0005
127#define SMARTSENS2_CMD_BOOT_FLASH 0x0006
128#define SMARTSENS2_CMD_SET_SENSOR_DATA_INJECTION 0x0007
129#define SMARTSENS2_CMD_INJECT_SENSOR_DATA 0x0008
130#define SMARTSENS2_CMD_FIFO_FLUSH 0x0009
131#define SMARTSENS2_CMD_SOFT_PASS_THROUGH 0x000A
132#define SMARTSENS2_CMD_REQUEST_SENSOR_SELF_TEST 0x000B
133#define SMARTSENS2_CMD_REQUEST_SENSOR_FAST_OFFSET_COMPENSATION 0x000C
134#define SMARTSENS2_CMD_CONFIGURE_SENSOR 0x000D
135#define SMARTSENS2_CMD_CHANGE_SENSOR_DYNAMIC_RANGE 0x000E
136#define SMARTSENS2_CMD_SET_CHANGE_SENSITIVITY 0x000F
137#define SMARTSENS2_CMD_DEBUG_TEST 0x0010
138#define SMARTSENS2_CMD_DUT_CONTINUE 0x0011
139#define SMARTSENS2_CMD_DUT_START_TEST 0x0012
140#define SMARTSENS2_CMD_CTRL_FIFO_FORMAT 0x0015
141#define SMARTSENS2_CMD_RAISE_SPEED 0x0017
152#define SMARTSENS2_CMD_SYSTEM_PARAMETERS_READ_MASK 0x1000
153#define SMARTSENS2_CMD_META_EVENT_CTRL_NON_WAKE_UP_FIFO 0x0101
154#define SMARTSENS2_CMD_META_EVENT_CTRL_WAKE_UP_FIFO 0x0102
155#define SMARTSENS2_CMD_META_EVENT_CTRL_FIFO_CTRL 0x0103
156#define SMARTSENS2_CMD_META_EVENT_CTRL_FIRMWARE_VERSION 0x0104
157#define SMARTSENS2_CMD_META_EVENT_CTRL_TIMESTAMPS 0x0105
158#define SMARTSENS2_CMD_META_EVENT_CTRL_FRAMEWORK_STATUS 0x0106
159#define SMARTSENS2_CMD_META_EVENT_CTRL_VIRUAL_SENSOR_PRESENT 0x011F
160#define SMARTSENS2_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_PRESENT 0x0120
161#define SMARTSENS2_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_INFO 0x0121
163#define SMARTSENS2_CMD_CALIBRATION_STATE_ACCELEROMETER 0x0201
164#define SMARTSENS2_CMD_CALIBRATION_STATE_GYROSCOPE 0x0203
165#define SMARTSENS2_CMD_CALIBRATION_STATE_MAGNETOMETER 0x0205
166#define SMARTSENS2_CMD_SIC_MATRIX 0x027D
167#define SMARTSENS2_CMD_BSX_VERSION 0x027E
169#define SMARTSENS2_CMD_VIRTUAL_SENSOR_INFO 0x0300
175#define SMARTSENS2_START_FLASH_ADR 0x00001F84
193#define SMARTSENS2_SENSOR_ID_CUSTOM_START 160
194#define SMARTSENS2_SENSOR_ID_CUSTOM_END 191
195#define SMARTSENS2_SENSOR_ID_MAX 200
196#define SMARTSENS2_SENSOR_ID_TBD SMARTSENS2_SENSOR_ID_MAX - 1
197#define SMARTSENS2_SENSOR_ID_ACC_PASS 1
198#define SMARTSENS2_SENSOR_ID_ACC_RAW 3
199#define SMARTSENS2_SENSOR_ID_ACC 4
200#define SMARTSENS2_SENSOR_ID_ACC_BIAS 5
201#define SMARTSENS2_SENSOR_ID_ACC_WU 6
202#define SMARTSENS2_SENSOR_ID_ACC_RAW_WU 7
203#define SMARTSENS2_SENSOR_ID_GYRO_PASS 10
204#define SMARTSENS2_SENSOR_ID_GYRO_RAW 12
205#define SMARTSENS2_SENSOR_ID_GYRO 13
206#define SMARTSENS2_SENSOR_ID_GYRO_BIAS 14
207#define SMARTSENS2_SENSOR_ID_GYRO_WU 15
208#define SMARTSENS2_SENSOR_ID_GYRO_RAW_WU 16
209#define SMARTSENS2_SENSOR_ID_MAG_PASS 19
210#define SMARTSENS2_SENSOR_ID_MAG_RAW 21
211#define SMARTSENS2_SENSOR_ID_MAG 22
212#define SMARTSENS2_SENSOR_ID_MAG_BIAS 23
213#define SMARTSENS2_SENSOR_ID_MAG_WU 24
214#define SMARTSENS2_SENSOR_ID_MAG_RAW_WU 25
215#define SMARTSENS2_SENSOR_ID_GRA 28
216#define SMARTSENS2_SENSOR_ID_GRA_WU 29
217#define SMARTSENS2_SENSOR_ID_LACC 31
218#define SMARTSENS2_SENSOR_ID_LACC_WU 32
219#define SMARTSENS2_SENSOR_ID_RV 34
220#define SMARTSENS2_SENSOR_ID_RV_WU 35
221#define SMARTSENS2_SENSOR_ID_GAMERV 37
222#define SMARTSENS2_SENSOR_ID_GAMERV_WU 38
223#define SMARTSENS2_SENSOR_ID_GEORV 40
224#define SMARTSENS2_SENSOR_ID_GEORV_WU 41
225#define SMARTSENS2_SENSOR_ID_ORI 43
226#define SMARTSENS2_SENSOR_ID_ORI_WU 44
227#define SMARTSENS2_SENSOR_ID_TILT_DETECTOR 48
228#define SMARTSENS2_SENSOR_ID_STD 50
229#define SMARTSENS2_SENSOR_ID_STC 52
230#define SMARTSENS2_SENSOR_ID_STC_WU 53
231#define SMARTSENS2_SENSOR_ID_SIG 55
232#define SMARTSENS2_SENSOR_ID_WAKE_GESTURE 57
233#define SMARTSENS2_SENSOR_ID_GLANCE_GESTURE 59
234#define SMARTSENS2_SENSOR_ID_PICKUP_GESTURE 61
235#define SMARTSENS2_SENSOR_ID_AR 63
236#define SMARTSENS2_SENSOR_ID_WRIST_TILT_GESTURE 67
237#define SMARTSENS2_SENSOR_ID_DEVICE_ORI 69
238#define SMARTSENS2_SENSOR_ID_DEVICE_ORI_WU 70
239#define SMARTSENS2_SENSOR_ID_STATIONARY_DET 75
240#define SMARTSENS2_SENSOR_ID_MOTION_DET 77
241#define SMARTSENS2_SENSOR_ID_ACC_BIAS_WU 91
242#define SMARTSENS2_SENSOR_ID_GYRO_BIAS_WU 92
243#define SMARTSENS2_SENSOR_ID_MAG_BIAS_WU 93
244#define SMARTSENS2_SENSOR_ID_STD_WU 94
245#define SMARTSENS2_SENSOR_ID_TEMP 128
246#define SMARTSENS2_SENSOR_ID_BARO 129
247#define SMARTSENS2_SENSOR_ID_HUM 130
248#define SMARTSENS2_SENSOR_ID_GAS 131
249#define SMARTSENS2_SENSOR_ID_TEMP_WU 132
250#define SMARTSENS2_SENSOR_ID_BARO_WU 133
251#define SMARTSENS2_SENSOR_ID_HUM_WU 134
252#define SMARTSENS2_SENSOR_ID_GAS_WU 135
253#define SMARTSENS2_SENSOR_ID_STC_HW 136
254#define SMARTSENS2_SENSOR_ID_STD_HW 137
255#define SMARTSENS2_SENSOR_ID_SIG_HW 138
256#define SMARTSENS2_SENSOR_ID_STC_HW_WU 139
257#define SMARTSENS2_SENSOR_ID_STD_HW_WU 140
258#define SMARTSENS2_SENSOR_ID_SIG_HW_WU 141
259#define SMARTSENS2_SENSOR_ID_ANY_MOTION 142
260#define SMARTSENS2_SENSOR_ID_ANY_MOTION_WU 143
261#define SMARTSENS2_SENSOR_ID_EXCAMERA 144
262#define SMARTSENS2_SENSOR_ID_GPS 145
263#define SMARTSENS2_SENSOR_ID_LIGHT 146
264#define SMARTSENS2_SENSOR_ID_PROX 147
265#define SMARTSENS2_SENSOR_ID_LIGHT_WU 148
266#define SMARTSENS2_SENSOR_ID_PROX_WU 149
267#define SMARTSENS2_IS_SYS_ID( sid ) ( ( sid ) >= 224 )
268#define SMARTSENS2_SYS_ID_PADDING 0
269#define SMARTSENS2_SYS_ID_TS_SMALL_DELTA 251
270#define SMARTSENS2_SYS_ID_TS_LARGE_DELTA 252
271#define SMARTSENS2_SYS_ID_TS_FULL 253
272#define SMARTSENS2_SYS_ID_META_EVENT 254
273#define SMARTSENS2_SYS_ID_TS_SMALL_DELTA_WU 245
274#define SMARTSENS2_SYS_ID_TS_LARGE_DELTA_WU 246
275#define SMARTSENS2_SYS_ID_TS_FULL_WU 247
276#define SMARTSENS2_SYS_ID_META_EVENT_WU 248
277#define SMARTSENS2_SYS_ID_FILLER 255
278#define SMARTSENS2_SYS_ID_DEBUG_MSG 250
279#define SMARTSENS2_SYS_ID_SMARTSENS2_LOG_UPDATE_SUB 243
280#define SMARTSENS2_SYS_ID_SMARTSENS2_LOG_DOSTEP 244
281#define SMARTSENS2_N_VIRTUAL_SENSOR_MAX 256
282#define SMARTSENS2_SPECIAL_SENSOR_ID_OFFSET 245
288#define SMARTSENS2_META_EVENT_FLUSH_COMPLETE 1
289#define SMARTSENS2_META_EVENT_SAMPLE_RATE_CHANGED 2
290#define SMARTSENS2_META_EVENT_POWER_MODE_CHANGED 3
291#define SMARTSENS2_META_EVENT_ALGORITHM_EVENTS 5
292#define SMARTSENS2_META_EVENT_SENSOR_STATUS 6
293#define SMARTSENS2_META_EVENT_BSX_DO_STEPS_MAIN 7
294#define SMARTSENS2_META_EVENT_BSX_DO_STEPS_CALIB 8
295#define SMARTSENS2_META_EVENT_BSX_GET_OUTPUT_SIGNAL 9
296#define SMARTSENS2_META_EVENT_RESERVED1 10
297#define SMARTSENS2_META_EVENT_SENSOR_ERROR 11
298#define SMARTSENS2_META_EVENT_FIFO_OVERFLOW 12
299#define SMARTSENS2_META_EVENT_DYNAMIC_RANGE_CHANGED 13
300#define SMARTSENS2_META_EVENT_FIFO_WATERMARK 14
301#define SMARTSENS2_META_EVENT_RESERVED2 15
302#define SMARTSENS2_META_EVENT_INITIALIZED 16
303#define SMARTSENS2_META_TRANSFER_CAUSE 17
304#define SMARTSENS2_META_EVENT_SENSOR_FRAMEWORK 18
305#define SMARTSENS2_META_EVENT_RESET 19
306#define SMARTSENS2_META_EVENT_SPACER 20
312#define SMARTSENS2_CHIP_ID_VALUE 0x70
313#define SMARTSENS2_FUSER2_PRODUCT_ID_VALUE 0x89
319#define SMARTSENS2_BOOTSTATUS_FLASH_DETECTED 0x01
320#define SMARTSENS2_BOOTSTATUS_FLASH_VERIFY_DONE 0x02
321#define SMARTSENS2_BOOTSTATUS_FLASH_VERIFY_ERROR 0x04
322#define SMARTSENS2_BOOTSTATUS_NO_FLASH 0x08
323#define SMARTSENS2_BOOTSTATUS_HOST_INTERFACE_READY 0x10
324#define SMARTSENS2_BOOTSTATUS_HOST_FW_VERIFY_DONE 0x20
325#define SMARTSENS2_BOOTSTATUS_HOST_FW_VERIFY_ERROR 0x40
326#define SMARTSENS2_BOOTSTATUS_HOST_FW_IDLE 0x80
332#define SMARTSENS2_HOSTSTATUS_POWER_STATE 0x01
333#define SMARTSENS2_HOSTSTATUS_HOST_PROTOCOL 0x02
334#define SMARTSENS2_HOSTSTATUS_HOST_CHANNEL_0 0x10
335#define SMARTSENS2_HOSTSTATUS_HOST_CHANNEL_1 0x20
336#define SMARTSENS2_HOSTSTATUS_HOST_CHANNEL_2 0x40
337#define SMARTSENS2_HOSTSTATUS_HOST_CHANNEL_3 0x80
343#define SMARTSENS2_IST_MASK_ASSERTED 0x1
344#define SMARTSENS2_IST_MASK_FIFO_W 0x6
345#define SMARTSENS2_IST_MASK_FIFO_NW 0x18
346#define SMARTSENS2_IST_MASK_STATUS 0x20
347#define SMARTSENS2_IST_MASK_DEBUG 0x40
348#define SMARTSENS2_IST_MASK_RESET_FAULT 0x80
349#define SMARTSENS2_IST_FIFO_W_DRDY 0x2
350#define SMARTSENS2_IST_FIFO_W_LTCY 0x4
351#define SMARTSENS2_IST_FIFO_W_WM 0x6
352#define SMARTSENS2_IST_FIFO_NW_DRDY 0x8
353#define SMARTSENS2_IST_FIFO_NW_LTCY 0x10
354#define SMARTSENS2_IST_FIFO_NW_WM 0x18
355#define SMARTSENS2_IS_INT_FIFO_W( status ) ( status & SMARTSENS2_IST_MASK_FIFO_W )
356#define SMARTSENS2_IS_INT_FIFO_NW( status ) ( status & SMARTSENS2_IST_MASK_FIFO_NW )
357#define SMARTSENS2_IS_INT_STATUS( status ) ( status & SMARTSENS2_IST_MASK_STATUS )
358#define SMARTSENS2_IS_INT_ASYNC_STATUS( status ) ( status & SMARTSENS2_IST_MASK_DEBUG )
359#define SMARTSENS2_IS_INT_RESET( status ) ( status & SMARTSENS2_IST_MASK_RESET_FAULT )
360#define SMARTSENS2_IST_MASK_FIFO ( SMARTSENS2_IST_MASK_FIFO_W | SMARTSENS2_IST_MASK_FIFO_NW )
361#define SMARTSENS2_IS_INT_FIFO( status ) ( status & SMARTSENS2_IST_MASK_FIFO )
367#define SMARTSENS2_ICTL_DISABLE_FIFO_W 0x01
368#define SMARTSENS2_ICTL_DISABLE_FIFO_NW 0x02
369#define SMARTSENS2_ICTL_DISABLE_STATUS_FIFO 0x04
370#define SMARTSENS2_ICTL_DISABLE_DEBUG 0x08
371#define SMARTSENS2_ICTL_DISABLE_FAULT 0x10
372#define SMARTSENS2_ICTL_ACTIVE_LOW 0x20
373#define SMARTSENS2_ICTL_EDGE 0x40
374#define SMARTSENS2_ICTL_OPEN_DRAIN 0x80
380#define SMARTSENS2_HIF_CTRL_ABORT_TRANSFER_CHANNEL_0 0x01
381#define SMARTSENS2_HIF_CTRL_ABORT_TRANSFER_CHANNEL_1 0x02
382#define SMARTSENS2_HIF_CTRL_ABORT_TRANSFER_CHANNEL_2 0x04
383#define SMARTSENS2_HIF_CTRL_ABORT_TRANSFER_CHANNEL_3 0x08
384#define SMARTSENS2_HIF_CTRL_AP_SUSPENDED 0x10
385#define SMARTSENS2_HIF_CTRL_TIMESTAMP_EV_CTRL 0x40
386#define SMARTSENS2_HIF_CTRL_ASYNC_STATUS_CHANNEL 0x80
392#define SMARTSENS2_LE2U16( x ) ( ( uint16_t )( ( x )[ 0 ] | ( x )[ 1 ] << 8 ) )
393#define SMARTSENS2_LE2S16( x ) ( ( int16_t )SMARTSENS2_LE2U16( x ) )
394#define SMARTSENS2_LE2U24( x ) ( ( uint32_t )( ( x )[ 0 ] | \
395 ( uint32_t )( x )[ 1 ] << 8 | \
396 ( uint32_t )( x )[ 2 ] << 16 ) )
397#define SMARTSENS2_LE2U32( x ) ( ( uint32_t )( ( x )[ 0 ] | \
398 ( uint32_t )( x )[ 1 ] << 8 | \
399 ( uint32_t )( x )[ 2 ] << 16 | \
400 ( uint32_t )( x )[ 3 ] << 24 ) )
401#define SMARTSENS2_LE2S32( x ) ( ( int32_t )SMARTSENS2_LE2U32( x ) )
402#define SMARTSENS2_LE2U40( x ) ( SMARTSENS2_LE2U32( x ) | ( uint32_t )( x )[ 4 ] << 32 )
403#define SMARTSENS2_TIMESTAMP_TO_SEC( x ) ( ( uint32_t ) ( x * ( 15625.0 / UINT32_C( 1000000000 ) ) ) )
410#define SMARTSENS2_SLAVE_ADDRESS_1 0x29
411#define SMARTSENS2_SLAVE_ADDRESS_0 0x28
421#define SMARTSENS2_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
422#define SMARTSENS2_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
440#define SMARTSENS2_MAP_MIKROBUS( cfg, mikrobus ) \
441 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
442 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
443 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
444 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
445 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
446 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
447 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
448 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
814 uint8_t *parameter_buf, uint16_t *parameter_len );
#define SMARTSENS2_N_VIRTUAL_SENSOR_MAX
Definition smartsens2.h:281
err_t smartsens2_update_firmware(smartsens2_t *ctx)
Upload firmware image to the device.
uint8_t smartsens2_get_interrupt(smartsens2_t *ctx)
Get interrupt.
err_t smartsens2_sw_reset(smartsens2_t *ctx)
SW Reset device.
void smartsens2_drv_interface_selection(smartsens2_cfg_t *cfg, smartsens2_drv_t drv_sel)
Smart Sens 2 driver interface setup function.
err_t smartsens2_default_cfg(smartsens2_t *ctx)
Smart Sens 2 default configuration function.
err_t smartsens2_generic_read(smartsens2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Smart Sens 2 data reading function.
err_t smartsens2_cmd_write(smartsens2_t *ctx, uint16_t cmd, uint8_t *cmd_buf, uint16_t cmd_len)
Send command.
err_t smartsens2_byte_read(smartsens2_t *ctx, uint8_t reg, uint8_t *data_out)
Byte reading function.
err_t smartsens2_byte_write(smartsens2_t *ctx, uint8_t reg, uint8_t data_in)
Byte writing function.
err_t smartsens2_generic_write(smartsens2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Smart Sens 2 data writing function.
err_t smartsens2_update_virtual_sensor_list(smartsens2_t *ctx)
Update the callback table's information.
err_t smartsens2_get_parameter(smartsens2_t *ctx, uint16_t parameter, uint8_t *parameter_buf, uint16_t *parameter_len)
Get command parameters response.
err_t smartsens2_status_read(smartsens2_t *ctx, uint16_t *cmd, uint8_t *cmd_buf, uint16_t *cmd_len)
Read Status and Debug FIFO.
err_t smartsens2_boot_firmware(smartsens2_t *ctx)
Boot firmware image.
void smartsens2_cfg_setup(smartsens2_cfg_t *cfg)
Smart Sens 2 configuration object setup function.
err_t smartsens2_get_and_process_fifo(smartsens2_t *ctx, uint8_t *work_buffer, uint32_t buffer_size)
Get and process the FIFO.
void smartsens2_reset(smartsens2_t *ctx)
Reset device.
err_t smartsens2_power_on_device(smartsens2_t *ctx)
Power on device boot/upload firmware to device.
err_t smartsens2_register_fifo_parse_callback(smartsens2_t *ctx, uint8_t sensor_id, smartsens2_fifo_parse_callback_t callback, void *callback_ref)
Link a callback to virtual sensor.
err_t smartsens2_set_virt_sensor_cfg(smartsens2_t *ctx, uint8_t sensor_id, float sample_rate, uint32_t latency)
Set configuration fro virtual sensor.
err_t smartsens2_init(smartsens2_t *ctx, smartsens2_cfg_t *cfg)
Smart Sens 2 initialization function.
err_t smartsens2_get_virt_sensor_list(smartsens2_t *ctx, uint8_t *sensor_list)
Get the virtual sensor list.
uint8_t work_buffer[WORK_BUFFER_SIZE]
Definition main.c:74
err_t(* smartsens2_master_io_t)(struct smartsens2_s *, uint8_t, uint8_t *, uint8_t)
Smart Sens 2 Click driver interface.
Definition smartsens2.h:494
smartsens2_drv_t
Smart Sens 2 Click driver selector.
Definition smartsens2.h:458
@ SMARTSENS2_DRV_SEL_SPI
Definition smartsens2.h:459
@ SMARTSENS2_DRV_SEL_I2C
Definition smartsens2.h:460
void(* smartsens2_fifo_parse_callback_t)(struct smartsens2_fifo_parse_data_info *callback_info, void *private_data)
Definition smartsens2.h:496
smartsens2_fifo_type
Fifo type enum.
Definition smartsens2.h:469
@ SMARTSENS2_FIFO_TYPE_NON_WAKEUP
Definition smartsens2.h:471
@ SMARTSENS2_FIFO_TYPE_MAX
Definition smartsens2.h:473
@ SMARTSENS2_FIFO_TYPE_STATUS
Definition smartsens2.h:472
@ SMARTSENS2_FIFO_TYPE_WAKEUP
Definition smartsens2.h:470
smartsens2_return_value_t
Smart Sens 2 Click return value data.
Definition smartsens2.h:628
@ SMARTSENS2_ERROR
Definition smartsens2.h:630
@ SMARTSENS2_OK
Definition smartsens2.h:629
@ SMARTSENS_ERROR_TIMEOUT
Definition smartsens2.h:631
struct smartsens2_s smartsens2_t
Smart Sens 2 Click context object.
This file contains SPI specific macros, functions, etc.
Smart Sens 2 Click configuration object.
Definition smartsens2.h:602
uint32_t i2c_speed
Definition smartsens2.h:612
smartsens2_drv_t drv_sel
Definition smartsens2.h:619
spi_master_chip_select_polarity_t cs_polarity
Definition smartsens2.h:617
pin_name_t sck
Definition smartsens2.h:607
spi_master_mode_t spi_mode
Definition smartsens2.h:616
pin_name_t mosi
Definition smartsens2.h:606
uint32_t spi_speed
Definition smartsens2.h:615
pin_name_t scl
Definition smartsens2.h:603
pin_name_t int_pin
Definition smartsens2.h:610
pin_name_t miso
Definition smartsens2.h:605
pin_name_t sda
Definition smartsens2.h:604
pin_name_t rst
Definition smartsens2.h:609
pin_name_t cs
Definition smartsens2.h:608
uint8_t i2c_address
Definition smartsens2.h:613
Fifo buffer.
Definition smartsens2.h:564
uint32_t remain_length
Definition smartsens2.h:567
uint8_t * buffer
Definition smartsens2.h:569
uint32_t read_pos
Definition smartsens2.h:565
uint32_t read_length
Definition smartsens2.h:566
uint32_t buffer_size
Definition smartsens2.h:568
Callback prase.
Definition smartsens2.h:553
smartsens2_fifo_parse_callback_t callback
Definition smartsens2.h:555
void * callback_ref
Definition smartsens2.h:556
uint8_t event_size
Definition smartsens2.h:554
Parsing data info.
Definition smartsens2.h:481
uint32_t * time_stamp
Definition smartsens2.h:486
uint8_t sensor_id
Definition smartsens2.h:482
uint8_t data_size
Definition smartsens2.h:484
enum smartsens2_fifo_type fifo_type
Definition smartsens2.h:483
uint8_t * data_ptr
Definition smartsens2.h:485
Smart Sens 2 Click context object.
Definition smartsens2.h:577
spi_master_t spi
Definition smartsens2.h:583
smartsens2_master_io_t read_f
Definition smartsens2.h:590
uint32_t last_time_stamp[SMARTSENS2_FIFO_TYPE_MAX]
Definition smartsens2.h:593
smartsens2_drv_t drv_sel
Definition smartsens2.h:587
digital_in_t int_pin
Definition smartsens2.h:580
i2c_master_t i2c
Definition smartsens2.h:582
smartsens2_master_io_t write_f
Definition smartsens2.h:589
digital_out_t rst
Definition smartsens2.h:578
uint8_t slave_address
Definition smartsens2.h:585
struct smartsens2_fifo_parse_callback_table table[SMARTSENS2_N_VIRTUAL_SENSOR_MAX]
Definition smartsens2.h:592
pin_name_t chip_select
Definition smartsens2.h:586
Sensor info.
Definition smartsens2.h:534
union smartsens2_u16_conv resolution
Definition smartsens2.h:540
uint8_t sensor_type
Definition smartsens2.h:535
uint8_t driver_id
Definition smartsens2.h:536
union smartsens2_u32_conv fifo_reserved
Definition smartsens2.h:542
union smartsens2_float_conv min_rate
Definition smartsens2.h:545
union smartsens2_float_conv max_rate
Definition smartsens2.h:541
union smartsens2_u16_conv max_range
Definition smartsens2.h:539
union smartsens2_u32_conv fifo_max
Definition smartsens2.h:543
uint8_t driver_version
Definition smartsens2.h:537
uint8_t power
Definition smartsens2.h:538
uint8_t event_size
Definition smartsens2.h:544
Float converter union.
Definition smartsens2.h:523
uint32_t u32_val
Definition smartsens2.h:525
float f_val
Definition smartsens2.h:524
uint8_t bytes[4]
Definition smartsens2.h:526
U16 converter union.
Definition smartsens2.h:503
uint8_t bytes[2]
Definition smartsens2.h:505
uint16_t u16_val
Definition smartsens2.h:504
U32 converter union.
Definition smartsens2.h:513
uint32_t u32_val
Definition smartsens2.h:514
uint8_t bytes[4]
Definition smartsens2.h:515