AMS Advanced Air Mobility Sensors UG
Loading...
Searching...
No Matches
CScha63TDriver Class Reference

This is class implements a driver for the Murata SCHA63T inertial sensor. More...

Inheritance diagram for CScha63TDriver:
CSoftwareComponent< CScha63TDriver, 1U >

Classes

struct  SCompensationParameters
 A struct to store compensation parameters stored in the sensor's NVM. More...
 

Public Member Functions

void Init () override
 
bool IsInitialized () override
 
void PollSensor ()
 Poll the sensor. Puts batches of 30 measurements periodically into the queue of the FreeRTOS task. The function is called from the 6kHz interrupt triggered by the TIM7.
 
void ConvertRawDataset ()
 Converts batches of 30 raw measurements to IMU measurement, applies factory calibration and writes the result to the RTE port. The routine shall be called from FreeRTOS tasks.
 
- Public Member Functions inherited from CSoftwareComponent< CScha63TDriver, 1U >
 CSoftwareComponent (CSoftwareComponent &)=delete
 
 CSoftwareComponent (CSoftwareComponent &&)=delete
 
CSoftwareComponentoperator= (const CSoftwareComponent &orOther)=delete
 
CSoftwareComponentoperator= (CSoftwareComponent &&orOther)=delete
 
virtual void Init ()=0
 
virtual bool IsInitialized ()=0
 

Private Types

enum  EMeasurementFrames {
  eSpecificForceX = 0 , eSpecificForceY , eSpecificForceZ , eAngularRateX ,
  eAngularRateY , eAngularRateZ , eTemperatureUno , eTemperatureDue ,
  eFrameCount
}
 Enumeration of measurement frames for SPI communication. More...
 

Private Member Functions

 CScha63TDriver (CScha63TDriver &)=delete
 
 CScha63TDriver (CScha63TDriver &&)=delete
 
CScha63TDriveroperator= (const CScha63TDriver &orOther)=delete
 
CScha63TDriveroperator= (CScha63TDriver &&orOther)=delete
 
 CScha63TDriver (SPI_HandleTypeDef &korSpiHandle)
 
 ~CScha63TDriver ()=default
 
bool pollUnoStatus ()
 Poll the status of the UNO ASIC.
 
bool pollDueStatus ()
 Poll the status of the DUE ASIC.
 
uint32_t spiWriteReadUno (uint32_t uDataOut)
 Read/write a 32-bit frame to/from the UNO ASIC.
 
uint32_t spiWriteReadDue (uint32_t uDataOut)
 Read/write a 32-bit frame to/from the DUE ASIC.
 
uint32_t spiWriteRead (uint32_t uDataOut, GPIO_TypeDef *opGpioX, uint16_t uGpioPin)
 SPI communication with the sensor.
 

Static Private Member Functions

static CScha63TDrivergetInstanceImpl (unsigned uInstanceIndex)
 
static SPI_HandleTypeDef & getSpiHandle ()
 Get reference to a SPI handle object instantiated in the HAL library. Returns reference to hspi1 for BAHRS V2 and hspi2 for BAHRS V3.
 
static bool checkRsError (uint32_t uFrame)
 Check for RS error bits in the frame.
 
static bool checkRsErrorInFrames (uint32_t *upFrames, unsigned uFrameCount)
 Check for RS errors in an array of frames received from the ASIC:
 
static int16_t frameToInt16 (uint32_t uFrame)
 Get a 16-bit integer from the frame received from the ASIC.
 
static uint16_t frameToUint16 (uint32_t uFrame)
 Get a 16-bit unsigned integer from the frame received from the ASIC.
 
static int8_t lowerInt8FromFrame (uint32_t uFrame)
 Get a 8-bit integer from the frame received from the ASIC using the lower bits.
 
static int8_t upperInt8FromFrame (uint32_t uFrame)
 Get a 8-bit integer from the frame received from the ASIC using the upper bits.
 

Private Attributes

bool bIsInitialized_ { false }
 Sensor initialization status: true – initialized, false otherwise.
 
char acSerialNumber_ [14] { "" }
 ID of the sensor read from the sensor's NVM.
 
SCompensationParameters oCompensationParameters_
 Compensation parameters read from the sensor's NVM.
 
SScha63TDataset oLatestDataset_
 The latest 30 measurements that are transfered periodically to the queue of the dedicated FreeRTOS task.
 
SScha63TDataset oOutputDataset_
 
bool bErrorFlags_ { false }
 The flag indicating errors during ASIC operation.
 
SScha63TStatusUno oStatusUno_
 The latest content of the UNO status registers. Valid only when bErrorFlags_ is true.
 
SScha63TStatusDue oStatusDue_
 The latest content of the DUE status registers. Valid only when bErrorFlags_ is true.
 
volatile bool bDatasetAvailable_ { false }
 
SPI_HandleTypeDef & orSpiHandle_
 

Static Private Attributes

static constexpr float skfGravity_ { 9.8F }
 Gravity constant, [m/s^2].
 
