/**
  ******************************************************************************
  * @file    UART_User.h
  * @author  SINOMCU-AE
  * @brief   Header file of UART_User.c file.
  * 
  *          This file describes the GPIO macro definitions used:
  *     UART_BUFF_LEN,UART_START_CHAR,UART_END_CHAR
  *     typedef UartRecvStatus, UartRecvFinishFlag;
  * 
  ******************************************************************************
  * @attention 
  *                           DISCLAIMER
  * The present firmware which is for guidance only aims at providing customers
  * with coding information regarding their products in order for them to save
  * time. As a result, SinoMCU shall not be held liable for any direct,indirect
  * or consequential damages with respect to any claims arising from the content 
  * of such firmware and/or the use made by customers of the coding information 
  * contained herein in connection with their products.
  *
  * <h2><center>&copy; Copyright (c) 2021 sinomcu All rights reserved.</center></h2>
  *
  ******************************************************************************
  */

#ifndef __UART_USER_H
#define __UART_USER_H

#include "ms32f0xx.h"

#define UART_BUFF_LEN        64        // uart buff len,byte
#define UART_START_CHAR      '$'       // frame start char
#define UART_END_CHAR        0x0A      // frame end char 

typedef enum {
  WAIT_STAR = 0U,
  RECV_ING,
  RECV_FIN,                            // WAIT_STAR,RECV_ING,RECV_FIN:for state machine
  UART_ERROR_ORE,
  UART_ERROR_NIOSE,
  UART_ERROR_NO_DEF,
  UART_ERROR_CLR                       // UART_ERROR_xxx:for reg flag bit
} UartRecvStatus;

typedef enum {
  FINISH = 0U,
  NO_FINISH,
  FINISH_CLR,
  RECV_ERROR,
  RECV_ERROR_CLR                       // receive process state machine
} UartRecvFinishFlag;

void USART_CharRead_Callback(void);
void USART_Error_Callback(void);
void Send_buff_Uart(uint8_t *uart_buff);

#endif /* __UART_USER_H */ 

/******************************** END OF FILE *********************************/
