#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);
}
