mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
[uart] less macros: uart_getch function and uart_char_available static inline function
if uart is hardcoded, use function directly
This commit is contained in:
@@ -59,34 +59,34 @@ int main( void ) {
|
|||||||
while(1) {
|
while(1) {
|
||||||
if (T0TC > (rx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(1);
|
if (T0TC > (rx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(1);
|
||||||
if (T0TC > (tx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(2);
|
if (T0TC > (tx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(2);
|
||||||
if (Uart0ChAvailable() && VCOM_check_free_space(1)) {
|
if (uart_char_available(&uart0) && VCOM_check_free_space(1)) {
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
rx_time = T0TC;
|
rx_time = T0TC;
|
||||||
inc = Uart0Getch();
|
inc = uart_getch(&uart0);
|
||||||
VCOM_putchar(inc);
|
VCOM_putchar(inc);
|
||||||
}
|
}
|
||||||
if (VCOM_check_available() && Uart0CheckFreeSpace(1)) {
|
if (VCOM_check_available() && uart_check_free_space(&uart0, 1)) {
|
||||||
LED_ON(2);
|
LED_ON(2);
|
||||||
tx_time = T0TC;
|
tx_time = T0TC;
|
||||||
inc = VCOM_getchar();
|
inc = VCOM_getchar();
|
||||||
Uart0Transmit(inc);
|
uart_transmit(&uart0, inc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
while(1) {
|
while(1) {
|
||||||
if (T0TC > (rx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(1);
|
if (T0TC > (rx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(1);
|
||||||
if (T0TC > (tx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(2);
|
if (T0TC > (tx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(2);
|
||||||
if (Uart1ChAvailable() && VCOM_check_free_space(1)) {
|
if (uart_char_available(&uart1) && VCOM_check_free_space(1)) {
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
rx_time = T0TC;
|
rx_time = T0TC;
|
||||||
inc = Uart1Getch();
|
inc = uart_getch(&uart1);
|
||||||
VCOM_putchar(inc);
|
VCOM_putchar(inc);
|
||||||
}
|
}
|
||||||
if (VCOM_check_available() && Uart1CheckFreeSpace(1)) {
|
if (VCOM_check_available() && uart_check_free_space(&uart1, 1)) {
|
||||||
LED_ON(2);
|
LED_ON(2);
|
||||||
tx_time = T0TC;
|
tx_time = T0TC;
|
||||||
inc = VCOM_getchar();
|
inc = VCOM_getchar();
|
||||||
Uart1Transmit(inc);
|
uart_transmit(&uart1, inc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -449,10 +449,10 @@ int do_log(void)
|
|||||||
|
|
||||||
#ifdef USE_UART0
|
#ifdef USE_UART0
|
||||||
temp = 0;
|
temp = 0;
|
||||||
while (Uart0ChAvailable() && (temp++ < 128))
|
while (uart_char_available(&uart0) && (temp++ < 128))
|
||||||
{
|
{
|
||||||
// LED_TOGGLE(LED_GREEN);
|
// LED_TOGGLE(LED_GREEN);
|
||||||
inc = Uart0Getch();
|
inc = uart_getch(&uart1);
|
||||||
#ifdef LOG_XBEE
|
#ifdef LOG_XBEE
|
||||||
log_xbee(inc, LOG_SOURCE_UART0);
|
log_xbee(inc, LOG_SOURCE_UART0);
|
||||||
#else
|
#else
|
||||||
@@ -466,10 +466,10 @@ int do_log(void)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef USE_UART1
|
#ifdef USE_UART1
|
||||||
temp = 0;
|
temp = 0;
|
||||||
while (Uart1ChAvailable() && (temp++ < 128))
|
while (uart_char_available(&uart1) && (temp++ < 128))
|
||||||
{
|
{
|
||||||
// LED_TOGGLE(LED_GREEN);
|
// LED_TOGGLE(LED_GREEN);
|
||||||
inc = Uart1Getch();
|
inc = uart_getch(&uart1);
|
||||||
#ifdef LOG_XBEE
|
#ifdef LOG_XBEE
|
||||||
log_xbee(inc, LOG_SOURCE_UART1);
|
log_xbee(inc, LOG_SOURCE_UART1);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -248,28 +248,28 @@ static inline void uart_transfer_event(void) {
|
|||||||
static uint8_t uart3_enabled = 1;
|
static uint8_t uart3_enabled = 1;
|
||||||
|
|
||||||
// We cache data availability, so it doesn't change between checks:
|
// We cache data availability, so it doesn't change between checks:
|
||||||
uart1_has_data = Uart1ChAvailable();
|
uart1_has_data = uart_char_available(&uart1);
|
||||||
uart2_has_data = Uart2ChAvailable();
|
uart2_has_data = uart_char_available(&uart2);
|
||||||
uart3_has_data = Uart3ChAvailable();
|
uart3_has_data = uart_char_available(&uart3);
|
||||||
|
|
||||||
// Fill stage: Read data from UARTs into buffers, or increment
|
// Fill stage: Read data from UARTs into buffers, or increment
|
||||||
// their timeouts if no data is available:
|
// their timeouts if no data is available:
|
||||||
if(!uart1_sent && uart1_has_data) {
|
if(!uart1_sent && uart1_has_data) {
|
||||||
spistream_uart1_msg.uart_data[uart1_num_rx_bytes] = Uart1Getch();
|
spistream_uart1_msg.uart_data[uart1_num_rx_bytes] = uart_getch(&uart1);
|
||||||
timeout_uart1 = 0;
|
timeout_uart1 = 0;
|
||||||
if(uart1_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH)
|
if(uart1_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH)
|
||||||
{ uart1_num_rx_bytes++; }
|
{ uart1_num_rx_bytes++; }
|
||||||
} else { if(timeout_uart1 < timeout_trig) { timeout_uart1++; } }
|
} else { if(timeout_uart1 < timeout_trig) { timeout_uart1++; } }
|
||||||
|
|
||||||
if(!uart2_sent && uart2_has_data) {
|
if(!uart2_sent && uart2_has_data) {
|
||||||
spistream_uart2_msg.uart_data[uart2_num_rx_bytes] = Uart2Getch();
|
spistream_uart2_msg.uart_data[uart2_num_rx_bytes] = uart_getch(&uart2);
|
||||||
timeout_uart2 = 0;
|
timeout_uart2 = 0;
|
||||||
if(uart2_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH)
|
if(uart2_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH)
|
||||||
{ uart2_num_rx_bytes++; }
|
{ uart2_num_rx_bytes++; }
|
||||||
} else { if(timeout_uart2 < timeout_trig) { timeout_uart2++; } }
|
} else { if(timeout_uart2 < timeout_trig) { timeout_uart2++; } }
|
||||||
|
|
||||||
if(!uart3_sent && uart3_has_data) {
|
if(!uart3_sent && uart3_has_data) {
|
||||||
spistream_uart3_msg.uart_data[uart3_num_rx_bytes] = Uart3Getch();
|
spistream_uart3_msg.uart_data[uart3_num_rx_bytes] = uart_getch(&uart3);
|
||||||
timeout_uart3 = 0;
|
timeout_uart3 = 0;
|
||||||
if(uart3_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH)
|
if(uart3_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH)
|
||||||
{ uart3_num_rx_bytes++; }
|
{ uart3_num_rx_bytes++; }
|
||||||
|
|||||||
@@ -56,11 +56,10 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
static inline void main_event_task( void ) {
|
static inline void main_event_task( void ) {
|
||||||
|
|
||||||
if (Uart2ChAvailable())
|
if (uart_char_available(&uart2))
|
||||||
Uart1Transmit(Uart2Getch());
|
uart_transmit(&uart1, uart_getch(&uart2));
|
||||||
|
|
||||||
if (Uart1ChAvailable())
|
|
||||||
Uart2Transmit(Uart1Getch());
|
|
||||||
|
|
||||||
|
if (uart_char_available(&uart1))
|
||||||
|
uart_transmit(&uart2, uart_getch(&uart1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,8 +267,8 @@ static void test_uart_periodic(void) {
|
|||||||
|
|
||||||
if (idx_tx<sizeof(buf_src)) {
|
if (idx_tx<sizeof(buf_src)) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case OneToThree : Uart1Transmit(buf_src[idx_tx]); break;
|
case OneToThree : uart_transmit(&uart1, buf_src[idx_tx]); break;
|
||||||
case ThreeToOne : Uart3Transmit(buf_src[idx_tx]); break;
|
case ThreeToOne : uart_transmit(&uart3, buf_src[idx_tx]); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
idx_tx++;
|
idx_tx++;
|
||||||
@@ -278,8 +278,8 @@ static void test_uart_periodic(void) {
|
|||||||
|
|
||||||
static void test_uart_event(void) {
|
static void test_uart_event(void) {
|
||||||
|
|
||||||
if (Uart3ChAvailable()) {
|
if (uart_char_available(&uart3)) {
|
||||||
buf_dest[idx_rx] = Uart3Getch();
|
buf_dest[idx_rx] = uart_getch(&uart3);
|
||||||
if (idx_rx<sizeof(buf_src)) {
|
if (idx_rx<sizeof(buf_src)) {
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, sizeof(buf_src), buf_dest);
|
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, sizeof(buf_src), buf_dest);
|
||||||
idx_rx++;
|
idx_rx++;
|
||||||
@@ -296,8 +296,8 @@ static void test_uart_event(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart1ChAvailable()) {
|
if (uart_char_available(&uart1)) {
|
||||||
buf_dest[idx_rx] = Uart1Getch();
|
buf_dest[idx_rx] = uart_getch(&uart1);
|
||||||
if (idx_rx<sizeof(buf_src)) {
|
if (idx_rx<sizeof(buf_src)) {
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, sizeof(buf_src), buf_dest);
|
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, sizeof(buf_src), buf_dest);
|
||||||
idx_rx++;
|
idx_rx++;
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic( void ) {
|
static inline void main_periodic( void ) {
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
Uart1Transmit('a');
|
uart_transmit(&uart1, 'a');
|
||||||
Uart2Transmit('b');
|
uart_transmit(&uart2, 'b');
|
||||||
Uart3Transmit('c');
|
uart_transmit(&uart3, 'c');
|
||||||
|
|
||||||
if (Uart1ChAvailable()) {
|
if (uart_char_available(&uart1)) {
|
||||||
ch = Uart1Getch();
|
ch = uart_getch(&uart1);
|
||||||
if (ch == 'a') {
|
if (ch == 'a') {
|
||||||
LED_OFF(0);
|
LED_OFF(0);
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
@@ -65,8 +65,8 @@ static inline void main_periodic( void ) {
|
|||||||
LED_OFF(1);
|
LED_OFF(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart2ChAvailable()) {
|
if (uart_char_available(&uart2)) {
|
||||||
ch = Uart2Getch();
|
ch = uart_getch(&uart2);
|
||||||
if (ch == 'b') {
|
if (ch == 'b') {
|
||||||
LED_OFF(2);
|
LED_OFF(2);
|
||||||
LED_ON(3);
|
LED_ON(3);
|
||||||
@@ -79,8 +79,8 @@ static inline void main_periodic( void ) {
|
|||||||
LED_OFF(3);
|
LED_OFF(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart3ChAvailable()) {
|
if (uart_char_available(&uart3)) {
|
||||||
ch = Uart3Getch();
|
ch = uart_getch(&uart3);
|
||||||
if (ch == 'c') {
|
if (ch == 'c') {
|
||||||
LED_OFF(4);
|
LED_OFF(4);
|
||||||
LED_ON(5);
|
LED_ON(5);
|
||||||
|
|||||||
@@ -55,16 +55,16 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic( void ) {
|
static inline void main_periodic( void ) {
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
Uart1Transmit('a');
|
uart_transmit(&uart1, 'a');
|
||||||
Uart2Transmit('b');
|
uart_transmit(&uart2, 'b');
|
||||||
Uart3Transmit('c');
|
uart_transmit(&uart3, 'c');
|
||||||
Uart5Transmit('d');
|
uart_transmit(&uart5, 'd');
|
||||||
|
|
||||||
LED_OFF(1);
|
LED_OFF(1);
|
||||||
LED_OFF(2);
|
LED_OFF(2);
|
||||||
|
|
||||||
if (Uart1ChAvailable()) {
|
if (uart_char_available(&uart1)) {
|
||||||
ch = Uart1Getch();
|
ch = uart_getch(&uart1);
|
||||||
if (ch == 'a') {
|
if (ch == 'a') {
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -72,8 +72,8 @@ static inline void main_periodic( void ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart2ChAvailable()) {
|
if (uart_char_available(&uart2)) {
|
||||||
ch = Uart2Getch();
|
ch = uart_getch(&uart2);
|
||||||
if (ch == 'b') {
|
if (ch == 'b') {
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -81,8 +81,8 @@ static inline void main_periodic( void ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart3ChAvailable()) {
|
if (uart_char_available(&uart3)) {
|
||||||
ch = Uart3Getch();
|
ch = uart_getch(&uart3);
|
||||||
if (ch == 'c') {
|
if (ch == 'c') {
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -90,8 +90,8 @@ static inline void main_periodic( void ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart5ChAvailable()) {
|
if (uart_char_available(&uart5)) {
|
||||||
ch = Uart5Getch();
|
ch = uart_getch(&uart5);
|
||||||
if (ch == 'd') {
|
if (ch == 'd') {
|
||||||
LED_ON(1);
|
LED_ON(1);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -57,3 +57,8 @@ bool_t uart_check_free_space(struct uart_periph* p, uint8_t len) {
|
|||||||
return (uint16_t)(space - 1) >= len;
|
return (uint16_t)(space - 1) >= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t uart_getch(struct uart_periph* p) {
|
||||||
|
uint8_t ret = p->rx_buf[p->rx_extract_idx];
|
||||||
|
p->rx_extract_idx = (p->rx_extract_idx + 1) % UART_RX_BUFFER_SIZE;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|||||||
@@ -73,14 +73,11 @@ extern void uart_periph_init(struct uart_periph* p);
|
|||||||
extern void uart_periph_set_baudrate(struct uart_periph* p, enum UartBaud, bool_t hw_flow_control);
|
extern void uart_periph_set_baudrate(struct uart_periph* p, enum UartBaud, bool_t hw_flow_control);
|
||||||
extern void uart_transmit(struct uart_periph* p, uint8_t data);
|
extern void uart_transmit(struct uart_periph* p, uint8_t data);
|
||||||
extern bool_t uart_check_free_space(struct uart_periph* p, uint8_t len);
|
extern bool_t uart_check_free_space(struct uart_periph* p, uint8_t len);
|
||||||
|
extern uint8_t uart_getch(struct uart_periph* p);
|
||||||
|
|
||||||
#define UartChAvailable(_p) (_p.rx_insert_idx != _p.rx_extract_idx)
|
static inline bool_t uart_char_available(struct uart_periph* p) {
|
||||||
|
return (p->rx_insert_idx != p->rx_extract_idx);
|
||||||
#define UartGetch(_p) ({ \
|
}
|
||||||
uint8_t ret = _p.rx_buf[_p.rx_extract_idx]; \
|
|
||||||
_p.rx_extract_idx = (_p.rx_extract_idx + 1)%UART_RX_BUFFER_SIZE; \
|
|
||||||
ret; \
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_UART0
|
#ifdef USE_UART0
|
||||||
@@ -91,8 +88,8 @@ extern void uart0_init(void);
|
|||||||
#define Uart0CheckFreeSpace(_x) uart_check_free_space(&uart0, _x)
|
#define Uart0CheckFreeSpace(_x) uart_check_free_space(&uart0, _x)
|
||||||
#define Uart0Transmit(_x) uart_transmit(&uart0, _x)
|
#define Uart0Transmit(_x) uart_transmit(&uart0, _x)
|
||||||
#define Uart0SendMessage() {}
|
#define Uart0SendMessage() {}
|
||||||
#define Uart0ChAvailable() UartChAvailable(uart0)
|
#define Uart0ChAvailable() uart_char_available(&uart0)
|
||||||
#define Uart0Getch() UartGetch(uart0)
|
#define Uart0Getch() uart_getch(&uart0)
|
||||||
#define Uart0TxRunning uart0.tx_running
|
#define Uart0TxRunning uart0.tx_running
|
||||||
#define Uart0SetBaudrate(_b) uart_periph_set_baudrate(&uart0, _b, FALSE)
|
#define Uart0SetBaudrate(_b) uart_periph_set_baudrate(&uart0, _b, FALSE)
|
||||||
|
|
||||||
@@ -115,8 +112,8 @@ extern void uart1_init(void);
|
|||||||
#define Uart1CheckFreeSpace(_x) uart_check_free_space(&uart1, _x)
|
#define Uart1CheckFreeSpace(_x) uart_check_free_space(&uart1, _x)
|
||||||
#define Uart1Transmit(_x) uart_transmit(&uart1, _x)
|
#define Uart1Transmit(_x) uart_transmit(&uart1, _x)
|
||||||
#define Uart1SendMessage() {}
|
#define Uart1SendMessage() {}
|
||||||
#define Uart1ChAvailable() UartChAvailable(uart1)
|
#define Uart1ChAvailable() uart_char_available(&uart1)
|
||||||
#define Uart1Getch() UartGetch(uart1)
|
#define Uart1Getch() uart_getch(&uart1)
|
||||||
#define Uart1TxRunning uart1.tx_running
|
#define Uart1TxRunning uart1.tx_running
|
||||||
#if UART1_HW_FLOW_CONTROL
|
#if UART1_HW_FLOW_CONTROL
|
||||||
#define Uart1SetBaudrate(_b) uart_periph_set_baudrate(&uart1, _b, TRUE)
|
#define Uart1SetBaudrate(_b) uart_periph_set_baudrate(&uart1, _b, TRUE)
|
||||||
@@ -143,8 +140,8 @@ extern void uart2_init(void);
|
|||||||
#define Uart2CheckFreeSpace(_x) uart_check_free_space(&uart2, _x)
|
#define Uart2CheckFreeSpace(_x) uart_check_free_space(&uart2, _x)
|
||||||
#define Uart2Transmit(_x) uart_transmit(&uart2, _x)
|
#define Uart2Transmit(_x) uart_transmit(&uart2, _x)
|
||||||
#define Uart2SendMessage() {}
|
#define Uart2SendMessage() {}
|
||||||
#define Uart2ChAvailable() UartChAvailable(uart2)
|
#define Uart2ChAvailable() uart_char_available(&uart2)
|
||||||
#define Uart2Getch() UartGetch(uart2)
|
#define Uart2Getch() uart_getch(&uart2)
|
||||||
#define Uart2TxRunning uart2.tx_running
|
#define Uart2TxRunning uart2.tx_running
|
||||||
#define Uart2SetBaudrate(_b) uart_periph_set_baudrate(&uart2, _b, FALSE)
|
#define Uart2SetBaudrate(_b) uart_periph_set_baudrate(&uart2, _b, FALSE)
|
||||||
|
|
||||||
@@ -167,8 +164,8 @@ extern void uart3_init(void);
|
|||||||
#define Uart3CheckFreeSpace(_x) uart_check_free_space(&uart3, _x)
|
#define Uart3CheckFreeSpace(_x) uart_check_free_space(&uart3, _x)
|
||||||
#define Uart3Transmit(_x) uart_transmit(&uart3, _x)
|
#define Uart3Transmit(_x) uart_transmit(&uart3, _x)
|
||||||
#define Uart3SendMessage() {}
|
#define Uart3SendMessage() {}
|
||||||
#define Uart3ChAvailable() UartChAvailable(uart3)
|
#define Uart3ChAvailable() uart_char_available(&uart3)
|
||||||
#define Uart3Getch() UartGetch(uart3)
|
#define Uart3Getch() uart_getch(&uart3)
|
||||||
#define Uart3TxRunning uart3.tx_running
|
#define Uart3TxRunning uart3.tx_running
|
||||||
#define Uart3SetBaudrate(_b) uart_periph_set_baudrate(&uart3, _b, FALSE)
|
#define Uart3SetBaudrate(_b) uart_periph_set_baudrate(&uart3, _b, FALSE)
|
||||||
|
|
||||||
@@ -191,8 +188,8 @@ extern void uart5_init(void);
|
|||||||
#define Uart5CheckFreeSpace(_x) uart_check_free_space(&uart5, _x)
|
#define Uart5CheckFreeSpace(_x) uart_check_free_space(&uart5, _x)
|
||||||
#define Uart5Transmit(_x) uart_transmit(&uart5, _x)
|
#define Uart5Transmit(_x) uart_transmit(&uart5, _x)
|
||||||
#define Uart5SendMessage() {}
|
#define Uart5SendMessage() {}
|
||||||
#define Uart5ChAvailable() UartChAvailable(uart5)
|
#define Uart5ChAvailable() uart_char_available(&uart5)
|
||||||
#define Uart5Getch() UartGetch(uart5)
|
#define Uart5Getch() uart_getch(&uart5)
|
||||||
#define Uart5TxRunning uart5.tx_running
|
#define Uart5TxRunning uart5.tx_running
|
||||||
#define Uart5SetBaudrate(_b) uart_periph_set_baudrate(&uart5, _b, FALSE)
|
#define Uart5SetBaudrate(_b) uart_periph_set_baudrate(&uart5, _b, FALSE)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static inline void main_init( void ) {
|
|||||||
mcu_init();
|
mcu_init();
|
||||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||||
led_init();
|
led_init();
|
||||||
Uart0Init();
|
uart_init(&uart0);
|
||||||
|
|
||||||
spi_init();
|
spi_init();
|
||||||
sd_card_init();
|
sd_card_init();
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ int main (int argc, char** argv) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_UART0
|
#ifdef USE_UART0
|
||||||
Uart0Init();
|
uart_periph_init(&uart0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_UART1
|
#ifdef USE_UART1
|
||||||
Uart1Init();
|
uart_periph_init(&uart1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mcu_int_enable();
|
mcu_int_enable();
|
||||||
|
|||||||
Reference in New Issue
Block a user