smartdof  2.0.0.0
smartdof.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright© 2020 MikroElektronika d.o.o.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so,
11  * subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22  * OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef SMARTDOF_H
36 #define SMARTDOF_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
41 
42 // -------------------------------------------------------------- PUBLIC MACROS
52 #define SMARTDOF_MAP_MIKROBUS( cfg, mikrobus ) \
53  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
55  cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
56  cfg.bt = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
57  cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
58 
64 #define SMARTDOF_RETVAL uint8_t
65 
66 #define SMARTDOF_OK 0x00
67 #define SMARTDOF_INIT_ERROR 0xFF
68 
74 #define SLAVE_ADDRESS 0x4A
75 
81 #define SMARTDOF_BMODE_FW_UPDATE 0x00
82 #define SMARTDOF_BMODE_NORMAL 0x01
83 
89 #define SMARTDOF_QPOINT_RAW_ACCEL 0
90 #define SMARTDOF_QPOINT_ACCEL 8
91 #define SMARTDOF_QPOINT_LINEAR_ACCEL 8
92 #define SMARTDOF_QPOINT_GRAVITY 8
93 #define SMARTDOF_QPOINT_RAW_GYRO 0
94 #define SMARTDOF_QPOINT_GYRO_CALIB 9
95 #define SMARTDOF_QPOINT_GYRO_UNCALIB 9
96 #define SMARTDOF_QPOINT_RAW_MAGNETO 0
97 #define SMARTDOF_QPOINT_MAGNET_CALIB 4
98 #define SMARTDOF_QPOINT_MAGNET_UNCALIB 4
99 #define SMARTDOF_QPOINT_ROT_VECT 14
100 #define SMARTDOF_QPOINT_GAME_ROT_VECT 14
101 #define SMARTDOF_QPOINT_GEOMAG_ROT_VECT 14
102 #define SMARTDOF_QPOINT_TAP_DETECT 0
103 #define SMARTDOF_QPOINT_STEP_DETECT 0
104 #define SMARTDOF_QPOINT_STEP_COUNT 0
105 #define SMARTDOF_QPOINT_SIG_MOTION 0
106 #define SMARTDOF_QPOINT_STABIL_CLASS 0
107 #define SMARTDOF_QPOINT_SHAKE_DETECT 0
108 #define SMARTDOF_QPOINT_STABIL_DETECT 0
109 #define SMARTDOF_QPOINT_PERS_ACT_CLASS 0
110 #define SMARTDOF_QPOINT_ARVR_STABIL_ROT_VECT 14
111 #define SMARTDOF_QPOINT_ARVR_STABIL_GAME_ROT_VECT 14
112 #define SMARTDOF_QPOINT_GYRO_INT_ROT_VECT 14
113 
119 #define SMARTDOF_CHAN_CMD 0
120 #define SMARTDOF_CHAN_EXE 1
121 #define SMARTDOF_CHAN_CTRL 2
122 #define SMARTDOF_CHAN_INPUT_REP 3
123 #define SMARTDOF_CHAN_WAKE_REP 4
124 #define SMARTDOF_CHAN_GYRO_ROT_VECT 5
125 
131 #define SMARTDOF_CMD_ERR 0x01
132 #define SMARTDOF_CMD_COUNT 0x02
133 #define SMARTDOF_CMD_TARE 0x03
134 #define SMARTDOF_CMD_INIT 0x04
135 #define SMARTDOF_CMD_UNS_INIT 0x84
136 #define SMARTDOF_CMD_SAVE_DCD 0x06
137 #define SMARTDOF_CMD_ME_CALIB 0x07
138 #define SMARTDOF_CMD_DCD_PERIOD_SAVE 0x09
139 #define SMARTDOF_CMD_OSCIL 0x0A
140 #define SMARTDOF_CMD_CLEAR_DCD 0x0B
141 
147 #define SMARTDOF_CMD_CTR_SCMD_GET_CNT 0x00
148 #define SMARTDOF_CMD_CTR_SCMD_CLEAR_CNT 0x01
149 #define SMARTDOF_CMD_TARE_SCMD_TARE_NOW 0x00
150 #define SMARTDOF_CMD_TARE_SCMD_PERS_TARE 0x01
151 #define SMARTDOF_CMD_TARE_SCMD_SET_REORIENT 0x02
152 #define SMARTDOF_CMD_INIT_SCMD_NO_OP 0x00
153 #define SMARTDOF_CMD_INIT_SCMD_ENT_SENS_HUB 0x01
154 
160 #define SMARTDOF_REP_ID_GET_FEAT_REQ 0xFE
161 #define SMARTDOF_REP_ID_SET_FEAT_CMD 0xFD
162 #define SMARTDOF_REP_ID_GET_FEAT_RESP 0xFC
163 #define SMARTDOF_REP_ID_PROD_ID_REQ 0xF9
164 #define SMARTDOF_REP_ID_PROD_ID_RESP 0xF8
165 #define SMARTDOF_REP_ID_FRS_WR_REQ 0xF7
166 #define SMARTDOF_REP_ID_FRS_WR_DATA 0xF6
167 #define SMARTDOF_REP_ID_FRS_WR_RESP 0xF5
168 #define SMARTDOF_REP_ID_FRS_RD_REQ 0xF4
169 #define SMARTDOF_REP_ID_FRS_RD_RESP 0xF3
170 #define SMARTDOF_REP_ID_CMD_REQ 0xF2
171 #define SMARTDOF_REP_ID_CMD_RESP 0xF1
172 #define SMARTDOF_FEAT_REP_ID_BASE_TIMESTAMP 0xFB
173 #define SMARTDOF_FEAT_REP_ID_TIMESTAMP_REBASE 0xFA
174 #define SMARTDOF_FEAT_REP_ID_ACCEL 0x01
175 #define SMARTDOF_FEAT_REP_ID_GYRO 0x02
176 #define SMARTDOF_FEAT_REP_ID_MAGNET 0x03
177 #define SMARTDOF_FEAT_REP_ID_LINEAR_ACCEL 0x04
178 #define SMARTDOF_FEAT_REP_ID_ROT_VECTOR 0x05
179 #define SMARTDOF_FEAT_REP_ID_GRAVITY 0x06
180 #define SMARTDOF_FEAT_REP_ID_UNCALIB_GYRO 0x07
181 #define SMARTDOF_FEAT_REP_ID_GAME_ROT_VECTOR 0x08
182 #define SMARTDOF_FEAT_REP_ID_GEOMAG_ROT_VECTOR 0x09
183 #define SMARTDOF_FEAT_REP_ID_PRESSURE 0x0A
184 #define SMARTDOF_FEAT_REP_ID_AMBI_LIGHT 0x0B
185 #define SMARTDOF_FEAT_REP_ID_HIMIDITY 0x0C
186 #define SMARTDOF_FEAT_REP_ID_PROXY 0x0D
187 #define SMARTDOF_FEAT_REP_ID_TEMPERATURE 0x0E
188 #define SMARTDOF_FEAT_REP_ID_UNCALIB_MAG_FIELD 0x0F
189 #define SMARTDOF_FEAT_REP_ID_TAP_DETECT 0x10
190 #define SMARTDOF_FEAT_REP_ID_STEP_COUNT 0x11
191 #define SMARTDOF_FEAT_REP_ID_SIG_MOTION 0x12
192 #define SMARTDOF_FEAT_REP_ID_STABIL_CLASS 0x13
193 #define SMARTDOF_FEAT_REP_ID_RAW_ACCEL 0x14
194 #define SMARTDOF_FEAT_REP_ID_RAW_GYRO 0x15
195 #define SMARTDOF_FEAT_REP_ID_RAW_MAGNETO 0x16
196 #define SMARTDOF_FEAT_REP_ID_SAR 0x17
197 #define SMARTDOF_FEAT_REP_ID_STEP_DETECT 0x18
198 #define SMARTDOF_FEAT_REP_ID_SHAKE_DETECT 0x19
199 #define SMARTDOF_FEAT_REP_ID_FLIP_DETECT 0x1A
200 #define SMARTDOF_FEAT_REP_ID_PICKUP_DETECT 0x1B
201 #define SMARTDOF_FEAT_REP_ID_STABIL_DETECT 0x1C
202 #define SMARTDOF_FEAT_REP_ID_PERS_ACT_CLASS 0x1E
203 #define SMARTDOF_FEAT_REP_ID_SLEEP_DETECT 0x1F
204 #define SMARTDOF_FEAT_REP_ID_TILT_DETECT 0x20
205 #define SMARTDOF_FEAT_REP_ID_POCKET_DETECT 0x21
206 #define SMARTDOF_FEAT_REP_ID_CIRCLE_DETECT 0x22
207 #define SMARTDOF_FEAT_REP_ID_HART_RATE_MONITOR 0x23
208 #define SMARTDOF_FEAT_REP_ID_ARVR_STABIL_ROT_VECT 0x28
209 #define SMARTDOF_FEAT_REP_ID_ARVR_GAME_STABIL_ROT_VECT 0x29
210 
216 #define SMARTDOF_FRS_REP_ID_STATIC_CALIB_AGM 0x7979
217 #define SMARTDOF_FRS_REP_ID_NOMINAL_CALIB_AGM 0x4D4D
218 #define SMARTDOF_FRS_REP_ID_STATIC_CALIB_SRA 0x8A8A
219 #define SMARTDOF_FRS_REP_ID_NOMINAL_CALIB_SRA 0x4E4E
220 #define SMARTDOF_FRS_REP_ID_DYNAMIC_CALIB 0x1F1F
221 #define SMARTDOF_FRS_REP_ID_MOTION_ENG_POW_MGMT 0xD3E2
222 #define SMARTDOF_FRS_REP_ID_SYS_ORIENT 0x2D3E
223 #define SMARTDOF_FRS_REP_ID_PRIM_ACCEL_ORIENT 0x2D41
224 #define SMARTDOF_FRS_REP_ID_SCREEN_ROT_ACCEL_ORIENT 0x2D43
225 #define SMARTDOF_FRS_REP_ID_GYRO_ORIENT 0x2D46
226 #define SMARTDOF_FRS_REP_ID_MAGNETO_ORIENT 0x2D4C
227 #define SMARTDOF_FRS_REP_ID_ARVR_STABIL_ROT_VEC 0x3E2D
228 #define SMARTDOF_FRS_REP_ID_ARVR_STABIL_GAME_ROT_VEC 0x3E2E
229 #define SMARTDOF_FRS_REP_ID_SIG_MOTION_DETECT_CFG 0xC274
230 #define SMARTDOF_FRS_REP_ID_SHAKE_DETECT_CFG 0x7D7D
231 #define SMARTDOF_FRS_REP_ID_MAX_FUSION_PERIOD 0xD7D7
232 #define SMARTDOF_FRS_REP_ID_SERIAL_NUM 0x4B4B
233 #define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_PRESS 0x39AF
234 #define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_TEMP 0x4D20
235 #define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_HUMI 0x1AC9
236 #define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_AMBI 0x39B1
237 #define SMARTDOF_FRS_REP_ID_ENVIRO_SENS_PROXI 0x4DA2
238 #define SMARTDOF_FRS_REP_ID_ALS_CALIB 0xD401
239 #define SMARTDOF_FRS_REP_ID_PROXI_SENS_CALIB 0xD402
240 #define SMARTDOF_FRS_REP_ID_PICKUP_DETECT_CFG 0x1B2A
241 #define SMARTDOF_FRS_REP_ID_FLIP_DETECT_CFG 0xFC94
242 #define SMARTDOF_FRS_REP_ID_STAB_DETECT_CFG 0xED85
243 #define SMARTDOF_FRS_REP_ID_ACT_TRACK_CFG 0xED88
244 #define SMARTDOF_FRS_REP_ID_SLEEP_DETECT_CFG 0xED87
245 #define SMARTDOF_FRS_REP_ID_TILT_DETECT_CFG 0xED89
246 #define SMARTDOF_FRS_REP_ID_POCK_DETECT_CFG 0xEF27
247 #define SMARTDOF_FRS_REP_ID_CIRC_DETECT_CFG 0xEE51
248 #define SMARTDOF_FRS_REP_ID_USER_REC 0x74B4
249 #define SMARTDOF_FRS_REP_ID_MOTION_ENG_TIME_SRC_SEL 0xD403
250 #define SMARTDOF_FRS_REP_ID_UART_OUT_FORMAT_SEL 0xA1A1
251 #define SMARTDOF_FRS_REP_ID_GYROINT_ROT_VEC_CFG 0xA1A2
252 #define SMARTDOF_FRS_REP_ID_FUSION_CTRL_FLAGS 0xA1A3
253 
259 #define SMARTDOF_FRS_REP_ID_RAW_ACCEL 0xE301
260 #define SMARTDOF_FRS_REP_ID_ACCEL 0xE302
261 #define SMARTDOF_FRS_REP_ID_LINEAR_ACCEL 0xE303
262 #define SMARTDOF_FRS_REP_ID_GRAVITY 0xE304
263 #define SMARTDOF_FRS_REP_ID_RAW_GYRO 0xE305
264 #define SMARTDOF_FRS_REP_ID_GYRO_CALIB 0xE306
265 #define SMARTDOF_FRS_REP_ID_GYRO_UNCALIB 0xE307
266 #define SMARTDOF_FRS_REP_ID_RAW_MAGNETO 0xE308
267 #define SMARTDOF_FRS_REP_ID_MAGNETO_CALIB 0xE309
268 #define SMARTDOF_FRS_REP_ID_MAGNETO_UNCALIB 0xE30A
269 #define SMARTDOF_FRS_REP_ID_ROT_VECTOR 0xE30B
270 #define SMARTDOF_FRS_REP_ID_GAME_ROT_VECTOR 0xE30C
271 #define SMARTDOF_FRS_REP_ID_GEO_ROT_VECTOR 0xE30D
272 #define SMARTDOF_FRS_REP_ID_PRESSURE 0xE30E
273 #define SMARTDOF_FRS_REP_ID_AMBIENT_LIGHT 0xE30F
274 #define SMARTDOF_FRS_REP_ID_HUMIDITY 0xE310
275 #define SMARTDOF_FRS_REP_ID_PROXY 0xE311
276 #define SMARTDOF_FRS_REP_ID_TEMPERATURE 0xE312
277 #define SMARTDOF_FRS_REP_ID_TAP_DETECT 0xE313
278 #define SMARTDOF_FRS_REP_ID_STEP_DETECT 0xE314
279 #define SMARTDOF_FRS_REP_ID_STEP_COUNT 0xE315
280 #define SMARTDOF_FRS_REP_ID_SIG_MOTION 0xE316
281 #define SMARTDOF_FRS_REP_ID_STABIL_CLASS 0xE317
282 #define SMARTDOF_FRS_REP_ID_SHAKE_DETECT 0xE318
283 #define SMARTDOF_FRS_REP_ID_FLIP_DETECT 0xE319
284 #define SMARTDOF_FRS_REP_ID_PICK_DETECT 0xE31A
285 #define SMARTDOF_FRS_REP_ID_STABIL_DETECT 0xE31B
286 #define SMARTDOF_FRS_REP_ID_PERS_ACT_CLASS 0xE31C
287 #define SMARTDOF_FRS_REP_ID_SLEEP_DETECT 0xE31D
288 #define SMARTDOF_FRS_REP_ID_TILT_DETECT 0xE31E
289 #define SMARTDOF_FRS_REP_ID_POCKET_DETECT 0xE31F
290 #define SMARTDOF_FRS_REP_ID_CIRCLE_DETECT 0xE320
291 #define SMARTDOF_FRS_REP_ID_HEART_RATE_MON 0xE321
292 #define SMARTDOF_FRS_REP_ID_ARVR_STABIL_ROT_VECTOR 0xE322
293 #define SMARTDOF_FRS_REP_ID_ARVR_STABIL_GAME_ROT_VECTOR 0xE323
294 #define SMARTDOF_FRS_REP_ID_GYRO_INTEG_ROT_VEC 0xE324
295  // End group macro
298 // --------------------------------------------------------------- PUBLIC TYPES
307 typedef struct
308 {
309  // Output pins
310 
311  digital_out_t rst;
312  digital_out_t bt;
313 
314  // Input pins
315 
316  digital_in_t int_pin;
317 
318  // Modules
319 
320  i2c_master_t i2c;
321 
322  // ctx variable
323 
324  uint8_t slave_address;
325 
326  uint8_t shtp_header[ 4 ];
327  uint8_t send_data_buf[ 21 ];
328  uint8_t rec_data_buf[ 1024 ];
329  uint16_t data_len;
330 
331 } smartdof_t;
332 
336 typedef struct
337 {
338  // Communication gpio pins
339 
340  pin_name_t scl;
341  pin_name_t sda;
342 
343  // Additional gpio pins
344 
345  pin_name_t rst;
346  pin_name_t bt;
347  pin_name_t int_pin;
348 
349  // Static variable
350 
351  uint32_t i2c_speed;
352  uint8_t i2c_address;
353 
355 
359 typedef struct
360 {
361  // Variables
362  uint8_t *reset_cause;
363  uint16_t *sw_version;
364  uint32_t *sw_part_number;
365  uint32_t *sw_build_number;
366  uint16_t *sw_version_patch;
367 
369 
373 typedef struct
374 {
375  // Variables
376  uint8_t *data_length;
377  uint8_t *read_status;
378  uint16_t *data_offset;
379  uint32_t *data_buffer;
380  uint16_t *frs_type;
381 
382 } smartdof_rr_t;
383 
387 typedef struct
388 {
389  // Variables
391  uint8_t feature_flags;
393  uint32_t report_interval;
394  uint32_t batch_interval;
396 
398  // End types group
400 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
401 
407 #ifdef __cplusplus
408 extern "C"{
409 #endif
410 
420 
430 
439 
449 void smartdof_i2c_write ( smartdof_t *ctx, uint8_t *write_data, uint16_t n_bytes );
450 
460 void smartdof_i2c_read ( smartdof_t *ctx, uint8_t *read_data, uint16_t n_bytes );
461 
471 uint8_t smartdof_int_get ( smartdof_t *ctx );
472 
484 void smartdof_rst_set ( smartdof_t *ctx, uint8_t pin_state );
485 
497 void smartdof_bt_set ( smartdof_t *ctx, uint8_t pin_state );
498 
507 void smartdof_device_reset ( smartdof_t *ctx, uint8_t boot_mode );
508 
523 float smartdof_q_point_to_float ( int16_t sensor_data, uint8_t sensor_q_point );
524 
539 void smartdof_send_packet ( smartdof_t *ctx, uint8_t channel_number, uint16_t data_length, uint8_t *packet_data );
540 
562 uint8_t smartdof_receive_packet ( smartdof_t *ctx, uint32_t n_cycles_timeout );
563 
577 void smartdof_get_data ( smartdof_t *ctx, uint8_t *data_header, uint16_t *data_length, uint8_t *data_buffer );
578 
587 
588 
616 
627 void smartdof_frs_write_request ( smartdof_t *ctx, uint16_t data_length, uint16_t frs_type );
628 
639 void smartdof_frs_write_data_request ( smartdof_t *ctx, uint16_t data_offset, uint32_t *data_buffer );
640 
661 uint8_t smartdof_frs_write_response ( smartdof_t *ctx, uint8_t *frs_status, uint16_t *data_offset );
662 
674 void smartdof_frs_read_request ( smartdof_t *ctx, uint16_t data_offset, uint16_t frs_type, uint16_t data_size );
675 
707 
718 void smartdof_command_request ( smartdof_t *ctx, uint8_t command_type, uint8_t *command_parameters );
719 
739 uint8_t smartdof_command_response ( smartdof_t *ctx, uint8_t *response_parameters );
740 
749 void smartdof_get_feature_request ( smartdof_t *ctx, uint8_t feature_report_id );
750 
772 
804 
814 void smartdof_force_sensor_flush ( smartdof_t *ctx, uint8_t sensor_id );
815 
834 uint8_t smartdof_flush_completed ( smartdof_t *ctx, uint8_t * sensor_id );
835 
836 #ifdef __cplusplus
837 }
838 #endif
839 #endif // _SMARTDOF_H_
840  // End public_function group
843 
844 // ------------------------------------------------------------------------- END
smartdof_rr_t::read_status
uint8_t * read_status
Definition: smartdof.h:377
smartdof_rr_t::frs_type
uint16_t * frs_type
Definition: smartdof.h:380
smartdof_frs_write_response
uint8_t smartdof_frs_write_response(smartdof_t *ctx, uint8_t *frs_status, uint16_t *data_offset)
Receiving FRS write response.
smartdof_receive_packet
uint8_t smartdof_receive_packet(smartdof_t *ctx, uint32_t n_cycles_timeout)
Receiving data packet.
smartdof_t::int_pin
digital_in_t int_pin
Definition: smartdof.h:316
smartdof_pir_t::sw_version_patch
uint16_t * sw_version_patch
Definition: smartdof.h:366
smartdof_t::i2c
i2c_master_t i2c
Definition: smartdof.h:320
smartdof_cfg_t
Click configuration structure definition.
Definition: smartdof.h:337
smartdof_t
Click ctx object definition.
Definition: smartdof.h:308
smartdof_cfg_t::bt
pin_name_t bt
Definition: smartdof.h:346
smartdof_sfc_t
Click set feature command definition.
Definition: smartdof.h:388
smartdof_sfc_t::change_sensitivity
uint16_t change_sensitivity
Definition: smartdof.h:392
smartdof_rr_t::data_offset
uint16_t * data_offset
Definition: smartdof.h:378
smartdof_send_packet
void smartdof_send_packet(smartdof_t *ctx, uint8_t channel_number, uint16_t data_length, uint8_t *packet_data)
Sending data packet.
smartdof_cfg_t::i2c_address
uint8_t i2c_address
Definition: smartdof.h:352
smartdof_rr_t::data_length
uint8_t * data_length
Definition: smartdof.h:376
smartdof_sfc_t::report_interval
uint32_t report_interval
Definition: smartdof.h:393
smartdof_sfc_t::batch_interval
uint32_t batch_interval
Definition: smartdof.h:394
smartdof_pir_t::sw_part_number
uint32_t * sw_part_number
Definition: smartdof.h:364
smartdof_flush_completed
uint8_t smartdof_flush_completed(smartdof_t *ctx, uint8_t *sensor_id)
Receiving flush completed response.
smartdof_cfg_t::int_pin
pin_name_t int_pin
Definition: smartdof.h:347
smartdof_t::slave_address
uint8_t slave_address
Definition: smartdof.h:324
smartdof_rst_set
void smartdof_rst_set(smartdof_t *ctx, uint8_t pin_state)
Setting RST pin state.
smartdof_rr_t
Click FRS read response definition.
Definition: smartdof.h:374
smartdof_get_feature_response
uint8_t smartdof_get_feature_response(smartdof_t *ctx, smartdof_sfc_t *sfc)
Receiving get feature response.
smartdof_int_get
uint8_t smartdof_int_get(smartdof_t *ctx)
Getting state of INT pin.
smartdof_pir_t::reset_cause
uint8_t * reset_cause
Definition: smartdof.h:362
smartdof_frs_read_response
uint8_t smartdof_frs_read_response(smartdof_t *ctx, smartdof_rr_t *rr)
Receiving FRS read response.
smartdof_q_point_to_float
float smartdof_q_point_to_float(int16_t sensor_data, uint8_t sensor_q_point)
Q point (fixed point) value to float conversion.
smartdof_t::rst
digital_out_t rst
Definition: smartdof.h:311
smartdof_get_feature_request
void smartdof_get_feature_request(smartdof_t *ctx, uint8_t feature_report_id)
Requesting get feature request.
smartdof_frs_read_request
void smartdof_frs_read_request(smartdof_t *ctx, uint16_t data_offset, uint16_t frs_type, uint16_t data_size)
Requesting FRS read.
smartdof_command_response
uint8_t smartdof_command_response(smartdof_t *ctx, uint8_t *response_parameters)
Receiving command response.
smartdof_init
SMARTDOF_RETVAL smartdof_init(smartdof_t *ctx, smartdof_cfg_t *cfg)
Initialization function.
smartdof_i2c_read
void smartdof_i2c_read(smartdof_t *ctx, uint8_t *read_data, uint16_t n_bytes)
Receiving data bytes via I2C.
smartdof_force_sensor_flush
void smartdof_force_sensor_flush(smartdof_t *ctx, uint8_t sensor_id)
Requesting force sensor flush.
SMARTDOF_RETVAL
#define SMARTDOF_RETVAL
Definition: smartdof.h:64
smartdof_pir_t
Click product id response definition.
Definition: smartdof.h:360
smartdof_cfg_t::sda
pin_name_t sda
Definition: smartdof.h:341
smartdof_sfc_t::feature_flags
uint8_t feature_flags
Definition: smartdof.h:391
smartdof_frs_write_data_request
void smartdof_frs_write_data_request(smartdof_t *ctx, uint16_t data_offset, uint32_t *data_buffer)
Requesting FRS write data.
smartdof_pir_t::sw_version
uint16_t * sw_version
Definition: smartdof.h:363
smartdof_sfc_t::sensor_specific_config
uint32_t sensor_specific_config
Definition: smartdof.h:395
smartdof_command_request
void smartdof_command_request(smartdof_t *ctx, uint8_t command_type, uint8_t *command_parameters)
Requesting command.
smartdof_default_cfg
uint8_t smartdof_default_cfg(smartdof_t *ctx)
Click Default Configuration function.
smartdof_bt_set
void smartdof_bt_set(smartdof_t *ctx, uint8_t pin_state)
Setting BT pin state.
smartdof_frs_write_request
void smartdof_frs_write_request(smartdof_t *ctx, uint16_t data_length, uint16_t frs_type)
Requesting FRS write.
smartdof_i2c_write
void smartdof_i2c_write(smartdof_t *ctx, uint8_t *write_data, uint16_t n_bytes)
Sending data bytes via I2C.
smartdof_pir_t::sw_build_number
uint32_t * sw_build_number
Definition: smartdof.h:365
smartdof_cfg_t::rst
pin_name_t rst
Definition: smartdof.h:345
smartdof_t::bt
digital_out_t bt
Definition: smartdof.h:312
smartdof_get_data
void smartdof_get_data(smartdof_t *ctx, uint8_t *data_header, uint16_t *data_length, uint8_t *data_buffer)
Getting received data.
smartdof_set_feature_command
void smartdof_set_feature_command(smartdof_t *ctx, smartdof_sfc_t *sfc)
Requesting set feature command.
smartdof_t::data_len
uint16_t data_len
Definition: smartdof.h:329
smartdof_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: smartdof.h:351
smartdof_cfg_t::scl
pin_name_t scl
Definition: smartdof.h:340
smartdof_cfg_setup
void smartdof_cfg_setup(smartdof_cfg_t *cfg)
Config Object Initialization function.
smartdof_product_id_request
void smartdof_product_id_request(smartdof_t *ctx)
Requesting product id.
smartdof_sfc_t::feature_report_id
uint8_t feature_report_id
Definition: smartdof.h:390
smartdof_rr_t::data_buffer
uint32_t * data_buffer
Definition: smartdof.h:379
smartdof_device_reset
void smartdof_device_reset(smartdof_t *ctx, uint8_t boot_mode)
Device reset.
smartdof_product_id_response
uint8_t smartdof_product_id_response(smartdof_pir_t *pir)
Receiving product id response.