static constexpr float skfDegreesToRadians_ { 0.017453292F }
 Scale factor to convert degrees to radians, [rad/deg].
 
static constexpr float skfAccelerometerSensitivity_ { 4905.0F }
 Accelerometer sensitivity, [LSB/g].
 
static constexpr float skfGyroscopeSensitivity_ { 80.0F }
 Gyroscope sensitivity, [LSB/deg/s].
 
static constexpr int skiMaxAttemptsToConfigure_ { 2 }
 Number of attempts to configure the sensor.
 

Friends

class CSoftwareComponent< CScha63TDriver, 1U >
 

Additional Inherited Members

- Static Public Member Functions inherited from CSoftwareComponent< CScha63TDriver, 1U >
static CScha63TDriverGetInstance (unsigned uInstanceIndex=0U)
 
- Static Public Attributes inherited from CSoftwareComponent< CScha63TDriver, 1U >
static constexpr unsigned skuInstanceCount_
 
- Protected Member Functions inherited from CSoftwareComponent< CScha63TDriver, 1U >
 CSoftwareComponent ()=default
 
 ~CSoftwareComponent ()=default
 

Detailed Description

This is class implements a driver for the Murata SCHA63T inertial sensor.

Member Enumeration Documentation

◆ EMeasurementFrames

Enumeration of measurement frames for SPI communication.

Enumerator
eSpecificForceX 
eSpecificForceY 
eSpecificForceZ 
eAngularRateX 
eAngularRateY 
eAngularRateZ 
eTemperatureUno 
eTemperatureDue 
eFrameCount 

Constructor & Destructor Documentation

◆ CScha63TDriver() [1/3]

CScha63TDriver::CScha63TDriver ( CScha63TDriver )
privatedelete

◆ CScha63TDriver() [2/3]

CScha63TDriver::CScha63TDriver ( CScha63TDriver &&  )
privatedelete

◆ CScha63TDriver() [3/3]

CScha63TDriver::CScha63TDriver ( SPI_HandleTypeDef &  korSpiHandle)
explicitprivate

◆ ~CScha63TDriver()

CScha63TDriver::~CScha63TDriver ( )
privatedefault

Member Function Documentation

◆ checkRsError()

bool CScha63TDriver::checkRsError ( uint32_t  uFrame)
inlinestaticprivate

Check for RS error bits in the frame.

Parameters
uFrame32-bit frame received from the ASIC.
Returns
True – there are errors, false – no errors.

◆ checkRsErrorInFrames()

bool CScha63TDriver::checkRsErrorInFrames ( uint32_t *  upFrames,
unsigned  uFrameCount 
)
staticprivate

Check for RS errors in an array of frames received from the ASIC:

Parameters
upFramesA pointer to the first array element.
uFrameCountNumber of frames ín the array.
Returns
True if there are errors, false – no errors.

◆ ConvertRawDataset()

void CScha63TDriver::ConvertRawDataset ( )

Converts batches of 30 raw measurements to IMU measurement, applies factory calibration and writes the result to the RTE port. The routine shall be called from FreeRTOS tasks.

◆ frameToInt16()

int16_t CScha63TDriver::frameToInt16 ( uint32_t  uFrame)
inlinestaticprivate

Get a 16-bit integer from the frame received from the ASIC.

Parameters
uFrameA 32-bit frame received from the ASIC:
Returns
16-bit integer.

◆ frameToUint16()

uint16_t CScha63TDriver::frameToUint16 ( uint32_t  uFrame)
inlinestaticprivate

Get a 16-bit unsigned integer from the frame received from the ASIC.

Parameters
uFrameA 32-bit frame received from the ASIC:
Returns
A 16-bit unsigned integer.

◆ getInstanceImpl()

CScha63TDriver & CScha63TDriver::getInstanceImpl ( unsigned  uInstanceIndex)
staticprivate

◆ getSpiHandle()

SPI_HandleTypeDef & CScha63TDriver::getSpiHandle ( )
staticprivate

Get reference to a SPI handle object instantiated in the HAL library. Returns reference to hspi1 for BAHRS V2 and hspi2 for BAHRS V3.

Returns
Reference to SPI handle.

◆ Init()

void CScha63TDriver::Init ( )
overridevirtual

Initialize the software component.

Implements CSoftwareComponent< CScha63TDriver, 1U >.

◆ IsInitialized()

bool CScha63TDriver::IsInitialized ( )
overridevirtual

Get initialization status of the software component.

Returns
True – the component is initialized, false otherwise.

Implements CSoftwareComponent< CScha63TDriver, 1U >.

◆ lowerInt8FromFrame()

int8_t CScha63TDriver::lowerInt8FromFrame ( uint32_t  uFrame)
inlinestaticprivate

Get a 8-bit integer from the frame received from the ASIC using the lower bits.

Parameters
uFrameA 32-bit frame received from the ASIC.
Returns
Desired 8-bit integer.

◆ operator=() [1/2]

