JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
|
|
|
Go to the documentation of this file.
30 unsigned char data[32];
36 jevois::
IMU(), itsCam(cam), itsIMUbank(0xff)
48 void jevois::IMUi2c::selectBank(
int fd,
unsigned short reg)
50 uint8_t
const bank = (reg >> 7) & 0x03;
51 if (itsIMUbank == bank)
return;
53 unsigned short data[2] = { ICM20948_REG_BANK_SEL,
static_cast<unsigned short>(bank << 4) };
55 LDEBUG(
"Writing 0x" << std::hex << data[1] <<
" to 0x" << data[0]);
56 XIOCTL(fd, _IOW(
'V', 194,
int), data);
64 int fd = itsCam->lock();
69 unsigned short data[2] = {
static_cast<unsigned short>(reg & 0x7f), val };
71 LDEBUG(
"Writing 0x" << std::hex << val <<
" to 0x" << reg);
72 XIOCTL(fd, _IOW(
'V', 194,
int), data);
81 int fd = itsCam->lock();
82 unsigned short data[2] = {
static_cast<unsigned short>(reg & 0x7f), 0 };
87 XIOCTL(fd, _IOWR(
'V', 195,
int), data);
88 LDEBUG(
"Register 0x" << std::hex << reg <<
" has value 0x" << data[1]);
98 if (num > 32)
LFATAL(
"Maximum allowed size is 32 bytes. You must break down larger transfers into 32 byte chunks.");
100 int fd = itsCam->lock();
105 static jevois_data d;
108 memcpy(d.data, vals, num);
110 LDEBUG(
"Writing " << num <<
" values to 0x"<< std::hex << reg);
111 XIOCTL(fd, _IOW(
'V', 196,
struct jevois_data), &d);
120 if (num > 32)
LFATAL(
"Maximum allowed size is 32 bytes. You must break down larger transfers into 32 byte chunks.");
122 int fd = itsCam->lock();
127 static jevois_data d;
131 XIOCTL(fd, _IOWR(
'V', 197,
struct jevois_data), &d);
132 LDEBUG(
"Received " << num <<
" values from register 0x" << std::hex << reg);
133 memcpy(vals, d.data, num);
virtual bool isSPI() const override
Returns true if we use SPI for transfers. Used when ICM20948_REG_USER_CTRL is written to.
#define LDEBUG(msg)
Convenience macro for users to print out console or syslog messages, DEBUG level.
void readRegisterArray(unsigned short reg, unsigned char *vals, size_t num) override
Read an array of values from the camera's IMU registers.
void writeRegisterArray(unsigned short reg, unsigned char const *vals, size_t num) override
Write an array of values to the camera's IMU registers.
virtual ~IMUi2c()
Destructor.
IMUi2c(std::shared_ptr< Camera > cam)
Constructor.
Abstract interface to an ICM20948 inertial measurement unit (IMU)
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
unsigned char readRegister(unsigned short reg) override
Read a value from one of the camera's IMU registers.
void writeRegister(unsigned short reg, unsigned char val) override
Write a value to one of the IMU registers.