46#define UART1_CLOCK 100000000U
47#define UART1_BAUD_TO_BRG_WITH_FRACTIONAL(x) (UART1_CLOCK/(x))
48#define UART1_BAUD_TO_BRG_WITH_BRGH_1(x) (UART1_CLOCK/(4U*(x))-1U)
49#define UART1_BAUD_TO_BRG_WITH_BRGH_0(x) (UART1_CLOCK/(16U*(x))-1U)
50#define UART1_BRG_TO_BAUD_WITH_FRACTIONAL(x) (UART1_CLOCK/(x))
51#define UART1_BRG_TO_BAUD_WITH_BRGH_1(x) (UART1_CLOCK/(4U*((x)+1U)))
52#define UART1_BRG_TO_BAUD_WITH_BRGH_0(x) (UART1_CLOCK/(16U*((x)+1U)))
54#define UART1_MIN_ACHIEVABLE_BAUD_WITH_FRACTIONAL 95U
55#define UART1_MIN_ACHIEVABLE_BAUD_WITH_BRGH_1 24U
69 .TransmitInterruptEnable = NULL,
70 .TransmitInterruptDisable = NULL,
79 .RxCompleteCallbackRegister = NULL,
80 .TxCompleteCallbackRegister = NULL,
81 .TxCollisionCallbackRegister = NULL,
82 .FramingErrorCallbackRegister = NULL,
83 .OverrunErrorCallbackRegister = NULL,
84 .ParityErrorCallbackRegister = NULL,
140 U1MODE = (0x8080 & ~(1<<15));
170 U1MODEbits.UARTEN = 1;
171 U1MODEbits.UTXEN = 1;
172 U1MODEbits.URXEN = 1;
188 while((U1STAHbits.URXBE == 1))
193 if ((U1STAbits.OERR == 1))
203 while(U1STAHbits.UTXBF == 1)
213 return (U1STAHbits.URXBE == 0);
218 return ((!U1STAHbits.UTXBF) && U1MODEbits.UTXEN);
223 return (
bool)(U1STAbits.TRMT && U1STAHbits.UTXBE);
228 U1MODEbits.UTXEN = 1;
233 U1MODEbits.UTXEN = 0;
238 U1INTbits.ABDIF = 0U;
239 U1INTbits.ABDIE = enable;
240 U1MODEbits.ABAUD = enable;
245 return U1MODEbits.ABAUD;
250 return U1INTbits.ABDIE;
256 if(U1STAbits.FERR == 1U)
260 if(U1STAbits.PERR== 1U)
264 if(U1STAbits.OERR== 1U)
269 if(U1STAbits.TXCIF== 1U)
274 if(U1STAbits.ABDOVF== 1U)
277 U1STAbits.ABDOVF = 0;
285 U1BRG = brgValue & 0xFFFFU;
286 U1BRGH = (brgValue >>16U) & 0x000FU;
294 brgValue = (brgValue << 16U) | U1BRG;
305 U1MODEHbits.BCLKMOD = 1;
311 U1MODEHbits.BCLKMOD = 0;
317 U1MODEHbits.BCLKMOD = 0;
321 U1BRG = brgValue & 0xFFFFU;
322 U1BRGH = (brgValue >>16U) & 0x000FU;
331 if((U1MODEHbits.BCLKMOD == 1) && (brgValue != 0))
335 else if(U1MODEbits.BRGH == 1)
#define UART1_BRG_TO_BAUD_WITH_BRGH_1(x)
#define UART1_BRG_TO_BAUD_WITH_BRGH_0(x)
#define UART1_BRG_TO_BAUD_WITH_FRACTIONAL(x)
static union @21 uartError
#define UART1_MIN_ACHIEVABLE_BAUD_WITH_BRGH_1
#define UART1_BAUD_TO_BRG_WITH_BRGH_1(x)
uint16_t txCollisionError
#define UART1_BAUD_TO_BRG_WITH_FRACTIONAL(x)
uint16_t autoBaudOverflow
#define UART1_MIN_ACHIEVABLE_BAUD_WITH_FRACTIONAL
#define UART1_BAUD_TO_BRG_WITH_BRGH_0(x)
This is the generated driver header file for the UART1 driver.
@ UART_ERROR_TX_COLLISION_MASK
@ UART_ERROR_FRAMING_MASK
@ UART_ERROR_RX_OVERRUN_MASK
@ UART_ERROR_AUTOBAUD_OVERFLOW_MASK
void UART1_BaudRateSet(uint32_t baudRate)
Sets the calculated Baud-Rate of UART1.
void UART1_Initialize(void)
Initializes the UART driver.
void UART1_TransmitDisable(void)
Disables UART1 transmit.
void UART1_AutoBaudSet(bool enable)
Enables or disables UART1 Auto-Baud detection.
bool UART1_IsRxReady(void)
Returns a boolean value if data is available to read.
void UART1_TransmitEnable(void)
Enables UART1 transmit.
uint8_t UART1_Read(void)
Reads a byte of data from the UART1.
const struct UART_INTERFACE UART1_Drv
Structure object of type UART_INTERFACE with the custom name given by the user in the Melody Driver U...
bool UART1_IsTxDone(void)
Indicates if all bytes have been transferred.
void UART1_Write(uint8_t txData)
Writes a byte of data to the UART1.
size_t UART1_ErrorGet(void)
Returns the error status of UART1.
void UART1_Deinitialize(void)
Deinitializes the UART to POR values.
bool UART1_AutoBaudQuery(void)
Returns the status of Auto-Baud detection.
bool UART1_AutoBaudEventEnableGet(void)
Returns enable state of the Auto-Baud feature.
uint32_t UART1_BaudRateGet(void)
Gets the actual Baud-Rate of UART1.
uint32_t UART1_BRGCountGet(void)
Gets the BRG value of UART1.
bool UART1_IsTxReady(void)
Returns a boolean value if data can be written.
void UART1_BRGCountSet(uint32_t brgValue)
Sets the BRG value of UART1.
Structure containing the function pointers of UART driver.
void(* Initialize)(void)
Pointer to UARTx_Initialize e.g. UART1_Initialize.