JeVois  1.17
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
jevois::IMUspi Class Reference

#include <jevois/Core/IMUspi.H>

IMU with SPI interface, such as the ICM20948 IMU on the JeVois-Pro IMX290 camera sensor board.

Definition at line 28 of file IMUspi.H.

Inheritance diagram for jevois::IMUspi:
Collaboration diagram for jevois::IMUspi:

Public Member Functions

 IMUspi (std::string const &devname)
 Constructor. More...
 
virtual ~IMUspi ()
 Destructor. More...
 
virtual bool isSPI () const override
 Returns true if we use SPI for transfers. Used when ICM20948_REG_USER_CTRL is written to. More...
 
Access functions for IMU registers
void writeRegister (unsigned short reg, unsigned char val) override
 Write a value to one of the IMU registers. More...
 
unsigned char readRegister (unsigned short reg) override
 Read a value from one of the camera's IMU registers. More...
 
void writeRegisterArray (unsigned short reg, unsigned char const *vals, size_t num) override
 Write an array of values to the camera's IMU registers. More...
 
void readRegisterArray (unsigned short reg, unsigned char *vals, size_t num) override
 Read an array of values from the camera's IMU registers. More...
 
- Public Member Functions inherited from jevois::IMU
 IMU ()
 Constructor. More...
 
virtual ~IMU ()
 Destructor. More...
 
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...
 

Protected Member Functions

void selectBank (unsigned short reg)
 
void spi_xfer (unsigned char addr, unsigned char dir, size_t siz, unsigned char *datain, unsigned char const *dataout)
 

Protected Attributes

const std::string itsDevName
 
int itsFd
 
uint8_t itsIMUbank
 

Constructor & Destructor Documentation

◆ IMUspi()

jevois::IMUspi::IMUspi ( std::string const &  devname)

Constructor.

Definition at line 33 of file IMUspi.C.

References itsFd, LERROR, LFATAL, LINFO, jevois::IMU::loadDMPfirmware(), jevois::imu::mode, readRegister(), and writeRegister().

◆ ~IMUspi()

jevois::IMUspi::~IMUspi ( )
virtual

Destructor.

Definition at line 97 of file IMUspi.C.

Member Function Documentation

◆ isSPI()

bool jevois::IMUspi::isSPI ( ) const
overridevirtual

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

Implements jevois::IMU.

Definition at line 103 of file IMUspi.C.

◆ readRegister()

unsigned char jevois::IMUspi::readRegister ( unsigned short  reg)
overridevirtual

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

See base class jevois::IMU for full docs.

Implements jevois::IMU.

Definition at line 211 of file IMUspi.C.

References ICM20948_SPI_READ, and LDEBUG.

Referenced by IMUspi().

◆ readRegisterArray()

void jevois::IMUspi::readRegisterArray ( unsigned short  reg,
unsigned char *  vals,
size_t  num 
)
overridevirtual

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

See base class jevois::IMU for full docs.

Implements jevois::IMU.

Definition at line 230 of file IMUspi.C.

References ICM20948_SPI_READ, LDEBUG, and LFATAL.

◆ selectBank()

void jevois::IMUspi::selectBank ( unsigned short  reg)
protected

Definition at line 147 of file IMUspi.C.

References ICM20948_SPI_WRITE, and LDEBUG.

◆ spi_xfer()

void jevois::IMUspi::spi_xfer ( unsigned char  addr,
unsigned char  dir,
size_t  siz,
unsigned char *  datain,
unsigned char const *  dataout 
)
protected

Definition at line 107 of file IMUspi.C.

◆ writeRegister()

void jevois::IMUspi::writeRegister ( unsigned short  reg,
unsigned char  val 
)
overridevirtual

Write a value to one of the IMU registers.

See base class jevois::IMU for full docs.

Implements jevois::IMU.

Definition at line 159 of file IMUspi.C.

References ICM20948_SPI_WRITE, LDEBUG, and LERROR.

Referenced by IMUspi().

◆ writeRegisterArray()

void jevois::IMUspi::writeRegisterArray ( unsigned short  reg,
unsigned char const *  vals,
size_t  num 
)
overridevirtual

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

See base class jevois::IMU for full docs.

Implements jevois::IMU.

Definition at line 221 of file IMUspi.C.

References ICM20948_SPI_WRITE, LDEBUG, and LFATAL.

Member Data Documentation

◆ itsDevName

const std::string jevois::IMUspi::itsDevName
protected

Definition at line 62 of file IMUspi.H.

◆ itsFd

int jevois::IMUspi::itsFd
protected

Definition at line 63 of file IMUspi.H.

Referenced by IMUspi().

◆ itsIMUbank

uint8_t jevois::IMUspi::itsIMUbank
protected

Definition at line 65 of file IMUspi.H.


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