/*
 * uart.h
 *
 *  Created on: 2020. 8. 3.
 *      Author: parkyj
 */

#ifndef UART_H_
#define UART_H_

#include <stdbool.h>
#include "main.h"
#define hTerminal    huart3
#define hTest    huart1


#define QUEUE_BUFFER_LENGTH 128

typedef struct
{
    int head, tail, data;
    uint8_t Buffer[QUEUE_BUFFER_LENGTH];
}UARTQUEUE, *pUARTQUEUE;
typedef struct  {
   uint8_t buffer[QUEUE_BUFFER_LENGTH];
   volatile uint16_t input_p;
   volatile uint16_t output_p;
} uart_hal_tx_type;

extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart3;


extern UARTQUEUE TerminalQueue;
void PutDataToUartQueue(UART_HandleTypeDef *huart, uint8_t data);
void InitUartQueue(pUARTQUEUE pQueue);
void GetDataFromUartQueue(UART_HandleTypeDef *huart);
bool Get_UartRcv(void);
void Set_UartRcv(bool);
void Uart1_Data_Send(uint8_t* data,uint16_t size);
void Uart_Check(void);

#endif /* UART_H_ */
