JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
IMUi2c.H
Go to the documentation of this file.
1// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2//
3// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2020 by Laurent Itti, the University of Southern
4// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5//
6// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10// License for more details. You should have received a copy of the GNU General Public License along with this program;
11// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12//
13// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16/*! \file */
17
18#pragma once
19
20#include <jevois/Core/IMU.H>
21#include <memory>
22
23namespace jevois
24{
25 class Camera;
26
27 //! IMU with I2C interface shared with camera sensor, such as ICM20948 on JeVois-A33 AR0135 camera sensor board
28 class IMUi2c : public IMU
29 {
30 public:
31
32 //! Constructor
33 IMUi2c(std::shared_ptr<Camera> cam);
34
35 //! Destructor
36 virtual ~IMUi2c();
37
38 //! Returns true if we use SPI for transfers. Used when ICM20948_REG_USER_CTRL is written to
39 virtual bool isSPI() const override;
40
41 //! @name Access functions for IMU registers
42 //! @{
43
44 //! Write a value to one of the IMU registers
45 /*! See base class jevois::IMU for full docs. */
46 void writeRegister(unsigned short reg, unsigned char val) override;
47
48 //! Read a value from one of the camera's IMU registers
49 /*! See base class jevois::IMU for full docs. */
50 unsigned char readRegister(unsigned short reg) override;
51
52 //! Write an array of values to the camera's IMU registers
53 /*! See base class jevois::IMU for full docs. */
54 void writeRegisterArray(unsigned short reg, unsigned char const * vals, size_t num) override;
55
56 //! Read an array of values from the camera's IMU registers
57 /*! See base class jevois::IMU for full docs. */
58 void readRegisterArray(unsigned short reg, unsigned char * vals, size_t num) override;
59
60 //! @}
61
62 private:
63 std::shared_ptr<Camera> itsCam;
64 void selectBank(int fd, unsigned short reg);
65 uint8_t itsIMUbank;
66 };
67
68
69} // namespace jevois
Abstract interface to an ICM20948 inertial measurement unit (IMU)
Definition IMU.H:28
IMU with I2C interface shared with camera sensor, such as ICM20948 on JeVois-A33 AR0135 camera sensor...
Definition IMUi2c.H:29
virtual ~IMUi2c()
Destructor.
Definition IMUi2c.C:40
virtual bool isSPI() const override
Returns true if we use SPI for transfers. Used when ICM20948_REG_USER_CTRL is written to.
Definition IMUi2c.C:44
void readRegisterArray(unsigned short reg, unsigned char *vals, size_t num) override
Read an array of values from the camera's IMU registers.
Definition IMUi2c.C:118
unsigned char readRegister(unsigned short reg) override
Read a value from one of the camera's IMU registers.
Definition IMUi2c.C:79
void writeRegisterArray(unsigned short reg, unsigned char const *vals, size_t num) override
Write an array of values to the camera's IMU registers.
Definition IMUi2c.C:96
void writeRegister(unsigned short reg, unsigned char val) override
Write a value to one of the IMU registers.
Definition IMUi2c.C:62
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2