summaryrefslogtreecommitdiff
path: root/src/camera/veye_i2c.h
blob: 001d4833ddcbb5242a1c79b14ac5006127be8769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <cstdint>
#include <string>

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