Camera_driver: refactored version of camera driver
This commit is contained in:
18
resources/FC_camera/App/butcube_imager.cpp
Normal file
18
resources/FC_camera/App/butcube_imager.cpp
Normal 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(GPIOB, CAMERA_CS_Pin, (GPIO_PinState)state);
|
||||
}
|
32
resources/FC_camera/App/butcube_imager.hpp
Normal file
32
resources/FC_camera/App/butcube_imager.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @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;
|
||||
|
||||
class ButCube_imager
|
||||
{
|
||||
private:
|
||||
vector<UART_HandleTypeDef> uart_output_interfaces;
|
||||
|
||||
public:
|
||||
ButCube_imager() = default;
|
||||
|
||||
int Add_output(UART_HandleTypeDef uart_output);
|
||||
|
||||
int Transmit(vector<uint8_t> source);
|
||||
|
||||
void Camera_power(bool state);
|
||||
};
|
Reference in New Issue
Block a user