PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
LSM6DSO

ST LSM6DSO Accelerometer driver. More...

Data Structures

struct  pbl_lsm6dso_state
 LSM6DSO driver state, owned by the driver. More...
 
struct  pbl_lsm6dso
 LSM6DSO accelerometer. More...
 

Macros

#define LSM6DSO_SAMPLE_SIZE_BYTES   6
 Accelerometer sample size in bytes (X, Y, Z, 16 bits each).
 
#define LSM6DSO_FIFO_WORD_SIZE_BYTES   7
 FIFO word size in bytes as read from FIFO_DATA_OUT (tag byte plus sample).
 
#define LSM6DSO_FIFO_THRESHOLD   128
 FIFO watermark in samples (the FIFO holds up to 512).
 
#define LSM6DSO_FIFO_SIZE   LSM6DSO_FIFO_THRESHOLD
 Read buffer capacity in samples, sized to the watermark.
 
#define PBL_LSM6DSO_DEFINE(sym, _bus, _addr, ...)
 Define an LSM6DSO.
 

Detailed Description

ST LSM6DSO Accelerometer driver.


Data Structure Documentation

◆ pbl_lsm6dso_state

struct pbl_lsm6dso_state

LSM6DSO driver state, owned by the driver.

Data Fields
bool double_tap_detection_enabled Double tap detection requested.
uint32_t int1_period_ms Expected INT1 period in milliseconds.
bool int1_requeued The INT1 servicing pass was requeued while the pad stayed high.
struct pbl_wallclock_work int1_wdt_timer Watchdog timer detecting a stalled INT1 stream.
uint64_t last_fifo_read_tick Time of the last FIFO read.
uint32_t num_int1_irqs Number of INT1 interrupts taken.
uint32_t num_recoveries Number of stream recoveries performed.
uint16_t num_samples Samples per FIFO batch requested by the subscribers, 0 when not streaming.
uint8_t raw_sample_buf[PBL_DCACHE_ROUND_UP(LSM6DSO_FIFO_SIZE *LSM6DSO_FIFO_WORD_SIZE_BYTES)] Raw FIFO read buffer, filled through DMA, see PBL_I2C_MSG_DMA_SAFE.
bool recovery_pending A stream recovery is queued.
bool rotated Watch mounted rotated 180 degrees: X and Y are inverted.
uint32_t sampling_interval_us Sampling interval in microseconds, 0 when not sampling.
bool shake_detection_enabled Shake detection requested.
uint8_t shake_stuck_passes Consecutive watchdog passes with INT1 stuck high in shake-only mode.
uint8_t wk_ths_curr Current wake-up (shake) threshold register value.
bool wu_active Wake-up condition currently asserted, to report a shake once per assertion.

◆ pbl_lsm6dso

struct pbl_lsm6dso

LSM6DSO accelerometer.

Data Fields
struct pbl_accel accel Accelerometer, child of the I2C bus.
int8_t axis_dir[3] Direction of each watch axis: 1 or -1.
uint8_t axis_map[3] Sensor axis feeding each watch axis (0: X, 1: Y, 2: Z).
struct pbl_i2c_dev i2c I2C device.
struct pbl_irq_spec int1 INT1 interrupt line.
struct pbl_gpio int1_in INT1 input, to read back the pad level.
struct pbl_lsm6dso_state * state Driver state.

Macro Definition Documentation

◆ LSM6DSO_FIFO_SIZE

#define LSM6DSO_FIFO_SIZE   LSM6DSO_FIFO_THRESHOLD

Read buffer capacity in samples, sized to the watermark.

◆ LSM6DSO_FIFO_THRESHOLD

#define LSM6DSO_FIFO_THRESHOLD   128

FIFO watermark in samples (the FIFO holds up to 512).

◆ LSM6DSO_FIFO_WORD_SIZE_BYTES

#define LSM6DSO_FIFO_WORD_SIZE_BYTES   7

FIFO word size in bytes as read from FIFO_DATA_OUT (tag byte plus sample).

◆ LSM6DSO_SAMPLE_SIZE_BYTES

#define LSM6DSO_SAMPLE_SIZE_BYTES   6

Accelerometer sample size in bytes (X, Y, Z, 16 bits each).

◆ PBL_LSM6DSO_DEFINE

#define PBL_LSM6DSO_DEFINE (   sym,
  _bus,
  _addr,
  ... 
)
Value:
static struct pbl_lsm6dso_state sym##_lsm6dso_state; \
PBL_DEVICE_INSTANCE(sym, struct pbl_lsm6dso, struct pbl_accel, accel) { \
.accel = PBL_ACCEL_INIT(sym, "lsm6dso", &(_bus)->dev, &pbl_lsm6dso_ops), \
.state = &sym##_lsm6dso_state, .i2c = PBL_I2C_DEV(_bus, _addr), __VA_ARGS__, \
}
An accelerometer.
Definition accel.h:168
#define PBL_ACCEL_STATE_DEFINE(sym)
Define the class state of accelerometer sym, for the PBL_*_DEFINE() macro of a driver.
Definition accel.h:186
#define PBL_ACCEL_INIT(sym, _name, _parent, _ops)
Initializer for the struct pbl_accel of accelerometer sym.
Definition accel.h:203
#define PBL_I2C_DEV(_bus, _addr)
Initializer for a struct pbl_i2c_dev.
Definition i2c.h:136
LSM6DSO driver state, owned by the driver.
Definition lsm6dso.h:53
LSM6DSO accelerometer.
Definition lsm6dso.h:90

Define an LSM6DSO.

Only one instance is supported.

Parameters
symSymbol of the instance, a struct pbl_accel.
_busI2C bus.
_addr7-bit I2C address.
...Designated initializers of the remaining fields: int1, int1_in, axis_map and axis_dir.