Bridle API 4.1.99
A Zephyr based application framework
Loading...
Searching...
No Matches

This file provides a set of functions needed to drive the STK8BA58 simplified inertial module. More...

Modules

 Common Functions
 This section groups common useful functions.
 
 Data generation
 This section groups all the functions concerning data generation.
 
 Data output
 This section groups all the data output functions.
 
 Endianness definitions
 The endianness of the STK8BA58 registers depends on the definition selected by the chosen architecture:
 
 Infos
 This section provide a set of default and identification values.
 
 Interfaces Functions
 This section provide a set of functions used to read and write a generic register of the device.
 
 Sensitivity
 These functions convert raw-data into engineering units.
 
 Serial Interface
 This section groups all the functions concerning main serial interface management (not auxiliary)
 

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_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.
 

Enumerations

enum  stk8ba58_range_t { STK8BA58_2g = 0b0011 , STK8BA58_4g = 0b0101 , STK8BA58_8g = 0b1000 }
 Values for acceleration sensing range. More...
 
enum  stk8ba58_bw_t {
  STK8BA58_XL_BW_7Hz81 = 0b01000 , STK8BA58_XL_BW_15Hz63 = 0b01001 , STK8BA58_XL_BW_31Hz25 = 0b01010 , STK8BA58_XL_BW_62Hz5 = 0b01011 ,
  STK8BA58_XL_BW_125Hz = 0b01100 , STK8BA58_XL_BW_250Hz = 0b01101 , STK8BA58_XL_BW_500Hz = 0b01110 , STK8BA58_XL_BW_1000Hz = 0b01111 ,
  STK8BA58_XL_BW_PWRUP = 0b11111
}
 Values for output data bandwidth selection. More...
 
enum  stk8ba58_ds_t { STK8BA58_XL_DS_FILTERED = 0 , STK8BA58_XL_DS_UNFILTERED = 1 }
 
enum  stk8ba58_sleepdur_t {
  STK8BA58_XL_LP_0ms5 = 0b0101 , STK8BA58_XL_LP_1ms = 0b0110 , STK8BA58_XL_LP_2ms = 0b0111 , STK8BA58_XL_LP_4ms = 0b1000 ,
  STK8BA58_XL_LP_6ms = 0b1001 , STK8BA58_XL_LP_10ms = 0b1010 , STK8BA58_XL_LP_25ms = 0b1011 , STK8BA58_XL_LP_50ms = 0b1100 ,
  STK8BA58_XL_LP_100ms = 0b1101 , STK8BA58_XL_LP_500ms = 0b1110 , STK8BA58_XL_LP_1000ms = 0b1111
}
 Values for power mode selection and the sleep time duration setting. More...
 
enum  stk8ba58_pm_t { STK8BA58_XL_PM_NORMAL = 0 , STK8BA58_XL_PM_LOWPOWER = 1 , STK8BA58_XL_PM_SUSPEND = 2 }
 Values for output data filter and protection function. More...
 
enum  stk8ba58_pp_od_t { STK8BA58_PUSH_PULL = 0 , STK8BA58_OPEN_DRAIN = 1 }
 Values for INT1 pin output type. More...
 
enum  stk8ba58_hl_active_t { STK8BA58_ACTIVE_LOW = 0 , STK8BA58_ACTIVE_HIGH = 1 }
 Values for INT1 pin output active level. More...
 
enum  stk8ba58_intlatch_t {
  STK8BA58_INT_PULSED = 0b0000 , STK8BA58_INT_250ms = 0b0001 , STK8BA58_INT_500ms = 0b0010 , STK8BA58_INT_1000ms = 0b0011 ,
  STK8BA58_INT_2000ms = 0b0100 , STK8BA58_INT_4000ms = 0b0101 , STK8BA58_INT_8000ms = 0b0110 , STK8BA58_INT_LATCHEDALT = 0b0111 ,
  STK8BA58_INT_PULSEDALT = 0b1000 , STK8BA58_INT_0ms250 = 0b1001 , STK8BA58_INT_0ms500 = 0b1010 , STK8BA58_INT_1ms = 0b1011 ,
  STK8BA58_INT_12ms5 = 0b1100 , STK8BA58_INT_25ms = 0b1101 , STK8BA58_INT_50ms = 0b1110 , STK8BA58_INT_LATCHED = 0b1111
}
 Values for INT1 pin mode and latched hold-time. More...
 

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.
 

Detailed Description

This file provides a set of functions needed to drive the STK8BA58 simplified inertial module.

