smartdof4 2.1.0.0
|
API for configuring and manipulating Smart DOF 4 Click driver. More...
Topics | |
Smart DOF 4 Registers List | |
List of registers of Smart DOF 4 Click driver. | |
Smart DOF 4 Registers Settings | |
Settings for registers of Smart DOF 4 Click driver. | |
Smart DOF 4 MikroBUS Map | |
MikroBUS pin mapping of Smart DOF 4 Click driver. | |
Functions | |
void | smartdof4_cfg_setup (smartdof4_cfg_t *cfg) |
Smart DOF 4 configuration object setup function. | |
void | smartdof4_drv_interface_sel (smartdof4_cfg_t *cfg, smartdof4_drv_t drv_sel) |
Smart DOF 4 driver interface setup function. | |
err_t | smartdof4_init (smartdof4_t *ctx, smartdof4_cfg_t *cfg) |
Smart DOF 4 initialization function. | |
err_t | smartdof4_default_cfg (smartdof4_t *ctx) |
Smart DOF 4 default configuration function. | |
err_t | smartdof4_send_packet (smartdof4_t *ctx, uint8_t ch_num, uint8_t *payload, uint16_t len) |
Smart DOF 4 send packet function. | |
err_t | smartdof4_read_packet (smartdof4_t *ctx) |
Smart DOF 4 read packet function. | |
void | smartdof4_set_rst_pin (smartdof4_t *ctx, uint8_t state) |
Smart DOF 4 set rst pin function. | |
void | smartdof4_set_wup_pin (smartdof4_t *ctx, uint8_t state) |
Smart DOF 4 set wup pin function. | |
uint8_t | smartdof4_get_int_pin (smartdof4_t *ctx) |
Smart DOF 4 get int pin function. | |
void | smartdof4_reset_device (smartdof4_t *ctx) |
Smart DOF 4 reset device function. | |
err_t | smartdof4_wait_ready (smartdof4_t *ctx, uint16_t timeout_ms) |
Smart DOF 4 wait ready function. | |
err_t | smartdof4_read_pid (smartdof4_t *ctx, smartdof4_pid_t *pid) |
Smart DOF 4 read pid function. | |
err_t | smartdof4_frs_wr_req (smartdof4_t *ctx, uint16_t rec_id, uint16_t len) |
Smart DOF 4 frs wr req function. | |
err_t | smartdof4_frs_wr_data_req (smartdof4_t *ctx, uint16_t offset, uint32_t data0_in, uint32_t data1_in) |
Smart DOF 4 frs wr data req function. | |
err_t | smartdof4_frs_wr_resp (smartdof4_t *ctx, uint16_t *offset, uint8_t *status) |
Smart DOF 4 frs wr resp function. | |
err_t | smartdof4_frs_rd_req (smartdof4_t *ctx, uint16_t rec_id) |
Smart DOF 4 frs rd req function. | |
err_t | smartdof4_frs_rd_resp (smartdof4_t *ctx, uint16_t *offset, uint8_t *status, uint32_t *data0_out, uint32_t *data1_out, uint16_t *rec_id) |
Smart DOF 4 frs rd resp function. | |
err_t | smartdof4_cmd_req (smartdof4_t *ctx, uint8_t cmd, uint8_t *params) |
Smart DOF 4 cmd req function. | |
err_t | smartdof4_cmd_resp (smartdof4_t *ctx, uint8_t *cmd, uint8_t *params) |
Smart DOF 4 cmd resp function. | |
err_t | smartdof4_feature_req (smartdof4_t *ctx, uint8_t rep_id) |
Smart DOF 4 feature req function. | |
err_t | smartdof4_feature_set (smartdof4_t *ctx, smartdof4_feature_t *feat) |
Smart DOF 4 feature set function. | |
err_t | smartdof4_feature_resp (smartdof4_t *ctx, smartdof4_feature_t *feat) |
Smart DOF 4 feature resp function. | |
err_t | smartdof4_read_data (smartdof4_t *ctx, smartdof4_axis_t *accel, smartdof4_axis_t *gyro, smartdof4_axis_t *mag) |
Smart DOF 4 read data function. | |
API for configuring and manipulating Smart DOF 4 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void smartdof4_cfg_setup | ( | smartdof4_cfg_t * | cfg | ) |
Smart DOF 4 configuration object setup function.
This function initializes Click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See smartdof4_cfg_t object definition for detailed explanation. |
err_t smartdof4_cmd_req | ( | smartdof4_t * | ctx, |
uint8_t | cmd, | ||
uint8_t * | params ) |
Smart DOF 4 cmd req function.
This function sends a CMD request with specified command parameters.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | cmd | : Command byte. |
[in] | params | : 9 bytes command parameters. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_cmd_resp | ( | smartdof4_t * | ctx, |
uint8_t * | cmd, | ||
uint8_t * | params ) |
Smart DOF 4 cmd resp function.
This function reads the command response with parameters.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[out] | cmd | : Command byte. |
[out] | params | : 11 bytes command parameters. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_default_cfg | ( | smartdof4_t * | ctx | ) |
Smart DOF 4 default configuration function.
This function executes a default configuration of Smart DOF 4 Click board.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void smartdof4_drv_interface_sel | ( | smartdof4_cfg_t * | cfg, |
smartdof4_drv_t | drv_sel ) |
Smart DOF 4 driver interface setup function.
This function sets a serial driver interface which will be used further in the Click driver.
[out] | cfg | : Click configuration structure. See smartdof4_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See smartdof4_drv_t object definition for detailed explanation. |
err_t smartdof4_feature_req | ( | smartdof4_t * | ctx, |
uint8_t | rep_id ) |
Smart DOF 4 feature req function.
This function sends a get feature request for the selected report ID.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | rep_id | : Repord ID. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_feature_resp | ( | smartdof4_t * | ctx, |
smartdof4_feature_t * | feat ) |
Smart DOF 4 feature resp function.
This function retrieves a full feature report that was requested.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[out] | feat | : Feature report object. See smartdof4_feature_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_feature_set | ( | smartdof4_t * | ctx, |
smartdof4_feature_t * | feat ) |
Smart DOF 4 feature set function.
This function sets a full feature report.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | feat | : Feature report object. See smartdof4_feature_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_frs_rd_req | ( | smartdof4_t * | ctx, |
uint16_t | rec_id ) |
Smart DOF 4 frs rd req function.
This function sends a FRS read request for the selected FRS record ID.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | rec_id | : FRS record ID. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_frs_rd_resp | ( | smartdof4_t * | ctx, |
uint16_t * | offset, | ||
uint8_t * | status, | ||
uint32_t * | data0_out, | ||
uint32_t * | data1_out, | ||
uint16_t * | rec_id ) |
Smart DOF 4 frs rd resp function.
This function reads the contents of an FRS record.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[out] | offset | : Offset, in 32-bit words, from the beginning of the record. |
[out] | status | : Data Len / Status byte read. |
[out] | data0_out | : 32-bit data 0 word read from the FRS record. |
[out] | data1_out | : 32-bit data 1 word read from the FRS record. |
[out] | rec_id | : FRS record ID read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_frs_wr_data_req | ( | smartdof4_t * | ctx, |
uint16_t | offset, | ||
uint32_t | data0_in, | ||
uint32_t | data1_in ) |
Smart DOF 4 frs wr data req function.
This function writes FRS data to the record indicated by a previous write request.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | offset | : Offset, in 32-bit words, from the beginning of the record. |
[in] | data0_in | : 32-bit data 0 word to be written to the FRS record. |
[in] | data1_in | : 32-bit data 1 word to be written to the FRS record. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_frs_wr_req | ( | smartdof4_t * | ctx, |
uint16_t | rec_id, | ||
uint16_t | len ) |
Smart DOF 4 frs wr req function.
This function sends a FRS write request for the selected FRS record ID and length.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | rec_id | : FRS record ID. |
[in] | len | : Length in 32-bit words of the record to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_frs_wr_resp | ( | smartdof4_t * | ctx, |
uint16_t * | offset, | ||
uint8_t * | status ) |
Smart DOF 4 frs wr resp function.
This function reads the status of a FRS write operation.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[out] | offset | : Offset, in 32-bit words, from the beginning of the record. |
[out] | status | : Status/Error byte read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t smartdof4_get_int_pin | ( | smartdof4_t * | ctx | ) |
Smart DOF 4 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
err_t smartdof4_init | ( | smartdof4_t * | ctx, |
smartdof4_cfg_t * | cfg ) |
Smart DOF 4 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
[out] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See smartdof4_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_read_data | ( | smartdof4_t * | ctx, |
smartdof4_axis_t * | accel, | ||
smartdof4_axis_t * | gyro, | ||
smartdof4_axis_t * | mag ) |
Smart DOF 4 read data function.
This function reads the accelerometer (g), gyroscope (dps), and magnetometer (uT) 3-axis data from input report.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[out] | accel | : Accelerometer data [g]. See smartdof4_axis_t object definition for detailed explanation. |
[out] | gyro | : Gyroscope data [dps]. See smartdof4_axis_t object definition for detailed explanation. |
[out] | mag | : Magnetometer data [uT]. See smartdof4_axis_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_read_packet | ( | smartdof4_t * | ctx | ) |
Smart DOF 4 read packet function.
This function waits for a data ready indication from INT pin, then reads the received SHTP packet and stores it in the ctx->shtp.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartdof4_read_pid | ( | smartdof4_t * | ctx, |
smartdof4_pid_t * | pid ) |
Smart DOF 4 read pid function.
This function reads the product ID information.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[out] | pid | : Product ID information read. See smartdof4_pid_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void smartdof4_reset_device | ( | smartdof4_t * | ctx | ) |
Smart DOF 4 reset device function.
This function resets the device by toggling the RST pin state.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
err_t smartdof4_send_packet | ( | smartdof4_t * | ctx, |
uint8_t | ch_num, | ||
uint8_t * | payload, | ||
uint16_t | len ) |
Smart DOF 4 send packet function.
This function forms a SHTP packet and sends it over the serial interface.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | ch_num | : Channel number [0-5]. |
[in] | payload | : Data payload buffer. |
[in] | len | : Number of payload bytes to be written (up to 128). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void smartdof4_set_rst_pin | ( | smartdof4_t * | ctx, |
uint8_t | state ) |
Smart DOF 4 set rst pin function.
This function sets the RST pin logic state.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
void smartdof4_set_wup_pin | ( | smartdof4_t * | ctx, |
uint8_t | state ) |
Smart DOF 4 set wup pin function.
This function sets the WUP pin logic state.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t smartdof4_wait_ready | ( | smartdof4_t * | ctx, |
uint16_t | timeout_ms ) |
Smart DOF 4 wait ready function.
This function waits a desired period for a data ready indication from INT pin.
[in] | ctx | : Click context object. See smartdof4_t object definition for detailed explanation. |
[in] | timeout_ms | : Wait timeout in milliseconds. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.