- some uart changes

git-svn-id: http://moon:8086/svn/projects/HendiControl@37 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-03-02 14:58:42 +00:00
parent c092db8909
commit 46d4de49e1
+9 -8
View File
@@ -12,22 +12,25 @@
#include "message.h"
static Fifo *g_pFifo = NULL;
ISR(USART_UDRE_vect)
{
}
ISR(USART_TX_vect)
{
}
ISR(USART_RX_vect)
{
uint8_t status = UCSR0A;
if (status & (1 << RXC0))
{
uint8_t rx_data = UDR0;
Msg_t msg = {Uart, rx_data};
fifo_push(g_pFifo, &msg);
}
else
{
Msg_t msg = {NOP, 0};
fifo_push(g_pFifo, &msg);
}
}
void uart_init(Fifo *pFifo, uint16_t BAUD_PRESCALE)
@@ -48,12 +51,10 @@ void uart_init(Fifo *pFifo, uint16_t BAUD_PRESCALE)
void uart_putc(char c)
{
enterCritical();
while((UCSR0A & (1<<UDRE0)) == 0)
{
}
UDR0 = c;
exitCritial();
}
int uart_putchar(char c, FILE *stream)