



#ifndef __UARTCOM_MG04_06_H

#define __UARTCOM_MG04_06_H

/**
 ******************************************************************************
 *
 * @file        BSP_UARTCOM.h
 * @brief       UART initial and mapping printf function.
 
 * @par         Project
 *              MG32x02z
 * @version     V1.00
 * @date        2022/03/02
 * @author      Megawin Software Center
 * @copyright   Copyright (c) 2017 MegaWin Technology Co., Ltd.
 *              All rights reserved.
 * 
 ******************************************************************************* 
 * @par Disclaimer
 * The Demo software is provided "AS IS" without any warranty, either
 * expressed or implied, including, but not limited to, the implied warranties
 * of merchantability and fitness for a particular purpose. The author will
 * not be liable for any special, incidental, consequential or indirect
 * damages due to loss of data or any other reason.
 * These statements agree with the world wide and local dictated laws about
 * authorship and violence against these laws.
 *******************************************************************************
 *******************************************************************************
 */
 
#include "MG32x02z.h"
#include "BSP_Common_MG04_06.h"
#include "MG32x02z_URT_DRV.h"


/** 
 * @name  Define 
 */                                                      
///@{

/*GPIO*/
#define URT_TXD_IOM           PINB(8)              /*!< Define UART TX pin for GPIO initial.*/
#define URT_TXD_AFS           11                   /*!< UART TX alternate function number in the pin.*/ 

#define URT_RXD_IOM           PINB(9)              /*!< Define UART RX pin for GPIO initial.*/
#define URT_RXD_AFS           11                   /*!< UART TX alternate function number in the pin.*/

/*UART Module*/
#define URTX                  URT4                 /*!< BSP UART Com use URT4.*/


// UART baud-rate = f (CK_URT) / ( (URT_PSR + 1) * (URT_RLR + 1) * (URT_OS + 1))
#define URT_PSR               0                    /*!< Prescaler counter reload value in UART Baud-Rate Generator.*/
#define URT_RLR               25                   /*!< Counter reload value in UART Baud-Rate Generator.*/
#define URT_OS                15                   /*!< UART oversamping (It can set 7 ~ 31).*/


///@}


/** 
 * @name  Function  
 */                                                      
///@{

void BSP_UARTCom_Init(void);
void BSP_InitCallback(void);
///@}

#endif






