JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches

#include <jevois/Core/IMU.H>

Abstract interface to an ICM20948 inertial measurement unit (IMU)

This class abstracts the low-level communication interface (over SPI bus on JeVois-Pro hardware, or over I2C bus shared with the camera sensor chip and through custom ioctl() calls on JeVois-A33.

Definition at line 27 of file IMU.H.

Inheritance diagram for jevois::IMU:

Public Member Functions

 IMU ()
 Constructor.
 
virtual ~IMU ()
 Destructor.
 
virtual bool isSPI () const =0
 Returns true if we use SPI for transfers. Used when ICM20948_REG_USER_CTRL is written to.
 
Access functions for IMU registers
virtual void writeRegister (unsigned short reg, unsigned char val)=0
 Write a value to one of the IMU registers.
 
virtual unsigned char readRegister (unsigned short reg)=0
 Read a value from one of the camera's IMU registers.
 
virtual void writeRegisterArray (unsigned short reg, unsigned char const *vals, size_t num)=0
 Write an array of values to the camera's IMU registers.
 
virtual void readRegisterArray (unsigned short reg, unsigned char *vals, size_t num)=0
 Read an array of values from the camera's IMU registers.
 
Access functions for DMP registers
void loadDMPfirmware (bool verify=false, bool errthrow=false)
 Load the DMP firmware.
 
void writeDMPregister (unsigned short reg, unsigned short val)
 Write a value to a DMP register.
 
unsigned short readDMPregister (unsigned short reg)
 Read a value from a DMP register.
 
void writeDMPregisterArray (unsigned short reg, unsigned char const *vals, size_t num)
 Write an array of values to DMP registers.
 
void readDMPregisterArray (unsigned short reg, unsigned char *vals, size_t num)
 Read an array of values from DMP registers.
 

Constructor & Destructor Documentation

◆ IMU()

jevois::IMU::IMU ( )

Constructor.

Definition at line 29 of file IMU.C.

◆ ~IMU()

jevois::IMU::~IMU ( )
virtual

Destructor.

Definition at line 33 of file IMU.C.

Member Function Documentation

◆ isSPI()

virtual bool jevois::IMU::isSPI ( ) const
pure virtual

Returns true if we use SPI for transfers. Used when ICM20948_REG_USER_CTRL is written to.

Implemented in jevois::IMUi2c, and jevois::IMUspi.

◆ loadDMPfirmware()

void jevois::IMU::loadDMPfirmware ( bool  verify = false,
bool  errthrow = false 
)

Load the DMP firmware.

On JeVois-A33, the firmware is already loaded by the camera kernel module. So this is only useful on JeVois-Pro to load the firmware over SPI. If verify is true, we will read it back and check. If errthrow is also true, throws an exception if verification fails.

Definition at line 37 of file IMU.C.

References DMP_LOAD_START, DMP_MEM_BANK_SIZE, DMP_START_ADDRESS, LDEBUG, LERROR, LFATAL, and LINFO.

Referenced by jevois::IMUspi::IMUspi().

◆ readDMPregister()

unsigned short jevois::IMU::readDMPregister ( unsigned short  reg)

Read a value from a DMP register.

This very low-level access is for development of optimal DMP settings only and should not be used in normal operation, it can crash your system. Note that the value will be converted from big endian of DMP processor to little endian of the JeVois processor.

Definition at line 138 of file IMU.C.

◆ readDMPregisterArray()

void jevois::IMU::readDMPregisterArray ( unsigned short  reg,
unsigned char *  vals,
size_t  num 
)

Read an array of values from DMP registers.

This very low-level access is for development of optimal DMP settings only and should not be used in normal operation, it can crash your system. Memory for vals should have been allocated by the caller with at least num bytes. num must be less than 32. This function does not handle crossing of memory banks, so the caller should segment the calls to match memory bank boundaries. Finally, this function does not perform any endian conversion. Callers should be aware that the DMP is a 16-bit big endian system while the JeVois processor is little endian.

Definition at line 149 of file IMU.C.

◆ readRegister()

virtual unsigned char jevois::IMU::readRegister ( unsigned short  reg)
pure virtual

Read a value from one of the camera's IMU registers.

This very low-level access is for development of optimal IMU settings only and should not be used in normal operation, it can crash your system. Bank selection is included in this function.

Implemented in jevois::IMUi2c, and jevois::IMUspi.

◆ readRegisterArray()

virtual void jevois::IMU::readRegisterArray ( unsigned short  reg,
unsigned char *  vals,
size_t  num 
)
pure virtual

Read an array of values from the camera's IMU registers.

This very low-level access is for development of optimal IMU settings only and should not be used in normal operation, it can crash your system. Memory for vals should have been allocated by the caller with at least num bytes. num must be less than 32. Bank selection is included in this function.

Implemented in jevois::IMUi2c, and jevois::IMUspi.

◆ writeDMPregister()

void jevois::IMU::writeDMPregister ( unsigned short  reg,
unsigned short  val 
)

Write a value to a DMP register.

This very low-level access is for development of optimal DMP settings only and should not be used in normal operation, it can crash your system. Note that the value will be converted to big endian, as required by the DMP processor.

Definition at line 114 of file IMU.C.

◆ writeDMPregisterArray()

void jevois::IMU::writeDMPregisterArray ( unsigned short  reg,
unsigned char const *  vals,
size_t  num 
)

Write an array of values to DMP registers.

This very low-level access is for development of optimal DMP settings only and should not be used in normal operation, it can crash your system. Memory for vals should have been allocated by the caller with at least num bytes. num must be less than 32. This function does not handle crossing of memory banks, so the caller should segment the calls to match memory bank boundaries. Finally, this function does not perform any endian conversion. Callers should be aware that the DMP is a 16-bit big endian system while the JeVois processor is little endian.

Definition at line 125 of file IMU.C.

◆ writeRegister()

virtual void jevois::IMU::writeRegister ( unsigned short  reg,
unsigned char  val 
)
pure virtual

Write a value to one of the IMU registers.

This very low-level access is for development of optimal IMU settings only and should not be used in normal operation, it can crash your system. Bank selection is included in this function.

Implemented in jevois::IMUi2c, and jevois::IMUspi.

◆ writeRegisterArray()

virtual void jevois::IMU::writeRegisterArray ( unsigned short  reg,
unsigned char const *  vals,
size_t  num 
)
pure virtual

Write an array of values to the camera's IMU registers.

This very low-level access is for development of optimal IMU settings only and should not be used in normal operation, it can crash your system. Memory for vals should have been allocated by the caller with at least num bytes. num must be less than 32. Bank selection is included in this function.

Implemented in jevois::IMUi2c, and jevois::IMUspi.


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