Camera_driver: remove legacy driver

This commit is contained in:
Petr Malanik
2023-01-23 21:04:33 +01:00
parent 28345045ba
commit 5f7f569ae7
1304 changed files with 501 additions and 1099768 deletions

View File

@ -0,0 +1,18 @@
#include "butcube_imager.hpp"
int ButCube_imager::Transmit(vector<uint8_t> source){
for( auto &uart_output : uart_output_interfaces){
HAL_UART_Transmit(&uart_output, source.data(), source.size(), HAL_MAX_DELAY);
HAL_Delay(200);
}
return uart_output_interfaces.size() * source.size();
}
int ButCube_imager::Add_output(UART_HandleTypeDef uart_output){
uart_output_interfaces.emplace_back(uart_output);
return uart_output_interfaces.size();
}
void ButCube_imager::Camera_power(bool state){
HAL_GPIO_WritePin(GPIOA, CAMERA_EN_Pin, (GPIO_PinState)!state);
}

View File

@ -0,0 +1,59 @@
/**
* @file OV2640.hpp
* @author Petr Malaník (TheColonelYoung(at)gmail(dot)com)
* @brief
* @version 0.1
* @date 11.09.2022
*/
#pragma once
#include "stm32l4xx_hal.h"
#include "main.h"
#include <vector>
using namespace std;
typedef unsigned int uint;
/**
* @brief Captures image data from camera, control power to camera and transmit data on selected interfaces
* Currently is only UART interface supported
*/
class ButCube_imager
{
private:
/**
* @brief UART interfaces to which data will be exported, interfaces muse be configured in advance
*/
vector<UART_HandleTypeDef> uart_output_interfaces;
public:
/**
* @brief Construct a new ButCube_imager object
*/
ButCube_imager() = default;
/**
* @brief Add UART output to list on which data are exported
*
* @param uart_output UART output to which export data from camera
* @return int
*/
int Add_output(UART_HandleTypeDef uart_output);
/**
* @brief Transmit data from source to selected interfaces
*
* @param source Source of image data
* @return int Count of bytes exported
*/
int Transmit(vector<uint8_t> source);
/**
* @brief Enable or power to camera, controls load switch on camera power rail
*
* @param state true = Enabled, false = Disabled
*/
void Camera_power(bool state);
};