Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches

Universal Asynchronous Receiver Transmitter driver using dsPIC MCUs. More...

+ Collaboration diagram for UART Driver:

Files

file  uart1.c
 This is the generated driver source file for the UART1 driver.
 
file  uart1.h
 This is the generated driver header file for the UART1 driver.
 
file  uart_types.h
 This is the generated driver types header file for the UART driver.
 

Data Structures

struct  UART_INTERFACE
 Structure containing the function pointers of UART driver. More...
 

Macros

#define UART1_Drv_Initialize   UART1_Initialize
 This macro defines the Custom Name for UART1_Initialize API.
 
#define UART1_Drv_Deinitialize   UART1_Deinitialize
 This macro defines the Custom Name for UART1_Deinitialize API.
 
#define UART1_Drv_Read   UART1_Read
 This macro defines the Custom Name for UART1_Read API.
 
#define UART1_Drv_Write   UART1_Write
 This macro defines the Custom Name for UART1_Write API.
 
#define UART1_Drv_IsRxReady   UART1_IsRxReady
 This macro defines the Custom Name for UART1_IsRxReady API.
 
#define UART1_Drv_IsTxReady   UART1_IsTxReady
 This macro defines the Custom Name for UART1_IsTxReady API.
 
#define UART1_Drv_IsTxDone   UART1_IsTxDone
 This macro defines the Custom Name for UART1_IsTxDone API.
 
#define UART1_Drv_TransmitEnable   UART1_TransmitEnable
 This macro defines the Custom Name for UART1_TransmitEnable API.
 
#define UART1_Drv_TransmitDisable   UART1_TransmitDisable
 This macro defines the Custom Name for UART1_TransmitDisable API.
 
#define UART1_Drv_AutoBaudSet   UART1_AutoBaudSet
 This macro defines the Custom Name for UART1_AutoBaudSet API.
 
#define UART1_Drv_AutoBaudQuery   UART1_AutoBaudQuery
 This macro defines the Custom Name for UART1_AutoBaudQuery API.
 
#define UART1_Drv_AutoBaudEventEnableGet   UART1_AutoBaudEventEnableGet
 This macro defines the Custom Name for UART1_AutoBaudEventEnableGet API.
 
#define UART1_Drv_ErrorGet   UART1_ErrorGet
 This macro defines the Custom Name for UART1_ErrorGet API.
 
#define UART1_Drv_BRGCountSet   UART1_BRGCountSet
 This macro defines the Custom Name for UART1_BRGCountSet API.
 
#define UART1_Drv_BRGCountGet   UART1_BRGCountGet
 This macro defines the Custom Name for UART1_BRGCountGet API.
 
#define UART1_Drv_BaudRateSet   UART1_BaudRateSet
 This macro defines the Custom Name for UART1_BaudRateSet API.
 
#define UART1_Drv_BaudRateGet   UART1_BaudRateGet
 This macro defines the Custom Name for UART1_BaudRateGet API.
 

Functions

void UART1_Initialize (void)
 Initializes the UART driver.
 
void UART1_Deinitialize (void)
 Deinitializes the UART to POR values.
 
uint8_t UART1_Read (void)
 Reads a byte of data from the UART1.
 
void UART1_Write (uint8_t data)
 Writes a byte of data to the UART1.
 
bool UART1_IsRxReady (void)
 Returns a boolean value if data is available to read.
 
bool UART1_IsTxReady (void)
 Returns a boolean value if data can be written.
 
bool UART1_IsTxDone (void)
 Indicates if all bytes have been transferred.
 
void UART1_TransmitEnable (void)
 Enables UART1 transmit.
 
void UART1_TransmitDisable (void)
 Disables UART1 transmit.
 
void UART1_AutoBaudSet (bool enable)
 Enables or disables UART1 Auto-Baud detection.
 
bool UART1_AutoBaudQuery (void)
 Returns the status of Auto-Baud detection.
 
