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,
123 U1MODEbits.UARTEN = 1;
124 U1MODEbits.UTXEN = 1;
125 U1MODEbits.URXEN = 1;
140 while((U1STAHbits.URXBE == 1))
145 if ((U1STAbits.OERR == 1))
155 while(U1STAHbits.UTXBF == 1)
165 return (U1STAHbits.URXBE == 0);
170 return ((!U1STAHbits.UTXBF) && U1MODEbits.UTXEN);
175 return (
bool)(U1STAbits.TRMT && U1STAHbits.UTXBE);
180 U1MODEbits.UTXEN = 1;
185 U1MODEbits.UTXEN = 0;
190 U1INTbits.ABDIF = 0U;
191 U1INTbits.ABDIE = enable;
192 U1MODEbits.ABAUD = enable;
197 return U1MODEbits.ABAUD;
202 return U1INTbits.ABDIE;
208 if(U1STAbits.FERR == 1U)
212 if(U1STAbits.PERR== 1U)
216 if(U1STAbits.OERR== 1U)
221 if(U1STAbits.TXCIF== 1U)
226 if(U1STAbits.ABDOVF== 1U)
229 U1STAbits.ABDOVF = 0;
237 U1BRG = brgValue & 0xFFFFU;
238 U1BRGH = (brgValue >>16U) & 0x000FU;
246 brgValue = (brgValue << 16U) | U1BRG;
257 U1MODEHbits.BCLKMOD = 1;
263 U1MODEHbits.BCLKMOD = 0;
269 U1MODEHbits.BCLKMOD = 0;
273 U1BRG = brgValue & 0xFFFFU;
274 U1BRGH = (brgValue >>16U) & 0x000FU;
283 if((U1MODEHbits.BCLKMOD == 1) && (brgValue != 0))
287 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)
#define UART1_MIN_ACHIEVABLE_BAUD_WITH_BRGH_1
#define UART1_BAUD_TO_BRG_WITH_BRGH_1(x)
uint16_t txCollisionError
static union @1 uartError
#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.