JeVois  1.16
JeVois Smart Embedded Machine Vision Toolkit
Share this page:

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

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, 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: