#pragma once #include #include namespace veye { namespace imx287m { class i2c { public: i2c(const std::string &name = "/dev/i2c-2", const int address = 0x3b); ~i2c(); public: bool read(uint16_t reg, uint32_t &value); bool write(uint16_t reg, const uint32_t value); private: bool open(); private: int m_fd{-1}; std::string m_name; int m_address{-1}; }; bool i2cRead(int fd, uint8_t i2c_addr, uint16_t reg, uint32_t &value); bool i2cWrite(int fd, uint16_t reg, const uint32_t value); bool test(uint32_t value); } // namespace imx287m } // namespace veye