/**
 * @file OV2640.hpp
 * @author Petr Malaník (TheColonelYoung(at)gmail(dot)com)
 * @brief
 * @version 0.1
 * @date 11.09.2022
 */

#pragma once

#include "SPI_camera.hpp"
#include "OV2640_regs.hpp"

using namespace std;
typedef unsigned int uint;

/**
 * @brief 2MP SPI based camera capable of JPEG compression, based on ArduChip
 */
class OV2640: protected SPI_camera
{
private:
    /**
     * @brief Initialize camera sensor for JPEG capture, without resolution settings
     */
    void Init() override final;

public:
    /**
     * @brief Inherit constructor from parent class SPI_camera
     */
    using SPI_camera::SPI_camera;

    /**
     * @brief Initialize camera sensor for JPEG capture
     *
     * @param regs Requested resolution of camera
     */
    void Init(const vector<Register_blob_8> &regs);

    /**
     * @brief Initializes capture of image, waits for capture, transmit image into MCU memory
     */
    void Capture() override final;

    /**
     * @brief Return pointer to last captured image data
     *
     * @return vector<uint8_t>  Pointer to last captured image data
     */
    vector<uint8_t> Image_data(){ return image_data; };
};