The values for the defines below as well as the register definitions were taken from the datasheet revision 1.0, which can be found at: https://datasheet4u.com/pdf-down/S/T/K/STK8BA58-Sensortek.pdf.

Since
4.1
Version
1.0.0

I2C chip register access for the Sensortek Technology STK8BA58 3-axis accelerometer. Data sheet can be found here: https://datasheet4u.com/pdf-down/S/T/K/STK8BA58-Sensortek.pdf

Macro Definition Documentation

◆ STK8BA58_BWSEL

#define STK8BA58_BWSEL   0x10U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for output data bandwidth selection.

◆ STK8BA58_CHIP_ID

#define STK8BA58_CHIP_ID   0x00U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for device identification (CHIP ID).

◆ STK8BA58_DATASETUP

#define STK8BA58_DATASETUP   0x13U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for output data filter and protection function.

◆ STK8BA58_EVENTINFO1

#define STK8BA58_EVENTINFO1   0x0BU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for any-motion (slope) detection information.

◆ STK8BA58_I2C_WRITE_BUFFER_SIZE

#define STK8BA58_I2C_WRITE_BUFFER_SIZE   (16U)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

The size of the buffer pushed on the stack used to copy the data to be written along with the register address.

◆ STK8BA58_INTCFG1

#define STK8BA58_INTCFG1   0x20U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for INT1 pin output type and active level.

◆ STK8BA58_INTCFG2

#define STK8BA58_INTCFG2   0x21U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for INT1 pin mode and latched hold-time.

◆ STK8BA58_INTEN1

#define STK8BA58_INTEN1   0x16U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for motion detection interrupts enable.

◆ STK8BA58_INTEN2

#define STK8BA58_INTEN2   0x17U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for new data interrupt enable.

◆ STK8BA58_INTFCFG

#define STK8BA58_INTFCFG   0x34U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for digital interface parameters of the I2C interface.

◆ STK8BA58_INTMAP1

#define STK8BA58_INTMAP1   0x19U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for motion detection interrupts mapping to INT1 pin.

◆ STK8BA58_INTMAP2

#define STK8BA58_INTMAP2   0x1AU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for new data interrupt mapping to INT1 pin.

◆ STK8BA58_INTSTS1

#define STK8BA58_INTSTS1   0x09U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for motion detection interrupts status.

◆ STK8BA58_INTSTS2

#define STK8BA58_INTSTS2   0x0AU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for new data interrupt status.

◆ STK8BA58_OFSTCOMP1

#define STK8BA58_OFSTCOMP1   0x36U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for settings of the offset compensation.

◆ STK8BA58_OFSTX

#define STK8BA58_OFSTX   0x38U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for x-axis offset compensation value.

◆ STK8BA58_OFSTY

#define STK8BA58_OFSTY   0x39U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for y-axis offset compensation value.

◆ STK8BA58_OFSTZ

#define STK8BA58_OFSTZ   0x3AU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for z-axis offset compensation value.

◆ STK8BA58_POWMODE

#define STK8BA58_POWMODE   0x11U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for power mode selection and the sleep time duration setting.

◆ STK8BA58_RANGESEL

#define STK8BA58_RANGESEL   0x0FU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for acceleration sensing range.

◆ STK8BA58_SIGMOT1

#define STK8BA58_SIGMOT1   0x29U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for skip time (LSB) of the significant motion.

◆ STK8BA58_SIGMOT2

#define STK8BA58_SIGMOT2   0x2AU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for skip time (MSB) of the significant motion, interrupt enable.

◆ STK8BA58_SIGMOT3

#define STK8BA58_SIGMOT3   0x2BU

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for proof time of the significant motion.

◆ STK8BA58_SLOPEDLY

#define STK8BA58_SLOPEDLY   0x27U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for number of samples in the slope detection.

◆ STK8BA58_SLOPETHD

#define STK8BA58_SLOPETHD   0x28U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for threshold value of the slope detection.

◆ STK8BA58_SWRST

#define STK8BA58_SWRST   0x14U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for device software reset.

◆ STK8BA58_XOUT1

#define STK8BA58_XOUT1   0x02U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for x-axis acceleration data (LSB) and the new data flag.

◆ STK8BA58_XOUT2

#define STK8BA58_XOUT2   0x03U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for x-axis acceleration data (MSB).

◆ STK8BA58_YOUT1

#define STK8BA58_YOUT1   0x04U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for y-axis acceleration data (LSB) and the new data flag.

◆ STK8BA58_YOUT2

#define STK8BA58_YOUT2   0x05U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for y-axis acceleration data (MSB).

◆ STK8BA58_ZOUT1

