![]() |
AMS Advanced Air Mobility Sensors UG
|
Classes | |
| struct | SCalibParam |
| Compensation parameters of the pressure sensors. The parameters are retrieved from the sensor's internal memory. More... | |
Public Types | |
| enum class | EIcmIds : uint8_t { eInvalid = 0 , eIcm1 , eIcm2 } |
| ICM20789 chip instances supported by the driver. More... | |
Public Member Functions | |
| void | Init () override |
| bool | IsInitialized () override |
| void | PollPressureSensor () |
| Implements an iteration of cyclic data exchange with the pressure sensor. | |
| void | PollInertialSensor () |
| Implements an iteration of cyclic data exchange with the inertial sensor. | |
| bool | RequestInertialSensorDataDma () |
| Request IMU data in DMA mode. When reception is completed, received bytes can be processed in the interrupt handler. | |
| bool | RequestPressureSensorDataDma () |
| Request pressure data in DMA mode. When reception is completed, received bytes can be processed in the interrupt handler. | |
| bool | TriggerPressureMeasurement () |
| Trigger measuring sequence of the pressure sensor. | |
| void | ParseReceivedImuDataDma () |
| Parses IMU data received in DMA mode. | |
| void | ParseReceivedPressureDataDma () |
| Parses pressure data received in DMA mode. | |
| void | InvalidateImuOutputPort () |
| void | InvalidatePressureOutputPort () |
| void | HardReset () |
| Execute a hard-reset if the ICM chip hangs. Powers down the sensor, waits, then powers on and initializes it again. The function lowers priority of the calling task for the duration of the reset procedure. In re-initialization fails, then the function will keep on re-trying. | |
Public Member Functions inherited from CSoftwareComponent< CIcm20789Driver, 2U > | |
| CSoftwareComponent (CSoftwareComponent &)=delete | |
| CSoftwareComponent (CSoftwareComponent &&)=delete | |
| CSoftwareComponent & | operator= (const CSoftwareComponent &orOther)=delete |
| CSoftwareComponent & | operator= (CSoftwareComponent &&orOther)=delete |
| virtual void | Init ()=0 |
| virtual bool | IsInitialized ()=0 |
Private Types | |
| using | EAccelDynamicRange = NIcm20789DriverConfig::EAccelDynamicRange |
| using | EGyroDynamicRange = NIcm20789DriverConfig::EGyroDynamicRange |
Private Member Functions | |
| CIcm20789Driver (CIcm20789Driver &)=delete | |
| CIcm20789Driver (CIcm20789Driver &&)=delete | |
| CIcm20789Driver & | operator= (const CIcm20789Driver &orOther)=delete |
| CIcm20789Driver & | operator= (CIcm20789Driver &&orOther)=delete |
| CIcm20789Driver ()=delete | |
| CIcm20789Driver (EIcmIds eIcmChipId) | |
| The only valid constructor. | |
| bool | getChipIDBaro (uint8_t &urId) |
| Get the Chip ID value barometr part. | |
| bool | softResetBaro () |
| Request soft reset. | |
| bool | setLowNoiseModeBaro () |
| Request measurement temperature and pressure. | |
| bool | getOTPBaro () |
| Get the Trim Parameters structure. | |
| bool | getTemperatureAndPressure (float &frTemperature, float &frPressure) |
| Get the Temperature And Pressure values. | |
| void | processDataBaro (uint32_t iPressData, uint32_t iTempData, float &frPressure, float &frTemperature) |
| Processing the raw data. | |
| bool | getImuChipId (uint8_t &urId) |
| Get the Chip ID value Gyro sensor part. | |
| bool | softResetImu () |
| Request soft reset. | |
| bool | setAccelerometerDynamicRange (EAccelDynamicRange eAccelDynamicRange) |
| Set dynamic range for accelerometer. | |
| bool | setGyroscopeDynamicRange (EGyroDynamicRange eGyroDynamicRange) |
| Set dynamic range for gyroscope. | |
| bool | enableAllImuAxes () |
| Enable axes. | |
| bool | setImuSampleRate () |
| Set Imu sample rate. | |
| bool | setImuFilter () |
| Set Imu Filter config. | |
| bool | imuSelfTest () |
| Perform a self test procedure for an IMU. | |
| bool | enableBypass () |
| Enable bypass. | |
| uint8_t | crc8 (uint8_t *upData, uint8_t uLen) |
| Calculate CRC-8 for Barometer. | |
| bool | collectTestStatistics (bool bWithSelfTestFlag, int *ipGyroResult, int *ipAccelResult) |
| Collect self-test statistics. | |
| bool | checkAccelSelfTest (int *ipMeanNormalTestValues, int *ipMeanSelfTestValues) |
| check accel self test | |
| bool | checkGyroSelfTest (int *ipMeanNormalTestValues, int *ipMeanSelfTestValues) |
| check gyro self test | |
| bool | i2cWrite (uint8_t uIicAddress, uint8_t *upData, uint8_t uLen) |
| bool | i2cRead (uint8_t uIicAddress, uint8_t *upData, uint8_t uLen) |
| bool | i2cReadOtp (uint8_t uIicAddress, uint8_t *upData, uint8_t uLen) |
| bool | readFromImuRegisters (uint8_t uReg, uint8_t *upData, uint8_t uLen) |
| bool | writeImuRegister (uint8_t uReg, uint8_t uData) |
| bool | i2cWaitOnFlag (uint32_t Flag, FlagStatus Status, uint32_t Timeout, uint32_t Tickstart) |
| I2C_HandleTypeDef * | getI2CHandle (EIcmIds eIcmChipId) |
| Get an I2C handle corresponding to the chip. | |
| uint16_t | getShutdownPinId (EIcmIds eIcmChipId) |
| Get ID of the shutdown pin for the ICM chip instance. | |
| GPIO_TypeDef * | getPortOfShutdownPin (EIcmIds eIcmChipId) |
| Get GPIO port that the shutdown pin belongs to. | |
Static Private Member Functions | |
| static CIcm20789Driver & | getInstanceImpl (unsigned uInstanceIndex) |
| static void | osDelayIfInitTaskCompleted (uint32_t uDelay) |
| Delay the task if initialization was completed. The function does nothing if Init task is running and delays for the given number of milliseconds otherwise. | |
| static bool | hasSignalSaturated (int16_t iValue) |
| Return true if 16bit integer signal saturated. | |
Private Attributes | |
| const uint16_t | kauSelfTestEquation [256] |
| SCalibParam | oCalibParam_ |
| uint8_t | auImuDataBuffer_ [14] |
| uint8_t | auPressureDataBuffer_ [9] |
| uint32_t | uI2CBusErrorCounter_ { 0U } |
| I2C bus error counter. | |
| bool | bIsInitialized_ { false } |
| Sensor status after initialization. | |
| const EIcmIds | keSensorId_ |
| ID of the sensor corresponding to the driver instance. | |
| const uint16_t | kuShutdownPin_ |
| ID of the shutdown pin. | |
| GPIO_TypeDef *const | opkShutdownPinPort_ |
| GPIO port to which the shutdown pin belongs. | |
| I2C_HandleTypeDef *const | opkI2CHandle_ |
| Pointer to the I2C handle. | |
Static Private Attributes | |
| static constexpr float | skfTempScale_ {333.87F} |
| A scale factor for converting raw temperature readings to degrees Celsius. | |
| static constexpr float | skfTempOffset_ {21.0F} |
| An offset for converting raw temperature readings to degrees Celsius. | |
| static constexpr EAccelDynamicRange | skeAccelDynamicRange_ {EAccelDynamicRange::e8g} |
| Configured accelerometer dynamic range. | |
| static constexpr EGyroDynamicRange | skeGyroDynamicRange_ {EGyroDynamicRange::e500dps} |
| Configured gyroscope dynamic range. | |
| static constexpr float | skfAccelRawToMetersPerSecondSquared_ |
| static constexpr float | skfGyroRawToRadiansPerSecond_ |
| static constexpr uint32_t | skuMaxI2CBusErrorCounterToReset_ { 300U } |
| Maximum bus error counter before the chip is reset. | |
Friends | |
| class | CSoftwareComponent< CIcm20789Driver, 2U > |
Additional Inherited Members | |
Static Public Member Functions inherited from CSoftwareComponent< CIcm20789Driver, 2U > | |
| static CIcm20789Driver & | GetInstance (unsigned uInstanceIndex=0U) |
Static Public Attributes inherited from CSoftwareComponent< CIcm20789Driver, 2U > | |
| static constexpr unsigned | skuInstanceCount_ |
Protected Member Functions inherited from CSoftwareComponent< CIcm20789Driver, 2U > | |
| CSoftwareComponent ()=default | |
| ~CSoftwareComponent ()=default | |
|
strong |
|
privatedelete |
|
privatedelete |
|
privatedelete |
|
private |
The only valid constructor.
| eIcmChipId | An ID of the ICM20789 chip to instantiate a driver for. |
|
private |
check accel self test
| [in] | ipMeanNormalTestValues | average value of normal test. |
| [in] | ipMeanSelfTestValues | average value of self test |
|
private |
check gyro self test
| [in] | ipMeanNormalTestValues | average value of normal test. |
| [in] | ipMeanSelfTestValues | average value of self test |
|
private |
Collect self-test statistics.
| bWithSelfTestFlag | Run test with self-test enabled flag |
| ipGyroResult | Test statistics of a gyroscope |
| ipAccelResult | Test statistics of an accelerometer |
|
private |
Calculate CRC-8 for Barometer.
| upData | - pointer on data |
| uLen | - length of data |
|
private |
Enable axes.
|
private |
Enable bypass.
|
private |
Get the Chip ID value barometr part.
| urId | reference to the ID variable |
|
private |
Get an I2C handle corresponding to the chip.
| eIcmChipId | An ID of the ICM20789 chip. |
|
private |
Get the Chip ID value Gyro sensor part.
|
staticprivate |
|
private |
Get the Trim Parameters structure.
|
private |
Get GPIO port that the shutdown pin belongs to.
|
private |
Get ID of the shutdown pin for the ICM chip instance.
|
private |
Get the Temperature And Pressure values.
| frTemperature | reference to the temperature variable |
| frPressure | reference to the pressure variable |
| void CIcm20789Driver::HardReset | ( | ) |
Execute a hard-reset if the ICM chip hangs. Powers down the sensor, waits, then powers on and initializes it again. The function lowers priority of the calling task for the duration of the reset procedure. In re-initialization fails, then the function will keep on re-trying.
|
inlinestaticprivate |
Return true if 16bit integer signal saturated.
|
private |
Read via I2C.
| uIicAddress | Device address to read from. |
| upData | A pointer to output data buffer. |
| uLen | Number of bytes to read. |
|
private |
Read via I2C. The function uses increased timeout value.
| uIicAddress | Device address to read from. |
| upData | A pointer to output data buffer. |
| uLen | Number of bytes to read. |
|
private |
Checks the status and waits till I2C bus flags are ready
| Flag | specifies the I2C flag to check. |
| Status | The new Flag status (SET or RESET). |
| Timeout | Timeout duration |
| Tickstart | Tick start value |
|
private |
Write via I2C.
| uIicAddress | Device address |
| upData | Pointer do data buffer to be written |
| uLen | Number of bytes to write |
|
private |
Perform a self test procedure for an IMU.
|
overridevirtual |
Initialize the software component.
Implements CSoftwareComponent< CIcm20789Driver, 2U >.
| void CIcm20789Driver::InvalidateImuOutputPort | ( | ) |
Writes default invalid data to IMU output port.
| void CIcm20789Driver::InvalidatePressureOutputPort | ( | ) |
Writes default invalid data to pressure output port.
|
overridevirtual |
Get initialization status of the software component.
Implements CSoftwareComponent< CIcm20789Driver, 2U >.
|
privatedelete |
|
privatedelete |
|
inlinestaticprivate |
Delay the task if initialization was completed. The function does nothing if Init task is running and delays for the given number of milliseconds otherwise.
| uDelay | Delay duration in [ms]. |
| void CIcm20789Driver::ParseReceivedImuDataDma | ( | ) |
Parses IMU data received in DMA mode.
| void CIcm20789Driver::ParseReceivedPressureDataDma | ( | ) |
Parses pressure data received in DMA mode.
| void CIcm20789Driver::PollInertialSensor | ( | ) |
Implements an iteration of cyclic data exchange with the inertial sensor.
| void CIcm20789Driver::PollPressureSensor | ( | ) |
Implements an iteration of cyclic data exchange with the pressure sensor.
|
private |
Processing the raw data.
| iPressData | - Raw pressure data from sensor |
| iTempData | - Raw temperature data from sensor |
| frTemperature | reference to the temperature variable |
| frPressure | reference to the pressure variable |
|
private |
Read data from registers of the IMU starting from the specified address.
| uReg | Register address to start the read from |
| upData | Pointer to the output data buffer |
| uLen | Number of bytes to read |
| bool CIcm20789Driver::RequestInertialSensorDataDma | ( | ) |
Request IMU data in DMA mode. When reception is completed, received bytes can be processed in the interrupt handler.
| bool CIcm20789Driver::RequestPressureSensorDataDma | ( | ) |
Request pressure data in DMA mode. When reception is completed, received bytes can be processed in the interrupt handler.
|
private |
Set dynamic range for accelerometer.
|
private |
Set dynamic range for gyroscope.
|
private |
Set Imu Filter config.
|
private |
Set Imu sample rate.
|
private |
Request measurement temperature and pressure.
|
private |
Request soft reset.
|
private |
Request soft reset.
| bool CIcm20789Driver::TriggerPressureMeasurement | ( | ) |
Trigger measuring sequence of the pressure sensor.
|
private |
Write a byte to IMU's register
| uReg | Register address |
| uData | A value to write |
|
friend |
|
private |
|
private |
|
private |
Sensor status after initialization.
|
private |
|
private |
ID of the sensor corresponding to the driver instance.
|
private |
ID of the shutdown pin.
|
private |
|
private |
Pointer to the I2C handle.
|
private |
GPIO port to which the shutdown pin belongs.
|
staticconstexprprivate |
Configured accelerometer dynamic range.
|
staticconstexprprivate |
Configured gyroscope dynamic range.
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
An offset for converting raw temperature readings to degrees Celsius.
|
staticconstexprprivate |
A scale factor for converting raw temperature readings to degrees Celsius.
|
staticconstexprprivate |
Maximum bus error counter before the chip is reset.
|
private |
I2C bus error counter.