#include "config.h"
#include "lib_mcu/uart/uart_lib.h"
Include dependency graph for uart_lib.c:
Go to the source code of this file.
Functions | |
bit | uart_test_hit (void) |
This function allows to inform if a character was received. | |
bit | uart_init (void) |
This function configures the UART configuration and timming following the constant definition of BAUDRATE and enables the UART controller. | |
int | uart_putchar (int ch) |
char | uart_getchar (void) |
This function allows to get a character from the UART. |
bit uart_test_hit | ( | void | ) |
This function allows to inform if a character was received.
Definition at line 27 of file uart_lib.c.
References Uart_rx_ready.
Referenced by cdc_task().
00028 { 00029 return Uart_rx_ready(); 00030 }
bit uart_init | ( | void | ) |
This function configures the UART configuration and timming following the constant definition of BAUDRATE and enables the UART controller.
Definition at line 33 of file uart_lib.c.
References BAUDRATE, TRUE, UART_CONFIG, Uart_double_bdr, Uart_enable, Uart_hw_init, and Uart_set_baudrate.
Referenced by cdc_task_init().
00034 { 00035 #ifndef UART_U2 00036 Uart_set_baudrate(BAUDRATE); 00037 Uart_hw_init(UART_CONFIG); 00038 #else 00039 Uart_set_baudrate(BAUDRATE/2); 00040 Uart_double_bdr(); 00041 Uart_hw_init(UART_CONFIG); 00042 00043 #endif 00044 Uart_enable(); 00045 return TRUE; 00046 }
int uart_putchar | ( | int | ch | ) |
Definition at line 49 of file uart_lib.c.
References Uart_send_byte, Uart_set_tx_busy, and Uart_tx_ready.
Referenced by cdc_task().
00050 { 00051 while(!Uart_tx_ready()); 00052 Uart_set_tx_busy(); // Set Busy flag before sending (always) 00053 Uart_send_byte(ch); 00054 00055 return ch; 00056 }
char uart_getchar | ( | void | ) |
This function allows to get a character from the UART.
Definition at line 61 of file uart_lib.c.
References Uart_ack_rx_byte, Uart_get_byte, and Uart_rx_ready.
Referenced by cdc_task().
00062 { 00063 register char c; 00064 00065 while(!Uart_rx_ready()); 00066 c = Uart_get_byte(); 00067 Uart_ack_rx_byte(); 00068 return c; 00069 }