#define STK8BA58_ZOUT1   0x06U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for z-axis acceleration data (LSB) and the new data flag.

◆ STK8BA58_ZOUT2

#define STK8BA58_ZOUT2   0x07U

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Address for z-axis acceleration data (MSB).

Enumeration Type Documentation

◆ stk8ba58_bw_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for output data bandwidth selection.

Enumerator
STK8BA58_XL_BW_7Hz81 
STK8BA58_XL_BW_15Hz63 
STK8BA58_XL_BW_31Hz25 
STK8BA58_XL_BW_62Hz5 
STK8BA58_XL_BW_125Hz 
STK8BA58_XL_BW_250Hz 
STK8BA58_XL_BW_500Hz 
STK8BA58_XL_BW_1000Hz 
STK8BA58_XL_BW_PWRUP 

◆ stk8ba58_ds_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Enumerator
STK8BA58_XL_DS_FILTERED 
STK8BA58_XL_DS_UNFILTERED 

◆ stk8ba58_hl_active_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for INT1 pin output active level.

Enumerator
STK8BA58_ACTIVE_LOW 
STK8BA58_ACTIVE_HIGH 

◆ stk8ba58_intlatch_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for INT1 pin mode and latched hold-time.

Enumerator
STK8BA58_INT_PULSED 
STK8BA58_INT_250ms 
STK8BA58_INT_500ms 
STK8BA58_INT_1000ms 
STK8BA58_INT_2000ms 
STK8BA58_INT_4000ms 
STK8BA58_INT_8000ms 
STK8BA58_INT_LATCHEDALT 
STK8BA58_INT_PULSEDALT 
STK8BA58_INT_0ms250 
STK8BA58_INT_0ms500 
STK8BA58_INT_1ms 
STK8BA58_INT_12ms5 
STK8BA58_INT_25ms 
STK8BA58_INT_50ms 
STK8BA58_INT_LATCHED 

◆ stk8ba58_pm_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for output data filter and protection function.

Enumerator
STK8BA58_XL_PM_NORMAL 
STK8BA58_XL_PM_LOWPOWER 
STK8BA58_XL_PM_SUSPEND 

◆ stk8ba58_pp_od_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for INT1 pin output type.

Enumerator
STK8BA58_PUSH_PULL 
STK8BA58_OPEN_DRAIN 

◆ stk8ba58_range_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for acceleration sensing range.

Enumerator
STK8BA58_2g 
STK8BA58_4g 
STK8BA58_8g 

◆ stk8ba58_sleepdur_t

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Values for power mode selection and the sleep time duration setting.

Enumerator
STK8BA58_XL_LP_0ms5 
STK8BA58_XL_LP_1ms 
STK8BA58_XL_LP_2ms 
STK8BA58_XL_LP_4ms 
STK8BA58_XL_LP_6ms 
STK8BA58_XL_LP_10ms 
STK8BA58_XL_LP_25ms 
STK8BA58_XL_LP_50ms 
STK8BA58_XL_LP_100ms 
STK8BA58_XL_LP_500ms 
STK8BA58_XL_LP_1000ms 

Function Documentation

◆ stk8ba58_acceleration_raw_get()