CScha63TDriver & CScha63TDriver::operator= ( const CScha63TDriver orOther)
privatedelete

◆ operator=() [2/2]

CScha63TDriver & CScha63TDriver::operator= ( CScha63TDriver &&  orOther)
privatedelete

◆ pollDueStatus()

bool CScha63TDriver::pollDueStatus ( )
private

Poll the status of the DUE ASIC.

Returns
True if the DUE ASIC operates normally, false otherwise.

◆ PollSensor()

void CScha63TDriver::PollSensor ( )

Poll the sensor. Puts batches of 30 measurements periodically into the queue of the FreeRTOS task. The function is called from the 6kHz interrupt triggered by the TIM7.

◆ pollUnoStatus()

bool CScha63TDriver::pollUnoStatus ( )
private

Poll the status of the UNO ASIC.

Returns
True if the UNO ASIC operates normally, false otherwise.

◆ spiWriteRead()

uint32_t CScha63TDriver::spiWriteRead ( uint32_t  uDataOut,
GPIO_TypeDef *  opGpioX,
uint16_t  uGpioPin 
)
private

SPI communication with the sensor.

Parameters
uDataOutData to be sent.
opGpioXCSB GPIO group.
uGpioPinCSB GPIO pin.
Returns
Response of the sensor.

◆ spiWriteReadDue()

uint32_t CScha63TDriver::spiWriteReadDue ( uint32_t  uDataOut)
private

Read/write a 32-bit frame to/from the DUE ASIC.

Parameters
uDataOutData to be send on SPI (for example read address).
Returns
Response of the sensor to the previous operation.

◆ spiWriteReadUno()

uint32_t CScha63TDriver::spiWriteReadUno ( uint32_t  uDataOut)
private

Read/write a 32-bit frame to/from the UNO ASIC.

Parameters
uDataOutData to be send on SPI (for example read address).
Returns
Response of the sensor to the previous operation.

◆ upperInt8FromFrame()

int8_t CScha63TDriver::upperInt8FromFrame ( uint32_t  uFrame)
inlinestaticprivate

Get a 8-bit integer from the frame received from the ASIC using the upper bits.

Parameters
uFrameA 32-bit frame received from the ASIC.
Returns
Desired 8-bit integer.

Friends And Related Function Documentation

◆ CSoftwareComponent< CScha63TDriver, 1U >

friend class CSoftwareComponent< CScha63TDriver, 1U >
friend

Member Data Documentation

◆ acSerialNumber_

char CScha63TDriver::acSerialNumber_[14] { "" }
private

ID of the sensor read from the sensor's NVM.

◆ bDatasetAvailable_

volatile bool CScha63TDriver::bDatasetAvailable_ { false }
private

◆ bErrorFlags_

bool CScha63TDriver::bErrorFlags_ { false }
private

The flag indicating errors during ASIC operation.

◆ bIsInitialized_

bool CScha63TDriver::bIsInitialized_ { false }
private

Sensor initialization status: true – initialized, false otherwise.

◆ oCompensationParameters_

SCompensationParameters CScha63TDriver::oCompensationParameters_
private

Compensation parameters read from the sensor's NVM.

◆ oLatestDataset_

SScha63TDataset CScha63TDriver::oLatestDataset_
private

The latest 30 measurements that are transfered periodically to the queue of the dedicated FreeRTOS task.

◆ oOutputDataset_

SScha63TDataset CScha63TDriver::oOutputDataset_
private

◆ orSpiHandle_

SPI_HandleTypeDef& CScha63TDriver::orSpiHandle_
private

◆ oStatusDue_

SScha63TStatusDue CScha63TDriver::oStatusDue_
private

The latest content of the DUE status registers. Valid only when bErrorFlags_ is true.

◆ oStatusUno_

SScha63TStatusUno CScha63TDriver::oStatusUno_
private

The latest content of the UNO status registers. Valid only when bErrorFlags_ is true.

◆ skfAccelerometerSensitivity_

constexpr float CScha63TDriver::skfAccelerometerSensitivity_ { 4905.0F }
staticconstexprprivate

Accelerometer sensitivity, [LSB/g].

◆ skfDegreesToRadians_

constexpr float CScha63TDriver::skfDegreesToRadians_ { 0.017453292F }
staticconstexprprivate

Scale factor to convert degrees to radians, [rad/deg].

◆ skfGravity_

constexpr float CScha63TDriver::skfGravity_ { 9.8F }
staticconstexprprivate

Gravity constant, [m/s^2].

◆ skfGyroscopeSensitivity_

constexpr float CScha63TDriver::skfGyroscopeSensitivity_ { 80.0F }
staticconstexprprivate

Gyroscope sensitivity, [LSB/deg/s].

◆ skiMaxAttemptsToConfigure_

constexpr int CScha63TDriver::skiMaxAttemptsToConfigure_ { 2 }
staticconstexprprivate

Number of attempts to configure the sensor.


The documentation for this class was generated from the following files: