JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#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.
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. | |
|
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.
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().
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.
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.
|
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.
|
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.
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.
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.
|
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.
|
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.