bool UART1_AutoBaudEventEnableGet (void)
 Returns enable state of the Auto-Baud feature.
 
void UART1_BRGCountSet (uint32_t brgValue)
 Sets the BRG value of UART1.
 
uint32_t UART1_BRGCountGet (void)
 Gets the BRG value of UART1.
 
void UART1_BaudRateSet (uint32_t baudRate)
 Sets the calculated Baud-Rate of UART1.
 
uint32_t UART1_BaudRateGet (void)
 Gets the actual Baud-Rate of UART1.
 
size_t UART1_ErrorGet (void)
 Returns the error status of UART1.
 

Variables

const struct UART_INTERFACE UART1_Drv
 Structure object of type UART_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. UART1 can be changed by the user in the UART user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.
 

Detailed Description

Macro Definition Documentation

◆ UART1_Drv_AutoBaudEventEnableGet

#define UART1_Drv_AutoBaudEventEnableGet   UART1_AutoBaudEventEnableGet

Definition at line 132 of file uart1.h.

◆ UART1_Drv_AutoBaudQuery

#define UART1_Drv_AutoBaudQuery   UART1_AutoBaudQuery

Definition at line 126 of file uart1.h.

◆ UART1_Drv_AutoBaudSet

#define UART1_Drv_AutoBaudSet   UART1_AutoBaudSet

Definition at line 120 of file uart1.h.

◆ UART1_Drv_BaudRateGet

#define UART1_Drv_BaudRateGet   UART1_BaudRateGet

Definition at line 162 of file uart1.h.

◆ UART1_Drv_BaudRateSet

#define UART1_Drv_BaudRateSet   UART1_BaudRateSet

Definition at line 156 of file uart1.h.

◆ UART1_Drv_BRGCountGet

#define UART1_Drv_BRGCountGet   UART1_BRGCountGet

Definition at line 150 of file uart1.h.

◆ UART1_Drv_BRGCountSet

#define UART1_Drv_BRGCountSet   UART1_BRGCountSet

Definition at line 144 of file uart1.h.

◆ UART1_Drv_Deinitialize

#define UART1_Drv_Deinitialize   UART1_Deinitialize

Definition at line 72 of file uart1.h.

◆ UART1_Drv_ErrorGet

#define UART1_Drv_ErrorGet   UART1_ErrorGet

Definition at line 138 of file uart1.h.

◆ UART1_Drv_Initialize

#define UART1_Drv_Initialize   UART1_Initialize

Definition at line 66 of file uart1.h.

◆ UART1_Drv_IsRxReady

#define UART1_Drv_IsRxReady   UART1_IsRxReady

Definition at line 90 of file uart1.h.

◆ UART1_Drv_IsTxDone

#define UART1_Drv_IsTxDone   UART1_IsTxDone

Definition at line 102 of file uart1.h.

◆ UART1_Drv_IsTxReady

#define UART1_Drv_IsTxReady   UART1_IsTxReady

Definition at line 96 of file uart1.h.

◆ UART1_Drv_Read

#define UART1_Drv_Read   UART1_Read

Definition at line 78 of file uart1.h.

◆ UART1_Drv_TransmitDisable

#define UART1_Drv_TransmitDisable   UART1_TransmitDisable

Definition at line 114 of file uart1.h.

◆ UART1_Drv_TransmitEnable

#define UART1_Drv_TransmitEnable   UART1_TransmitEnable

Definition at line 108 of file uart1.h.

◆ UART1_Drv_Write

#define UART1_Drv_Write   UART1_Write

Definition at line 84 of file uart1.h.

Function Documentation

◆ UART1_AutoBaudEventEnableGet()

bool UART1_AutoBaudEventEnableGet ( void )
Parameters
none
Returns
true - Auto-Baud is enabled
false - Auto-Baud is disabled

Definition at line 248 of file uart1.c.

