modm API documentation
|
#include <modm/driver/inertial/adis16470.hpp>
Public Typedefs | |
using | SyncFunction_t = Configuration< MscCtrl_t, SyncFunction, 0b111, 2 > |
Public Types | |
enum | Register : uint8_t { DIAG_STAT = 0x02, X_GYRO_LOW = 0x04, X_GYRO_OUT = 0x06, Y_GYRO_LOW = 0x08, Y_GYRO_OUT = 0x0A, Z_GYRO_LOW = 0x0C, Z_GYRO_OUT = 0x0E, X_ACCL_LOW = 0x10, X_ACCL_OUT = 0x12, Y_ACCL_LOW = 0x14, Y_ACCL_OUT = 0x16, Z_ACCL_LOW = 0x18, Z_ACCL_OUT = 0x1A, TEMP_OUT = 0x1C, TIME_STAMP = 0x1E, DATA_CNTR = 0x22, X_DELTANG_LOW = 0x24, X_DELTANG_OUT = 0x26, Y_DELTANG_LOW = 0x28, Y_DELTANG_OUT = 0x2A, Z_DELTANG_LOW = 0x2C, Z_DELTANG_OUT = 0x2E, X_DELTVEL_LOW = 0x30, X_DELTVEL_OUT = 0x32, Y_DELTVEL_LOW = 0x34, Y_DELTVEL_OUT = 0x36, Z_DELTVEL_LOW = 0x38, Z_DELTVEL_OUT = 0x3A, XG_BIAS_LOW = 0x40, XG_BIAS_HIGH = 0x42, YG_BIAS_LOW = 0x44, YG_BIAS_HIGH = 0x46, ZG_BIAS_LOW = 0x48, ZG_BIAS_HIGH = 0x4A, XA_BIAS_LOW = 0x4C, XA_BIAS_HIGH = 0x4E, YA_BIAS_LOW = 0x50, YA_BIAS_HIGH = 0x52, ZA_BIAS_LOW = 0x54, ZA_BIAS_HIGH = 0x56, FILT_CTRL = 0x5C, MSC_CTRL = 0x60, UP_SCALE = 0x62, DEC_RATE = 0x64, NULL_CNFG = 0x66, GLOB_CMD = 0x68, FIRM_REV = 0x6C, FIRM_DM = 0x6E, FIRM_Y = 0x70, PROD_ID = 0x72, SERIAL_NUM = 0x74, USER_SCR1 = 0x76, USER_SCR2 = 0x78, USER_SCR3 = 0x7A, FLSHCNT_LOW = 0x7C, FLSHCNT_HIGH = 0x7E } |
Available registers. | |
enum | AccessMethod : uint8_t { Read = 0b01, Write = 0b10, ReadWrite = 0b11 } |
enum | DiagStat : uint16_t { DiagStat::ClockError = Bit7, DiagStat::MemoryFailure = Bit6, DiagStat::SensorFailure = Bit5, DiagStat::StandbyMode = Bit4, DiagStat::SpiCommunicationError = Bit3, DiagStat::FlashUpdateFailure = Bit2, DiagStat::DataPathOverrun = Bit1 } |
enum | MscCtrl : uint16_t { MscCtrl::LinearGCompensationGyro = Bit7, MscCtrl::PointOfPercussionAlign = Bit6, MscCtrl::SyncFunction2 = Bit4, MscCtrl::SyncFunction1 = Bit3, MscCtrl::SyncFunction0 = Bit2, MscCtrl::SyncPolarity = Bit1, MscCtrl::DrPolarity = Bit0 } |
enum | SyncFunction : uint16_t { PulseSync = 0b101, OutputSync = 0b011, ScaledSync = 0b010, DirectSync = 0b001, SyncFunction::InternalClock = 0b000 } |
enum | GlobCmd : uint16_t { GlobCmd::SoftwareReset = Bit7, GlobCmd::FlashMemoryTest = Bit4, GlobCmd::FlashMemoryUpdate = Bit3, GlobCmd::SensorSelfTest = Bit2, GlobCmd::FactoryCalibrationRestore = Bit1, GlobCmd::BiasCorrectionUpdate = Bit0 } |
Public Member Functions | |
constexpr AccessMethod | getRegisterAccess (Register r) |
Get the allowed register access modes for a given Register. | |
MODM_FLAGS16 (DiagStat) | |
MODM_FLAGS16 (MscCtrl) | |
MODM_FLAGS16 (GlobCmd) | |
modm::ResumableResult< void > | initialize () |
Initialize. More... | |
modm::ResumableResult< std::optional< uint16_t > > | readRegister (Register reg) |
Read a single register. More... | |
modm::ResumableResult< modm::adis16470::DiagStat_t > | readDiagStat () |
Read the DIAG_STAT register. More... | |
modm::ResumableResult< modm::adis16470::MscCtrl_t > | readMscCtrl () |
Read the MSC_CTRL register. More... | |
modm::ResumableResult< bool > | writeRegister (Register reg, uint16_t value) |
Write a single register. More... | |
modm::ResumableResult< void > | writeMscCtrl (modm::adis16470::MscCtrl_t value) |
Write the MSC_CTRL register. More... | |
modm::ResumableResult< void > | writeGlobCmd (modm::adis16470::GlobCmd_t value) |
Write the MSC_CTRL register. More... | |
template<frequency_t frequency, percent_t tolerance = pct(1)> | |
modm::ResumableResult< void > | setDataOutputFrequency () |
Set the desired data output frequency from 1Hz to 2kHz. More... | |
modm::ResumableResult< bool > | readRegisterSequence (std::span< const Register > sequence, std::span< uint16_t > values) |
Read a sequence of registers. Improves SPI usage efficiency by 100% compared to accessRegister(...) . More... | |
modm::ResumableResult< bool > | readRegisterBurst (std::array< uint16_t, 11 > &data) |
Read all output data registers using burst mode. More... | |
void | attachConfigurationHandler (Spi::ConfigurationHandler handler) |
Protected Member Functions | |
bool | acquireMaster () |
bool | releaseMaster () |
int8_t | getResumableDepth () const |
bool | isResumableRunning () const |
void | stopResumable () |
|
strong |
Status/Error Flag Indicators DIAG_STAT register (address 0x02, 0x03) reset value is 0x0000
|
strong |
Global Commands GLOB_CMD register (address 0x68, 0x69) is write only
|
strong |
Miscellaneous Control Register MSC_CTRL register (address 0x60, 0x61) reset value is 0x00C1
|
strong |
modm::ResumableResult<void> modm::adis16470< SpiMaster, Cs >::initialize | ( | ) |
modm::ResumableResult<modm::adis16470::DiagStat_t> modm::adis16470< SpiMaster, Cs >::readDiagStat | ( | ) |
Read the DIAG_STAT register.
modm::ResumableResult<modm::adis16470::MscCtrl_t> modm::adis16470< SpiMaster, Cs >::readMscCtrl | ( | ) |
Read the MSC_CTRL register.
modm::ResumableResult<std::optional<uint16_t> > modm::adis16470< SpiMaster, Cs >::readRegister | ( | Register | reg | ) |
Read a single register.
reg | The register to be read |
modm::ResumableResult<bool> modm::adis16470< SpiMaster, Cs >::readRegisterBurst | ( | std::array< uint16_t, 11 > & | data | ) |
Read all output data registers using burst mode.
In all clock modes, except when operating in scaled sync mode (Register MSC_CTRL, Bits[4:2] = 010), the burst read response includes the following registers and checksum value: DIAG_STAT, X_GYRO_OUT, Y_GYRO_OUT, Z_GYRO_OUT, X_ACCL_OUT, Y_ACCL_OUT, Z_ACCL_OUT, TEMP_OUT, DATA_CNTR, and checksum.
When operating in scaled sync mode (Register MSC_CTRL, Bits[4:2] = 010), the burst read response includes the following registers and value: DIAG_STAT, X_GYRO_OUT, Y_GYRO_OUT, Z_GYRO_OUT, X_ACCL_OUT, Y_ACCL_OUT, Z_ACCL_OUT, TEMP_OUT, TIME_STMP, and checksum.
This is useful with DMA accelerated SPI to retrieve the measurement data, because it only triggers a single SPI transfer.
data | Reference to a array of 11 uint16_t entries, the read register values are written here. data[0] is empty and the last entry (data[10]) contains a checksum which has already been checked by this driver. |
modm::ResumableResult<bool> modm::adis16470< SpiMaster, Cs >::readRegisterSequence | ( | std::span< const Register > | sequence, |
std::span< uint16_t > | values | ||
) |
Read a sequence of registers. Improves SPI usage efficiency by 100% compared to accessRegister(...)
.
sequence | All registers in the std::span will be read and the results will be stored in values. |
values | Results of the read operations |
modm::ResumableResult<void> modm::adis16470< SpiMaster, Cs >::setDataOutputFrequency | ( | ) |
Set the desired data output frequency from 1Hz to 2kHz.
frequency | desired frequency |
tolerance | acceptable tolerance, default 1% |
modm::ResumableResult<void> modm::adis16470< SpiMaster, Cs >::writeGlobCmd | ( | modm::adis16470< SpiMaster, Cs >::GlobCmd_t | value | ) |
Write the MSC_CTRL register.
value | The value to be written to the MSC_CTRL register. |
modm::ResumableResult<void> modm::adis16470< SpiMaster, Cs >::writeMscCtrl | ( | modm::adis16470< SpiMaster, Cs >::MscCtrl_t | value | ) |
Write the MSC_CTRL register.
value | The value to be written to the MSC_CTRL register. |
modm::ResumableResult<bool> modm::adis16470< SpiMaster, Cs >::writeRegister | ( | Register | reg, |
uint16_t | value | ||
) |
Write a single register.
reg | The register to be written |
value | The value to be written to the register. |