mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
stm32f1: implement missing UART0 parts
This commit is contained in:
parent
d50f43e9f5
commit
b86b78bcb2
@ -29,6 +29,10 @@
|
|||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_UART0
|
||||||
|
#include "board_uart0.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Each UART device has to store two callbacks.
|
* @brief Each UART device has to store two callbacks.
|
||||||
@ -300,14 +304,26 @@ static inline void irq_handler(uint8_t uartnum, USART_TypeDef *dev)
|
|||||||
{
|
{
|
||||||
if (dev->SR & USART_SR_RXNE) {
|
if (dev->SR & USART_SR_RXNE) {
|
||||||
char data = (char)dev->DR;
|
char data = (char)dev->DR;
|
||||||
|
#ifdef MODULE_UART0
|
||||||
|
if (uart0_handler_pid) {
|
||||||
|
uart0_handle_incoming(data);
|
||||||
|
|
||||||
|
uart0_notify_thread();
|
||||||
|
}
|
||||||
|
#else
|
||||||
config[uartnum].rx_cb(data);
|
config[uartnum].rx_cb(data);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (dev->SR & USART_SR_ORE) {
|
else if (dev->SR & USART_SR_ORE) {
|
||||||
/* ORE is cleared by reading SR and DR sequentially */
|
/* ORE is cleared by reading SR and DR sequentially */
|
||||||
dev->DR;
|
dev->DR;
|
||||||
}
|
}
|
||||||
else if (dev->SR & USART_SR_TXE) {
|
else if (dev->SR & USART_SR_TXE) {
|
||||||
|
#ifdef MODULE_UART0
|
||||||
|
dev->SR &= ~(USART_SR_TXE);
|
||||||
|
#else
|
||||||
config[uartnum].tx_cb();
|
config[uartnum].tx_cb();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sched_context_switch_request) {
|
if (sched_context_switch_request) {
|
||||||
|
@ -45,7 +45,11 @@ caddr_t heap_top = (caddr_t)&_end + 4;
|
|||||||
*/
|
*/
|
||||||
void _init(void)
|
void _init(void)
|
||||||
{
|
{
|
||||||
|
#ifdef MODULE_UART0
|
||||||
|
uart_init(UART_0, 115200, NULL, NULL);
|
||||||
|
#else
|
||||||
uart_init_blocking(UART_0, 115200);
|
uart_init_blocking(UART_0, 115200);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user