smartdof 2.0.0.0
|
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. | |
void smartdof_bt_set | ( | smartdof_t * | ctx, |
uint8_t | pin_state ) |
Setting BT pin state.
ctx | Click object. |
pin_state | State of BT pin |
@description This function sets BT pin to HIGH state if pin_state is set to 1; sets BT pin to LOW state if pin_state is set to 0
void smartdof_cfg_setup | ( | smartdof_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
void smartdof_command_request | ( | smartdof_t * | ctx, |
uint8_t | command_type, | ||
uint8_t * | command_parameters ) |
Requesting command.
ctx | Click object. |
command_type | Command type to be requested [range : 1 - 127] |
command_parameters | Buffer that holds command parameters [parameter interpretation is defined for each command] |
@description This function sends command request report to device
uint8_t smartdof_command_response | ( | smartdof_t * | ctx, |
uint8_t * | response_parameters ) |
Receiving command response.
ctx | Click object. |
response_parameters | Buffer that holds command response parameters |
@description
This function receives command response report bytes This function than checks if it received correct report (correct data length and correct report id) This function than parses received data and returns parsed data to user This function is used to report the results of some special operation or some special data that is not part of normal sensor operation
uint8_t smartdof_default_cfg | ( | smartdof_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
@description This function executes default configuration for SmartDof click.
void smartdof_device_reset | ( | smartdof_t * | ctx, |
uint8_t | boot_mode ) |
Device reset.
ctx | Click object. |
boot_mode | Device boot mode (normal or dfu - fw update) |
@description This function resets device and sets it into normal or boot (dfu) mode
uint8_t smartdof_flush_completed | ( | smartdof_t * | ctx, |
uint8_t * | sensor_id ) |
Receiving flush completed response.
ctx | Click object. |
sensor_id | Report id of the sensor whose data was flushed |
@description
This function receives flush completed response report bytes This function than checks if it received correct report (correct data length and correct report id) This function than parses received data and returns parsed data to user
void smartdof_force_sensor_flush | ( | smartdof_t * | ctx, |
uint8_t | sensor_id ) |
Requesting force sensor flush.
ctx | Click object. |
sensor_id | Report id of the sensor whose data is to be flushed |
@description This function sends force sensor flush request report to device
void smartdof_frs_read_request | ( | smartdof_t * | ctx, |
uint16_t | data_offset, | ||
uint16_t | frs_type, | ||
uint16_t | data_size ) |
Requesting FRS read.
ctx | Click object. |
data_offset | Offset ( expressed in number of 32-bit data words) from the beginning of the FRS record |
frs_type | Type of FRS record to read |
data_size | Number of 32-bit data words to read |
@description This function sends FRS read request report to device; If the data size is set to zero, then the entire record beginning at the offset value (data_offset) is returned
uint8_t smartdof_frs_read_response | ( | smartdof_t * | ctx, |
smartdof_rr_t * | rr ) |
Receiving FRS read response.
ctx | Click object. |
rr | Click FRS read response object. Structure Members: - uint8_t data_length - number of received 32-bit data words - uint8_t read_status - status of FRS read operation - uint16_t data_offset - offset ( expressed in number of 32-bit data words) from the beginning of the FRS record - uint32_t data_buffer[] - buffer in which data words are to be stored - uint16_t frs_type - FRS record type to be read |
@description
This function receives FRS read response report bytes This function than checks if it received correct report (correct data length and correct report id) This function than parses received data and returns parsed data to user Once a read request has been received, the FSP3xx generates read responses until the request record or portion of a record is returned Read status can be : 0 - no error 1, - unrecognized FRS type, 2 - busy, 3 - read record completed, 4 - offset out of range, 5 - record empty, 6 - read block completed (if block size requested), 7 - read block completed and read record completed, 8 - device error (DFU flash memory device unavailable), 9-15 - reserved
void smartdof_frs_write_data_request | ( | smartdof_t * | ctx, |
uint16_t | data_offset, | ||
uint32_t * | data_buffer ) |
Requesting FRS write data.
ctx | Click object. |
data_offset | Offset (expressed in number of 32-bit data words) from the beginning of the FRS record |
data_buffer | Two 32-bit words of data to be written to the FRS record |
@description This function sends FRS write data request report to device
void smartdof_frs_write_request | ( | smartdof_t * | ctx, |
uint16_t | data_length, | ||
uint16_t | frs_type ) |
Requesting FRS write.
ctx | Click object. |
data_length | Length in 32-bit words of the record to be written |
frs_type | Type of FRS record to be sent |
@description This function is used to initiate writing FRS record, by sending product FRS write request report to device
uint8_t smartdof_frs_write_response | ( | smartdof_t * | ctx, |
uint8_t * | frs_status, | ||
uint16_t * | data_offset ) |
Receiving FRS write response.
ctx | Click object. |
frs_status | Status of previous write operation |
data_offset | Offset ( expressed in number of 32-bit data words) from the beginning of the FRS record |
@description
This function receives FRS write response report bytes This function than checks if it received correct report (correct data length and correct report id) This function than parses received data and returns parsed data to user This function is to be called after 'smartdof_frsWriteRequest()' and 'smartdof_frsWriteDataRequest()' functions
void smartdof_get_data | ( | smartdof_t * | ctx, |
uint8_t * | data_header, | ||
uint16_t * | data_length, | ||
uint8_t * | data_buffer ) |
Getting received data.
ctx | Click object. |
data_header | Received header bytes |
data_length | Length of received data (not including header bytes) |
data_buffer | Received data bytes |
@description This function returns data received by 'smartdof_receive_packet()' function to user
@recomanded Provide 'data_buffer[]' with size of 1020 bytes as that is maximum number of data bytes that can be received (not including header bytes)
void smartdof_get_feature_request | ( | smartdof_t * | ctx, |
uint8_t | feature_report_id ) |
Requesting get feature request.
ctx | Click object. |
feature_report_id | Report id of the feature to be requested |
@description This function sends get feature request report to device
uint8_t smartdof_get_feature_response | ( | smartdof_t * | ctx, |
smartdof_sfc_t * | sfc ) |
Receiving get feature response.
ctx | Click object. |
sfc | Click set feature command object. Structure Members: - [out] uint8_t feature_report_id - report id of the feature to be set - [out] uint8_t feature_flags - bit field that enables various device features - [out] uint16_t change_sensitivity - 16-bit signed fixed point integer representing the value a sensor output must exceed in order to trigger another input report - [out] uint32_t report_interval - 32-bit unsigned integer representing the interval in microseconds between asynchronous input reports and the time - [out] uint32_t batch_interval - 32-bit unsigned integer controlling the maximum delay (in microseconds) between the time that a sensor is sampled that its data can be reported. The value 0 is reserved for do not delay and the value 0xFFFFFFFF is reserved for never trigger delivery on the basis of elapsed time - [out] uint32_t sensor_specific_config - 32-bit field available for use by sensors requiring additional configuration options |
@description
This function receives get feature response report bytes This function than checks if it received correct report (correct data length and correct report id) This function than parses received data and returns parsed data to user
void smartdof_i2c_read | ( | smartdof_t * | ctx, |
uint8_t * | read_data, | ||
uint16_t | n_bytes ) |
Receiving data bytes via I2C.
ctx | Click object. |
read_data | Buffer that holds data to be sent. |
n_bytes | Number of bytes to send. |
@description This function receives number of bytes (n_bytes) via I2C and stores those bytes into data buffer (read_data[])
void smartdof_i2c_write | ( | smartdof_t * | ctx, |
uint8_t * | write_data, | ||
uint16_t | n_bytes ) |
Sending data bytes via I2C.
ctx | Click object. |
write_data | Buffer that holds data to be sent. |
n_bytes | Number of bytes to send. |
@description This function sends specified number of bytes (n_bytes) from data buffer (write_data[]) via I2C
SMARTDOF_RETVAL smartdof_init | ( | smartdof_t * | ctx, |
smartdof_cfg_t * | cfg ) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
uint8_t smartdof_int_get | ( | smartdof_t * | ctx | ) |
Getting state of INT pin.
ctx | Click object. |
@description This function returns INT pin state
void smartdof_product_id_request | ( | smartdof_t * | ctx | ) |
Requesting product id.
ctx | Click object. |
@description This function sends product id request report to device
uint8_t smartdof_product_id_response | ( | smartdof_t * | ctx, |
smartdof_pir_t * | pir ) |
Receiving product id response.
ctx | Click object. |
pir | Click product id response object. Structure Members: - uint8_t reset_cause - last cause of the processor reset - uint16_t sw_version - device software version - uint32_t sw_part_number - device software part number - uint32_t sw_build_number - device software build number - uint16_t sw_version_patch - device software version patch |
@description
- This function receives product id response report bytes - This function than checks if it received correct report (correct data length and correct report id) - This function than parses received data and returns parsed data to user - Reset causes can be : 0 - Not Applicable, 1 - Power On Reset, 2 - Internal System Reset, 3 - Watchdog Timeout, 4 - External Reset, 5 - Other
float smartdof_q_point_to_float | ( | int16_t | sensor_data, |
uint8_t | sensor_q_point ) |
Q point (fixed point) value to float conversion.
sensor_data | |
sensor_q_point |
@description This function converts fixed point value (sensor_data) with specified Q point (sensor_Qpoint) to floating point value (return value)
@recomended Obtain Q point values via 'frs_read_request()' function
uint8_t smartdof_receive_packet | ( | smartdof_t * | ctx, |
uint32_t | n_cycles_timeout ) |
Receiving data packet.
ctx | Click object. |
n_cycles_timeout | Number of cycles to wait for INT pin to go LOW |
@description This function receives data packet from device
This function waits for INT pin to go LOW This function than receives 4 header bytes This function than parses header bytes to get data length of entire packet and stores header bytes to header buffer This function than waits for INT pin to go LOW again, receives entire packet and stores packet data to data buffer
@recomended Retrieve header bytes, data length and data bytes with 'smartdof_getData()' function
void smartdof_rst_set | ( | smartdof_t * | ctx, |
uint8_t | pin_state ) |
Setting RST pin state.
ctx | Click object. |
pin_state | State of RST pin |
@description This function sets RST pin to HIGH state if pin_state is set to 1; sets RST pin to LOW state if pin_state is set to 0
void smartdof_send_packet | ( | smartdof_t * | ctx, |
uint8_t | channel_number, | ||
uint16_t | data_length, | ||
uint8_t * | packet_data ) |
Sending data packet.
ctx | Click object. |
channel_number | Channel for sending data |
data_length | Length of data to be sent (in bytes, not including header bytes) |
packet_data | Buffer that holds data to be sent (not including header bytes) |
@description This function forms a packet of data by attaching proper header to data by setting data length (data_length + 4), channel and channel sequence number bytes
void smartdof_set_feature_command | ( | smartdof_t * | ctx, |
smartdof_sfc_t * | sfc ) |
Requesting set feature command.
ctx | Click object. |
sfc | Click set feature command object. Structure Members: - [in] uint8_t feature_report_id - report id of the feature to be set - [in] uint8_t feature_flags - bit field that enables various device features - [in] uint16_t change_sensitivity - 16-bit signed fixed point integer representing the value a sensor output must exceed in order to trigger another input report - [in] uint32_t report_interval - 32-bit unsigned integer representing the interval in microseconds between asynchronous input reports and the time - [in] uint32_t batch_interval - 32-bit unsigned integer controlling the maximum delay (in microseconds) between the time that a sensor is sampled that its data can be reported. The value 0 is reserved for do not delay and the value 0xFFFFFFFF is reserved for never trigger delivery on the basis of elapsed time - [in] uint32_t sensor_specific_config - 32-bit field available for use by sensors requiring additional configuration options |
@description This function sends set feature request report to device