#pragma once
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_rcc.h"
#include "global_macros.h"

namespace Usart3
{
    void Init(); //initialization
    uint8_t read(); //read byte from buffer
    uint8_t peek(); //peek byte from buffer
    void write(uint8_t byte); //send byte
    uint16_t available(); //number of available bytes
    extern volatile uint16_t tx_cnt_e; //TX counter end
    extern volatile uint16_t rx_cnt_e; //RX counter end
    extern volatile uint16_t tx_cnt_b; //TX counter begin
    extern volatile uint16_t rx_cnt_b; //RX counter begin
    extern volatile uint8_t tx[512]; //TX buffer
    extern volatile uint8_t rx[512]; //RX buffer
    extern volatile bool flag; //if sending is complete
}
