Bridle API 4.1.99
A Zephyr based application framework
|
I2C-Bus Access Interface for an STK8BA58. More...
#include <stdint.h>
#include <stddef.h>
#include <math.h>
#include <zephyr/drivers/i2c.h>
Go to the source code of this file.
Data Structures | |
struct | stk8ba58_out1_t |
Data for any-axis acceleration data (LSB) and the new data flag. More... | |
struct | stk8ba58_out2_t |
Data struct for any-axis acceleration data (MSB). More... | |
struct | stk8ba58_intsts1_t |
Data for motion detection interrupts status. More... | |
struct | stk8ba58_intsts2_t |
Data for new data interrupt status. More... | |
struct | stk8ba58_eventinfo1_t |
Data for any-motion (slope) detection information. More... | |
struct | stk8ba58_rangesel_t |
Data for acceleration sensing range. More... | |
struct | stk8ba58_bwsel_t |
Data for output data bandwidth selection. More... | |
struct | stk8ba58_powmode_t |
Data for power mode selection and the sleep time duration setting. More... | |
struct | stk8ba58_datasetup_t |
Data for output data filter and protection function. More... | |
struct | stk8ba58_inten1_t |
Data for motion detection interrupts enable. More... | |
struct | stk8ba58_inten2_t |
Data for new data interrupt enable. More... | |
struct | stk8ba58_intmap1_t |
Data for motion detection interrupts mapping to INT1 pin. More... | |
struct | stk8ba58_intmap2_t |
Data for new data interrupt mapping to INT1 pin. More... | |
struct | stk8ba58_intcfg1_t |
Data for INT1 pin output type and active level. More... | |
struct | stk8ba58_intcfg2_t |
Data for INT1 pin mode and latched hold-time. More... | |
struct | stk8ba58_slopedly_t |
Data for number of samples in the slope detection. More... | |
struct | stk8ba58_sigmot1_t |
Data for skip time (LSB) of the significant motion. More... | |
struct | stk8ba58_sigmot2_t |
Data for skip time (MSB) of the significant motion, interrupt enable. More... | |
struct | stk8ba58_sigmot3_t |
Data for proof time of the significant motion. More... | |
struct | stk8ba58_intfcfg_t |
Data for digital interface parameters of the I2C interface. More... | |
struct | stk8ba58_ofstcomp1_t |
Data for settings of the offset compensation. More... | |
struct | stk8ba58_ofst_t |
Data struct for any-axis offset compensation value. More... | |
struct | stk8ba58_all_sources_t |
Data for motion detection and data interrupts status. More... | |
struct | stk8ba58_pin_int1_route_t |
Data for motion detection and data interrupts mapping to INT1 pin. More... | |
struct | stk8ba58_int_enable_t |
Data for motion detection and data interrupts enable. More... | |
Macros | |
#define | STK8BA58_ID 0x87U |
Default for device identification (CHIP ID). | |
#define | STK8BA58_XOUT1_DFL 0x00U |
Default for x-axis acceleration data (LSB) and the new data flag. | |
#define | STK8BA58_XOUT2_DFL 0x00U |
Default for x-axis acceleration data (MSB). | |
#define | STK8BA58_YOUT1_DFL 0x00U |
Default for y-axis acceleration data (LSB) and the new data flag. | |
#define | STK8BA58_YOUT2_DFL 0x00U |
Default for y-axis acceleration data (MSB). | |
#define | STK8BA58_ZOUT1_DFL 0x00U |
Default for z-axis acceleration data (LSB) and the new data flag. | |
#define | STK8BA58_ZOUT2_DFL 0x00U |
Default for z-axis acceleration data (MSB). | |
#define | STK8BA58_INTSTS1_DFL 0x00U |
Default for motion detection interrupts status. | |
#define | STK8BA58_INTSTS2_DFL 0x00U |
Default for new data interrupt status. | |
#define | STK8BA58_EVENTINFO1_DFL 0x00U |
Default for any-motion (slope) detection information. | |
#define | STK8BA58_RANGESEL_DFL 0x00U |
Default for acceleration sensing range. | |
#define | STK8BA58_BWSEL_DFL 0x1FU |
Default for output data bandwidth selection. | |
#define | STK8BA58_POWMODE_DFL 0x00U |
Default for power mode selection and the sleep time duration setting. | |
#define | STK8BA58_DATASETUP_DFL 0x00U |
Default for output data filter and protection function. | |
#define | STK8BA58_SWRST_DFL 0x00U |
Default for device software reset. | |
#define | STK8BA58_RST 0xB6U |
Command for device software reset to register defaults (SWRST). | |
#define | STK8BA58_INTEN1_DFL 0x00U |
Default for motion detection interrupts enable. | |
#define | STK8BA58_INTEN2_DFL 0x00U |
Default for new data interrupt enable. | |
#define | STK8BA58_INTMAP1_DFL 0x00U |
Default for motion detection interrupts mapping to INT1 pin. | |
#define | STK8BA58_INTMAP2_DFL 0x00U |
Default for new data interrupt mapping to INT1 pin. | |
#define | STK8BA58_INTCFG1_DFL 0x01U |
Default for INT1 pin output type and active level. | |
#define | STK8BA58_INTCFG2_DFL 0x00U |
Default for INT1 pin mode and latched hold-time. | |
#define | STK8BA58_SLOPEDLY_DFL 0x00U |
Default for number of samples in the slope detection. | |
#define | STK8BA58_SLOPETHD_DFL 0x14U |
Default for threshold value of the slope detection. | |
#define | STK8BA58_SIGMOT1_DFL 0x96U |
Default for skip time (LSB) of the significant motion. | |
#define | STK8BA58_SIGMOT2_DFL 0x02U |
Default for skip time (MSB) of the significant motion, interrupt enable. | |
#define | STK8BA58_SIGMOT3_DFL 0x32U |
Default for proof time of the significant motion. | |
#define | STK8BA58_INTFCFG_DFL 0x00U |
Default for digital interface parameters of the I2C interface. | |
#define | STK8BA58_OFSTCOMP1_DFL 0x00U |
Default for settings of the offset compensation. | |
#define | STK8BA58_OFSTX_DFL 0x00U |
Default for x-axis offset compensation value. | |
#define | STK8BA58_OFSTY_DFL 0x00U |
Default for y-axis offset compensation value. | |
#define | STK8BA58_OFSTZ_DFL 0x00U |
Default for z-axis offset compensation value. | |
#define | STK8BA58_CHIP_ID 0x00U |
Address for device identification (CHIP ID). | |
#define | STK8BA58_XOUT1 0x02U |
Address for x-axis acceleration data (LSB) and the new data flag. | |
#define | STK8BA58_YOUT1 0x04U |
Address for y-axis acceleration data (LSB) and the new data flag. | |
#define | STK8BA58_ZOUT1 0x06U |
Address for z-axis acceleration data (LSB) and the new data flag. | |
#define | STK8BA58_XOUT2 0x03U |
Address for x-axis acceleration data (MSB). | |
#define | STK8BA58_YOUT2 0x05U |
Address for y-axis acceleration data (MSB). | |
#define | STK8BA58_ZOUT2 0x07U |
Address for z-axis acceleration data (MSB). | |
#define | STK8BA58_INTSTS1 0x09U |
Address for motion detection interrupts status. | |
#define | STK8BA58_INTSTS2 0x0AU |
Address for new data interrupt status. | |
#define | STK8BA58_EVENTINFO1 0x0BU |
Address for any-motion (slope) detection information. | |
#define | STK8BA58_RANGESEL 0x0FU |
Address for acceleration sensing range. | |
#define | STK8BA58_BWSEL 0x10U |
Address for output data bandwidth selection. | |
#define | STK8BA58_POWMODE 0x11U |
Address for power mode selection and the sleep time duration setting. | |
#define | STK8BA58_DATASETUP 0x13U |
Address for output data filter and protection function. | |
#define | STK8BA58_SWRST 0x14U |
Address for device software reset. | |
#define | STK8BA58_INTEN1 0x16U |
Address for motion detection interrupts enable. | |
#define | STK8BA58_INTEN2 0x17U |
Address for new data interrupt enable. | |
#define | STK8BA58_INTMAP1 0x19U |
Address for motion detection interrupts mapping to INT1 pin. | |
#define | STK8BA58_INTMAP2 0x1AU |
Address for new data interrupt mapping to INT1 pin. | |
#define | STK8BA58_INTCFG1 0x20U |
Address for INT1 pin output type and active level. | |
#define | STK8BA58_INTCFG2 0x21U |
Address for INT1 pin mode and latched hold-time. | |
#define | STK8BA58_SLOPEDLY 0x27U |
Address for number of samples in the slope detection. | |
#define | STK8BA58_SLOPETHD 0x28U |
Address for threshold value of the slope detection. | |
#define | STK8BA58_SIGMOT1 0x29U |
Address for skip time (LSB) of the significant motion. | |
#define | STK8BA58_SIGMOT2 0x2AU |
Address for skip time (MSB) of the significant motion, interrupt enable. | |
#define | STK8BA58_SIGMOT3 0x2BU |
Address for proof time of the significant motion. | |
#define | STK8BA58_INTFCFG 0x34U |
Address for digital interface parameters of the I2C interface. | |
#define | STK8BA58_OFSTCOMP1 0x36U |
Address for settings of the offset compensation. | |
#define | STK8BA58_OFSTX 0x38U |
Address for x-axis offset compensation value. | |
#define | STK8BA58_OFSTY 0x39U |
Address for y-axis offset compensation value. | |
#define | STK8BA58_OFSTZ 0x3AU |
Address for z-axis offset compensation value. | |
#define | STK8BA58_I2C_WRITE_BUFFER_SIZE (16U) |
The size of the buffer pushed on the stack used to copy the data to be written along with the register address. | |
Functions | |
int32_t | stk8ba58_read_reg (const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t *data, uint16_t len) |
Read generic device register. | |
int32_t | stk8ba58_write_reg (const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t *data, uint16_t len) |
Write generic device register. | |
float_t | stk8ba58_from_fs2g_to_mg (int16_t lsb) |
float_t | stk8ba58_from_fs4g_to_mg (int16_t lsb) |
float_t | stk8ba58_from_fs8g_to_mg (int16_t lsb) |
int32_t | stk8ba58_all_sources_get (const struct i2c_dt_spec *i2c, stk8ba58_all_sources_t *val) |
Read all the interrupt/status flag of the device. | |
int32_t | stk8ba58_xl_range_set (const struct i2c_dt_spec *i2c, stk8ba58_range_t val) |
Accelerometer range selection. | |
int32_t | stk8ba58_xl_range_get (const struct i2c_dt_spec *i2c, stk8ba58_range_t *val) |
Accelerometer range selection. | |
int32_t | stk8ba58_xl_bandwidth_set (const struct i2c_dt_spec *i2c, stk8ba58_bw_t val, stk8ba58_ds_t sel) |
Accelerometer bandwidth selection. | |
int32_t | stk8ba58_xl_bandwidth_get (const struct i2c_dt_spec *i2c, stk8ba58_bw_t *val, stk8ba58_ds_t *sel) |
Accelerometer bandwidth selection. | |
int32_t | stk8ba58_xl_power_mode_set (const struct i2c_dt_spec *i2c, stk8ba58_sleepdur_t val, stk8ba58_pm_t sel) |
Accelerometer power mode selection. | |
int32_t | stk8ba58_xl_power_mode_get (const struct i2c_dt_spec *i2c, stk8ba58_sleepdur_t *val, stk8ba58_pm_t *sel) |
Accelerometer bandwidth selection. | |
int32_t | stk8ba58_acceleration_raw_get (const struct i2c_dt_spec *i2c, int16_t *buff) |
Linear acceleration output register. | |
int32_t | stk8ba58_device_id_get (const struct i2c_dt_spec *i2c, uint8_t *buff) |
DeviceChipID. | |
int32_t | stk8ba58_reset_set (const struct i2c_dt_spec *i2c, uint8_t val) |
Software reset. | |
int32_t | stk8ba58_pin_int1_mode_set (const struct i2c_dt_spec *i2c, stk8ba58_pp_od_t val) |
Push-pull/open-drain selection on interrupt pad. | |
int32_t | stk8ba58_pin_int1_mode_get (const struct i2c_dt_spec *i2c, stk8ba58_pp_od_t *val) |
Push-pull/open-drain selection on interrupt pad. | |
int32_t | stk8ba58_pin_int1_polarity_set (const struct i2c_dt_spec *i2c, stk8ba58_hl_active_t val) |
Polarity active-high/-low selection on interrupt pad. | |
int32_t | stk8ba58_pin_int1_polarity_get (const struct i2c_dt_spec *i2c, stk8ba58_hl_active_t *val) |
Polarity active-high/-low selection on interrupt pad. | |
int32_t | stk8ba58_int_notification_set (const struct i2c_dt_spec *i2c, stk8ba58_intlatch_t val) |
Latched/pulsed interrupt. | |
int32_t | stk8ba58_int_notification_get (const struct i2c_dt_spec *i2c, stk8ba58_intlatch_t *val) |
Latched/pulsed interrupt. | |
int32_t | stk8ba58_pin_int1_route_set (const struct i2c_dt_spec *i2c, stk8ba58_pin_int1_route_t val) |
Select the signal that need to route on int1 pad. | |
int32_t | stk8ba58_pin_int1_route_get (const struct i2c_dt_spec *i2c, stk8ba58_pin_int1_route_t *val) |
Select the signal that need to route on int1 pad. | |
int32_t | stk8ba58_int_enable_set (const struct i2c_dt_spec *i2c, stk8ba58_int_enable_t val) |
Enable the source that need to trigger interrupt. | |
int32_t | stk8ba58_int_enable_get (const struct i2c_dt_spec *i2c, stk8ba58_int_enable_t *val) |
Enable the source that need to trigger interrupt. | |
I2C-Bus Access Interface for an STK8BA58.