smartsens 2.0.0.0
|
API for configuring and manipulating Smart Sens Click driver. More...
Topics | |
Smart Sens Registers List | |
List of registers of Smart Sens Click driver. | |
Smart Sens Registers Settings | |
Settings for registers of Smart Sens Click driver. | |
Smart Sens MikroBUS Map | |
MikroBUS pin mapping of Smart Sens Click driver. | |
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. | |
API for configuring and manipulating Smart Sens Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
err_t smartsens_boot_firmware | ( | smartsens_t * | ctx | ) |
Boot firmware image.
This function boots firmware and starts firmware from RAM or FLASH depending of your define setup.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_byte_read | ( | smartsens_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
Byte reading function.
This function reads a byte from the selected register.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read byte. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_byte_write | ( | smartsens_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Byte writing function.
This function writes a byte to the selected register.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Byte to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void smartsens_cfg_setup | ( | smartsens_cfg_t * | cfg | ) |
Smart Sens configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See smartsens_cfg_t object definition for detailed explanation. |
err_t smartsens_cmd_write | ( | smartsens_t * | ctx, |
uint16_t | cmd, | ||
uint8_t * | cmd_buf, | ||
uint16_t | cmd_len ) |
Send command.
This function sends command and it's parameters to the device.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | cmd | : Command. |
[in] | cmd_buf | : Command parameter buffer. |
[in] | cmd_len | : Command parameter buffer length. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_default_cfg | ( | smartsens_t * | ctx | ) |
Smart Sens default configuration function.
This function executes a default configuration of Smart Sens click board.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
0
- Success, -1
- Error.void smartsens_drv_interface_selection | ( | smartsens_cfg_t * | cfg, |
smartsens_drv_t | drv_sel ) |
Smart Sens 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 smartsens_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See smartsens_drv_t object definition for detailed explanation. |
err_t smartsens_generic_read | ( | smartsens_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Smart Sens data reading function.
This function reads a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t smartsens_generic_write | ( | smartsens_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Smart Sens data writing function.
This function writes a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.err_t smartsens_get_and_process_fifo | ( | smartsens_t * | ctx, |
uint8_t * | work_buffer, | ||
uint32_t | buffer_size ) |
Get and process the FIFO.
Function to get and process the FIFOs.
[in] | work_buffer | : Reference to the data buffer where the FIFO data is copied to before parsing. |
[in] | buffer_size | : Size of the data buffer. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t smartsens_get_interrupt | ( | smartsens_t * | ctx | ) |
Get interrupt.
This function reads interrupt pin state.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
err_t smartsens_get_parameter | ( | smartsens_t * | ctx, |
uint16_t | parameter, | ||
uint8_t * | parameter_buf, | ||
uint16_t * | parameter_len ) |
Get command parameters response.
This function sends command and awaits response from status and debug FIFO.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | parameter | : Command to read parameters from. |
[out] | parameter_buf | : Command parameter buffer. |
[out] | parameter_len | : Command parameter buffer length. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_get_virt_sensor_list | ( | smartsens_t * | ctx, |
uint8_t * | sensor_list ) |
Get the virtual sensor list.
Function to get the virtual sensor list.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[out] | sensor_list | : Reference to the 32byte data buffer that stores the sensor list as a bit format. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_init | ( | smartsens_t * | ctx, |
smartsens_cfg_t * | cfg ) |
Smart Sens initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See smartsens_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t smartsens_power_on_device | ( | smartsens_t * | ctx | ) |
Power on device boot/upload firmware to device.
This function sends command and its parameters to the device.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
Function to link a callback and relevant reference when the sensor event is available in the FIFO.
[in] | sensor_id | : Sensor ID of the virtal sensor |
[in] | callback | : Reference of the callback function |
[in] | callback_ref | : Reference needed inside the callback function. Can be NULL. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void smartsens_reset | ( | smartsens_t * | ctx | ) |
Reset device.
This function hardware resets device by toggling rst pin.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
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.
Function to set the sample rate and latency of the virtual sensor.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[in] | sensor_id | : Sensor ID of the virtual sensor |
[in] | sample_rate | : Sample rate in Hz |
[in] | latency | : Report latency in milliseconds |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_status_read | ( | smartsens_t * | ctx, |
uint16_t * | cmd, | ||
uint8_t * | cmd_buf, | ||
uint16_t * | cmd_len ) |
Read Status and Debug FIFO.
This function reads status and debug fifo for command and it's length, if cmd_len is >0 it will also read command parameter resposne.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
[out] | cmd | : Command read. |
[out] | cmd_buf | : Command parameter buffer. |
[out] | cmd_len | : Command parameter buffer length. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_sw_reset | ( | smartsens_t * | ctx | ) |
SW Reset device.
This function software resets device by setting reset bit in Reset Request register(0x14).
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_update_firmware | ( | smartsens_t * | ctx | ) |
Upload firmware image to the device.
This function will upload firmware image to device RAM or FLASH depending of your define setup.
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t smartsens_update_virtual_sensor_list | ( | smartsens_t * | ctx | ) |
Update the callback table's information.
Function to update the callback table's information
[in] | ctx | : Click context object. See smartsens_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.