◆ UART1_AutoBaudQuery()

bool UART1_AutoBaudQuery ( void )
Parameters
none
Returns
true - Auto-Baud detection in progress or counter overflow occurred
false - Auto-Baud detection is complete or disabled

Definition at line 243 of file uart1.c.

◆ UART1_AutoBaudSet()

void UART1_AutoBaudSet ( bool enable)
Parameters
[in]enable- true, starts the auto-baud detection
[in]enable- false, disables the auto-baud detection
Returns
none

Definition at line 236 of file uart1.c.

◆ UART1_BaudRateGet()

uint32_t UART1_BaudRateGet ( void )
Parameters
none
Returns
Actual baud-rate of UART1

Definition at line 325 of file uart1.c.

+ Here is the call graph for this function:

◆ UART1_BaudRateSet()

void UART1_BaudRateSet ( uint32_t baudRate)
Parameters
[in]baudRate- Value of Baud-Rate to be set
Returns
none
Note
Make sure the is no transmission in progress using UART1_IsTxDone function

Definition at line 299 of file uart1.c.

◆ UART1_BRGCountGet()

uint32_t UART1_BRGCountGet ( void )
Parameters
none
Returns
Combined BRG value upto 20 bits

Definition at line 289 of file uart1.c.

+ Here is the caller graph for this function:

◆ UART1_BRGCountSet()

void UART1_BRGCountSet ( uint32_t brgValue)
Parameters
[in]baudRate- BRG value upto 20 bits
Returns
none
Note
Make sure the is no transmission in progress using UART1_IsTxDone function

Definition at line 283 of file uart1.c.

◆ UART1_Deinitialize()

void UART1_Deinitialize ( void )
Parameters
none
Returns
none

Definition at line 176 of file uart1.c.

◆ UART1_ErrorGet()

size_t UART1_ErrorGet ( void )
Parameters
none
Returns
Errors with masking as per UART1_ERROR_MASKS

Definition at line 253 of file uart1.c.

◆ UART1_Initialize()

void UART1_Initialize ( void )
Parameters
none
Returns
none

Set the UART1 module to the options selected in the user interface. Make sure to set LAT bit corresponding to TxPin as high before UART initialization

Definition at line 104 of file uart1.c.

◆ UART1_IsRxReady()

bool UART1_IsRxReady ( void )
Parameters
none
Returns
true - Data available to read
false - Data not available to read

Definition at line 211 of file uart1.c.

◆ UART1_IsTxDone()

bool UART1_IsTxDone ( void )
Parameters
none
Returns
true - All bytes transferred
false - Data transfer is pending

Definition at line 221 of file uart1.c.

◆ UART1_IsTxReady()

bool UART1_IsTxReady ( void )
Parameters
none
Returns
true - Data can be written
false - Data can not be written

Definition at line 216 of file uart1.c.

◆ UART1_Read()

uint8_t UART1_Read ( void )
Precondition
UART1_Initialize function should have been called before calling this function. The transfer status should be checked to see if the receiver is not empty before calling this function.
Parameters
none
Returns
A data byte received by the driver

Definition at line 186 of file uart1.c.

◆ UART1_TransmitDisable()

void UART1_TransmitDisable ( void )
Parameters
none
Returns
none

Definition at line 231 of file uart1.c.

◆ UART1_TransmitEnable()

void UART1_TransmitEnable ( void )
Parameters
none
Returns
none

Definition at line 226 of file uart1.c.

◆ UART1_Write()

void UART1_Write ( uint8_t data)
Precondition
UART1_Initialize function should have been called before calling this function. The transfer status should be checked to see if transmitter is not full before calling this function.
Parameters
[in]data- Data byte to write to the UART1
Returns
none

Definition at line 201 of file uart1.c.

Variable Documentation

◆ UART1_Drv

const struct UART_INTERFACE UART1_Drv
extern

Definition at line 59 of file uart1.c.