summaryrefslogtreecommitdiff
path: root/src/camera/innomakerov9281.h
blob: bcafc12e36fbae83e7393114191cf4069a4e1be8 (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
32
33
34
35
36
#pragma once

#include <cstdint>

#include "constants.h"
#include "image.h"

class InnoMakerOV9281
{
public:
    using buffer_t = std::array<uint8_t, img_size>;

public:
    InnoMakerOV9281();
    ~InnoMakerOV9281();

public:
    bool init();

    bool setExposureTimeMs(int value);
    bool setGain(int value);

    bool getImage(Image &image);

private:
    bool setCamParam(unsigned int v4l2controlId, int value);
    bool openCam();
    bool selectCam(int camIdx = 0);
    bool initCam();

private:
    int m_cam_fd{-1};
    static constexpr uint8_t BUFFER_COUNT{3};
    uint8_t *video_buffer_ptr[BUFFER_COUNT];
    // buffer_t m_buf;
};