237 int16_t tempVal[3] = {0};
265 int16_t tempVal[3] = {0};
294 int16_t tempVal[3] = {0};
344 int16_t tempVal[3] = {0};
488 if ((all & 0x02U) == 0)
494 out->axisZ = (wus & 0x01U) != 0;
495 out->axisY = (wus & 0x02U) != 0;
496 out->axisX = (wus & 0x04U) != 0;
501 bool routeAccelGyroDrdyToInt1)
503 if (wkThreshold == 0)
505 if (wkThreshold > 63)
521 if (!routeAccelGyroDrdyToInt1) {
560 uint8_t buf[2] = {0};
562 return (uint16_t)buf[0] | (((uint16_t)(buf[1] & 0x03)) << 8);
581 uint8_t buf[7] = {0};
590 dst->
xData = (int16_t)(buf[1] | ((uint16_t)buf[2] << 8));
591 dst->
yData = (int16_t)(buf[3] | ((uint16_t)buf[4] << 8));
592 dst->
zData = (int16_t)(buf[5] | ((uint16_t)buf[6] << 8));
627 double ax = 0, ay = 0, az = 0;
628 double gx = 0, gy = 0, gz = 0;
631 for (uint16_t i = 0; i < samples; ++i) {
634 ax +=
a.xData; ay +=
a.yData; az +=
a.zData;
635 gx +=
g.xData; gy +=
g.yData; gz +=
g.zData;
752 if( (tempVal & 0x01) == 0x00 ){
1486 if( numSensors > 3 )
1793 if( (tempVal.
xlda == 1) && (tempVal.
gda == 1) )
1813 if( tempVal.
xlda == 1 )
1833 if( tempVal.
gda == 1 )
1853 if( tempVal.
tda == 1 )
static void enable(board_bringup_t *b, uint16_t device_id)
static const board_spi_route_t * route(board_spi_device_t device)
bool readPeripheralSensor(uint8_t *shReg, uint8_t len)
bool getRawAccel(sfe_ism_raw_data_t *accelData)
bool getGyroCal(sfe_ism_data_t *gyroData)
bool enableTimestamp(bool enable=true)
bool setGyroStatustoInt2(bool enable=true)
float convert2000dpsToMdps(int16_t data)
float convert4000dpsToMdps(int16_t data)
float convert1000dpsToMdps(int16_t data)
uint8_t getBlockDataUpdate()
float convert500dpsToMdps(int16_t data)
bool configureWakeUpOnInt1(uint8_t wkThreshold, uint8_t wakeDur, bool routeAccelGyroDrdyToInt1=false)
bool readMMCMagnetometer(uint8_t *magData, uint8_t len)
bool setNumberHubSensors(uint8_t numSensors)
bool setDeviceConfig(bool enable=true)
float convertToCelsius(int16_t data)
bool setHubWriteMode(uint8_t config)
bool setHubPullUps(bool enable=true)
float convert16gToMg(int16_t data)
bool getExternalSensorNack(uint8_t sensor)
bool setDataReadyMode(uint8_t val)
bool setHubPassThrough(bool enable=true)
bool setIntNotification(uint8_t val)
float convert4gToMg(int16_t data)
int32_t writeRegisterRegion(uint8_t reg, uint8_t *data, uint16_t length)
bool setHubSensorRead(uint8_t sensor, sfe_hub_sensor_settings_t *settings)
bool setFifoTimestampDec(uint8_t val)
bool setPinMode(bool activeLow=true)
bool setGyroFifoBatchSet(uint8_t val)
bool getAccel(sfe_ism_data_t *accelData)
bool setAccelSelfTest(uint8_t val)
bool setGyroStatustoInt1(bool enable=true)
bool setHubFifoBatching(bool enable=true)
bool setFifoWtmToInt2(bool enable=true)
bool setAccelFullScale(uint8_t val)
bool setGyroSelfTest(uint8_t val)
bool readFifoSample(sfe_ism_raw_data_t *gyro, sfe_ism_raw_data_t *accel, uint8_t *tag_out=nullptr)
bool setFifoWatermark(uint16_t val)
sfe_ism_data_t _accelBias
bool getRawGyro(sfe_ism_raw_data_t *gyroData)
bool setGyroLP1Bandwidth(uint8_t val)
bool setAccelFilterLP2(bool enable=true)
bool setAccelStatustoInt1(bool enable=true)
bool setAccelSlopeFilter(uint8_t val)
float convert125dpsToMdps(int16_t data)
float convert250dpsToMdps(int16_t data)
bool setHubSensorWrite(sfe_hub_sensor_settings_t *settings)
bool setAccelStatustoInt2(bool enable=true)
sfe_ISM330DHCX::QwIDeviceBus * _sfeBus
bool getAccelCal(sfe_ism_data_t *accelData)
int32_t readRegisterRegion(uint8_t reg, uint8_t *data, uint16_t length)
float convert2gToMg(int16_t data)
bool calibrateBiases(uint16_t samples=256)
bool setGyroFilterLP1(bool enable=true)
bool setAccelFifoBatchSet(uint8_t val)
bool setAccelDataRate(uint8_t rate)
float convert8gToMg(int16_t data)
uint8_t getAccelFullScale()
bool setGyroFullScale(uint8_t val)
bool getGyro(sfe_ism_data_t *gyroData)
bool setGyroDataRate(uint8_t rate)
bool setBlockDataUpdate(bool enable=true)
bool setHubODR(uint8_t rate)
void setCommunicationBus(sfe_ISM330DHCX::QwIDeviceBus &theBus, uint8_t i2cAddress)
bool enableSensorI2C(bool enable)
bool setFifoMode(uint8_t val)
bool serviceWakeUpInterrupt(sfe_ism330_wake_event_t *out)
static sfe_ism_data_t gyroData
static sfe_ism_data_t accelData
int32_t ism330dhcx_angular_rate_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Angular rate sensor.
int32_t ism330dhcx_temperature_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Temperature data output register (r).
int32_t ism330dhcx_acceleration_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Linear acceleration output register.
float ism330dhcx_from_fs8g_to_mg(int16_t lsb)
float ism330dhcx_from_fs4000dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs2g_to_mg(int16_t lsb)
float ism330dhcx_from_fs4g_to_mg(int16_t lsb)
float ism330dhcx_from_lsb_to_celsius(int16_t lsb)
float ism330dhcx_from_fs250dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs125dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs2000dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs500dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs1000dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs16g_to_mg(int16_t lsb)
int32_t ism330dhcx_sh_status_get(stmdev_ctx_t *ctx, ism330dhcx_status_master_t *val)
Sensor hub source register.
int32_t ism330dhcx_sh_slv2_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 2 for perform a write/read.
int32_t ism330dhcx_sh_pin_mode_set(stmdev_ctx_t *ctx, ism330dhcx_shub_pu_en_t val)
Master I2C pull-up enable.
int32_t ism330dhcx_sh_pass_through_set(stmdev_ctx_t *ctx, uint8_t val)
I2C interface pass-through.
int32_t ism330dhcx_sh_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_shub_odr_t val)
Rate at which the master communicates.
int32_t ism330dhcx_sh_slv1_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 0 for perform a write/read.
int32_t ism330dhcx_sh_master_set(stmdev_ctx_t *ctx, uint8_t val)
Sensor hub I2C master enable.
int32_t ism330dhcx_sh_reset_set(stmdev_ctx_t *ctx)
Reset Master logic and output registers.
int32_t ism330dhcx_sh_slv0_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 0 for perform a write/read.
int32_t ism330dhcx_sh_write_mode_set(stmdev_ctx_t *ctx, ism330dhcx_write_once_t val)
Slave 0 write operation is performed only at the first sensor hub cycle.
int32_t ism330dhcx_sh_slave_connected_set(stmdev_ctx_t *ctx, ism330dhcx_aux_sens_on_t val)
Number of external sensors to be read by the sensor hub.
int32_t ism330dhcx_sh_slv3_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 3 for perform a write/read.
int32_t ism330dhcx_sh_cfg_write(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_write_t *val)
Configure slave 0 for perform a write.
int32_t ism330dhcx_sh_read_data_raw_get(stmdev_ctx_t *ctx, ism330dhcx_emb_sh_read_t *val, uint8_t len)
Sensor hub output registers.
int32_t ism330dhcx_timestamp_set(stmdev_ctx_t *ctx, uint8_t val)
Enables timestamp counter.
int32_t ism330dhcx_timestamp_rst(stmdev_ctx_t *ctx)
Reset timestamp counter.
int32_t ism330dhcx_wkup_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in WAKE_UP_DUR.
int32_t ism330dhcx_wkup_ths_weight_set(stmdev_ctx_t *ctx, ism330dhcx_wake_ths_w_t val)
Weight of 1 LSB of wakeup threshold.
int32_t ism330dhcx_wkup_dur_set(stmdev_ctx_t *ctx, uint8_t val)
Wake up duration event(1LSb = 1 / ODR).
int32_t ism330dhcx_device_id_get(stmdev_ctx_t *ctx, uint8_t *buff)
Device Who am I.
int32_t ism330dhcx_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
Software reset.
int32_t ism330dhcx_gy_self_test_set(stmdev_ctx_t *ctx, ism330dhcx_st_g_t val)
Angular rate sensor self-test enable.
int32_t ism330dhcx_data_ready_mode_set(stmdev_ctx_t *ctx, ism330dhcx_dataready_pulsed_t val)
Data-ready pulsed / letched mode.
int32_t ism330dhcx_reset_set(stmdev_ctx_t *ctx, uint8_t val)
Software reset.
int32_t ism330dhcx_xl_self_test_set(stmdev_ctx_t *ctx, ism330dhcx_st_xl_t val)
Linear acceleration sensor self-test enable.
int32_t ism330dhcx_device_conf_set(stmdev_ctx_t *ctx, uint8_t val)
DEVICE_CONF bit configuration[set].
int32_t ism330dhcx_fifo_xl_batch_set(stmdev_ctx_t *ctx, ism330dhcx_bdr_xl_t val)
Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.
int32_t ism330dhcx_sh_batch_slave_0_set(stmdev_ctx_t *ctx, uint8_t val)
Enable FIFO batching data of first slave.
int32_t ism330dhcx_fifo_gy_batch_set(stmdev_ctx_t *ctx, ism330dhcx_bdr_gy_t val)
Selects Batching Data Rate (writing frequency in FIFO) for gyroscope data.
int32_t ism330dhcx_fifo_watermark_set(stmdev_ctx_t *ctx, uint16_t val)
FIFO watermark level selection.
int32_t ism330dhcx_fifo_timestamp_decimation_set(stmdev_ctx_t *ctx, ism330dhcx_odr_ts_batch_t val)
Selects decimation for timestamp batching in FIFO.
int32_t ism330dhcx_fifo_mode_set(stmdev_ctx_t *ctx, ism330dhcx_fifo_mode_t val)
FIFO mode selection.
int32_t ism330dhcx_gy_filter_lp1_set(stmdev_ctx_t *ctx, uint8_t val)
Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FT...
int32_t ism330dhcx_gy_lp1_bandwidth_set(stmdev_ctx_t *ctx, ism330dhcx_ftype_t val)
Gyroscope low pass filter 1 bandwidth.
int32_t ism330dhcx_xl_hp_path_on_out_set(stmdev_ctx_t *ctx, ism330dhcx_hp_slope_xl_en_t val)
Accelerometer slope filter / high-pass filter selection on output.
int32_t ism330dhcx_xl_filter_lp2_set(stmdev_ctx_t *ctx, uint8_t val)
Accelerometer output from LPF2 filtering stage selection.
int32_t ism330dhcx_pin_int2_route_set(stmdev_ctx_t *ctx, ism330dhcx_pin_int2_route_t *val)
Select the signal that need to route on int2 pad[set].
int32_t ism330dhcx_pin_polarity_set(stmdev_ctx_t *ctx, ism330dhcx_h_lactive_t val)
Interrupt active-high/low.
int32_t ism330dhcx_pin_int1_route_get(stmdev_ctx_t *ctx, ism330dhcx_pin_int1_route_t *val)
Select the signal that need to route on int1 pad.
int32_t ism330dhcx_pin_mode_set(stmdev_ctx_t *ctx, ism330dhcx_pp_od_t val)
Push-pull/open drain selection on interrupt pads.
int32_t ism330dhcx_pin_int2_route_get(stmdev_ctx_t *ctx, ism330dhcx_pin_int2_route_t *val)
Select the signal that need to route on int2 pad.
int32_t ism330dhcx_int_notification_set(stmdev_ctx_t *ctx, ism330dhcx_lir_t val)
All interrupt signals notification mode.
int32_t ism330dhcx_pin_int1_route_set(stmdev_ctx_t *ctx, ism330dhcx_pin_int1_route_t *val)
Select the signal that need to route on int1 pad[set].
ism330dhcx_hp_slope_xl_en_t
ism330dhcx_dataready_pulsed_t
#define ISM330DHCX_WAKE_UP_SRC
#define ISM330DHCX_ID
Device Identification (Who am I).
ism330dhcx_odr_ts_batch_t
@ ISM330DHCX_LSb_FS_DIV_64
int32_t ism330dhcx_xl_full_scale_get(stmdev_ctx_t *ctx, ism330dhcx_fs_xl_t *val)
Accelerometer full-scale selection.
int32_t ism330dhcx_gy_full_scale_set(stmdev_ctx_t *ctx, ism330dhcx_fs_g_t val)
Gyroscope UI chain full-scale selection.
int32_t ism330dhcx_status_reg_get(stmdev_ctx_t *ctx, ism330dhcx_status_reg_t *val)
The STATUS_REG register is read by the primary interface.
int32_t ism330dhcx_block_data_update_get(stmdev_ctx_t *ctx, uint8_t *val)
Block data update.
int32_t ism330dhcx_xl_full_scale_set(stmdev_ctx_t *ctx, ism330dhcx_fs_xl_t val)
Accelerometer full-scale selection[set].
int32_t ism330dhcx_xl_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_odr_xl_t val)
Accelerometer UI data rate selection.
int32_t ism330dhcx_gy_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_odr_g_t val)
Gyroscope data rate.
int32_t ism330dhcx_block_data_update_set(stmdev_ctx_t *ctx, uint8_t val)
Block data update.
static const idle_config_t config
*brief create JSON pointer *sa reference_tokens const string_t & a
static constexpr uint8_t ISM_REG_FIFO_STATUS1
static constexpr uint8_t ISM_REG_ALL_INT_SRC
static constexpr uint8_t ISM_REG_FIFO_STATUS2
static constexpr uint8_t ISM_REG_FIFO_DATA_OUT_TAG
static constexpr uint8_t ISM_REG_INT2_CTRL
void initCtx(void *handle, stmdev_ctx_t *dev)
ism330dhcx_int1_ctrl_t int1_ctrl
ism330dhcx_int2_ctrl_t int2_ctrl
Filled by serviceWakeUpInterrupt() when INT1 was a wake-up (high-accel) event.