int32_t stk8ba58_acceleration_raw_get ( const struct i2c_dt_spec *  i2c,
int16_t *  buff 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Linear acceleration output register.

The value is expressed as a 16-bit word in two’s complement.[get]

Parameters
i2cRead / write interface definitions.(ptr)
buffBuffer that stores data read.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_all_sources_get()

int32_t stk8ba58_all_sources_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_all_sources_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Read all the interrupt/status flag of the device.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet INTSTS1, INTSTS2, EVENTINFO1.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_device_id_get()

int32_t stk8ba58_device_id_get ( const struct i2c_dt_spec *  i2c,
uint8_t *  buff 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

DeviceChipID.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
buffBuffer that stores data read.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_from_fs2g_to_mg()

float_t stk8ba58_from_fs2g_to_mg ( int16_t  lsb)

◆ stk8ba58_from_fs4g_to_mg()

float_t stk8ba58_from_fs4g_to_mg ( int16_t  lsb)

◆ stk8ba58_from_fs8g_to_mg()

float_t stk8ba58_from_fs8g_to_mg ( int16_t  lsb)

◆ stk8ba58_int_enable_get()

int32_t stk8ba58_int_enable_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_int_enable_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Enable the source that need to trigger interrupt.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet union of registers from INTEN1 to INTEN2.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_int_enable_set()

int32_t stk8ba58_int_enable_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_int_enable_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Enable the source that need to trigger interrupt.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valChange union of registers from INTEN1 to INTEN2.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_int_notification_get()

int32_t stk8ba58_int_notification_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_intlatch_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Latched/pulsed interrupt.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet the values of int-latch in reg INTCFG2.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_int_notification_set()

int32_t stk8ba58_int_notification_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_intlatch_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Latched/pulsed interrupt.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the values of int-latch in reg INTCFG2.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_pin_int1_mode_get()

int32_t stk8ba58_pin_int1_mode_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_pp_od_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Push-pull/open-drain selection on interrupt pad.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet the values of int1_od in reg INTCFG1.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_pin_int1_mode_set()

int32_t stk8ba58_pin_int1_mode_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_pp_od_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Push-pull/open-drain selection on interrupt pad.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the values of int1_od in reg INTCFG1.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_pin_int1_polarity_get()

int32_t stk8ba58_pin_int1_polarity_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_hl_active_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Polarity active-high/-low selection on interrupt pad.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet the values of int1_lv in reg INTCFG1.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_pin_int1_polarity_set()

int32_t stk8ba58_pin_int1_polarity_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_hl_active_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Polarity active-high/-low selection on interrupt pad.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the values of int1_lv in reg INTCFG1.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_pin_int1_route_get()

int32_t stk8ba58_pin_int1_route_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_pin_int1_route_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Select the signal that need to route on int1 pad.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet union of registers from INTMAP1 to INTMAP2.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_pin_int1_route_set()

int32_t stk8ba58_pin_int1_route_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_pin_int1_route_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Select the signal that need to route on int1 pad.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange union of registers from INTMAP1 to INTMAP2.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_read_reg()

int32_t stk8ba58_read_reg ( const struct i2c_dt_spec *  i2c,
uint8_t  reg,
uint8_t *  data,
uint16_t  len 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Read generic device register.

Parameters
i2cRead / write interface definitions.(ptr)
regRegister to read.
dataPointer to buffer that store the data read.(ptr)
lenNumber of consecutive register to read.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_reset_set()

int32_t stk8ba58_reset_set ( const struct i2c_dt_spec *  i2c,
uint8_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Software reset.

Restore the default values in user registers.[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the value with soft-reset in reg SWRST.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_write_reg()

int32_t stk8ba58_write_reg ( const struct i2c_dt_spec *  i2c,
uint8_t  reg,
uint8_t *  data,
uint16_t  len 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Write generic device register.

Parameters
i2cRead / write interface definitions.(ptr)
regRegister to write.
dataPointer to data to write in register reg.(ptr)
lenNumber of consecutive register to write.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_xl_bandwidth_get()

int32_t stk8ba58_xl_bandwidth_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_bw_t val,
stk8ba58_ds_t sel 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Accelerometer bandwidth selection.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet the values of bw in reg BWSEL.(ptr)
selGet the values of data-sel in reg DATASETUP.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_xl_bandwidth_set()

int32_t stk8ba58_xl_bandwidth_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_bw_t  val,
stk8ba58_ds_t  sel 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Accelerometer bandwidth selection.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the values of bw in reg BWSEL.
selChange the values of data-sel in reg DATASETUP.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_xl_power_mode_get()

int32_t stk8ba58_xl_power_mode_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_sleepdur_t val,
stk8ba58_pm_t sel 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Accelerometer bandwidth selection.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet the values of sleep-dur in reg POWMODE.(ptr)
selGet the values of lowpower / suspend in reg POWMODE.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_xl_power_mode_set()

int32_t stk8ba58_xl_power_mode_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_sleepdur_t  val,
stk8ba58_pm_t  sel 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Accelerometer power mode selection.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the values of sleep-dur in reg POWMODE.
selChange the values of lowpower / suspend in reg POWMODE.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_xl_range_get()

int32_t stk8ba58_xl_range_get ( const struct i2c_dt_spec *  i2c,
stk8ba58_range_t val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Accelerometer range selection.

[get]

Parameters
i2cRead / write interface definitions.(ptr)
valGet the values of range in reg RANGESEL.(ptr)
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).

◆ stk8ba58_xl_range_set()

int32_t stk8ba58_xl_range_set ( const struct i2c_dt_spec *  i2c,
stk8ba58_range_t  val 
)

#include <drivers/sensor/sensortek/stk8ba58/stk8ba58_reg.h>

Accelerometer range selection.

[set]

Parameters
i2cRead / write interface definitions.(ptr)
valChange the values of range in reg RANGESEL.
Return values
Interfacestatus (MANDATORY: return 0 -> no Error).