X-Git-Url: http://git.rot13.org/?p=digitaldcpower;a=blobdiff_plain;f=uart.c;fp=uart.c;h=eb7c4e1a325bb867e180214b8e6fa5d035214225;hp=72cc33f1f241123797cc5b9051ec7e7d3dc4b0b7;hb=93791a25a42c0d48fa5a62c41d5907fae5829fee;hpb=1d6d9149f9b438f797a7af85c0454e38a2767a95 diff --git a/uart.c b/uart.c index 72cc33f..eb7c4e1 100644 --- a/uart.c +++ b/uart.c @@ -10,6 +10,12 @@ #include "uart.h" #define F_CPU 8000000UL // 8 MHz +// a receiver stack: +#define SENDSTACKSIZE 12 +static volatile char ustack[SENDSTACKSIZE]; +static volatile uint8_t stackpointer_end=0; +static uint8_t stackpointer_start=0; + void uart_init(void) { unsigned int baud=51; // 9600 baud at 8MHz @@ -62,6 +68,35 @@ void uart_sendstr_p(const prog_char *progmem_s) } +// call this function from interrupt to fill the +// ustack reveiver buffer. We need this big buffer +// to handle fast copy/paste of strings comming +// into the UART +void uart_poll_getchar_isr(void) +{ +#ifdef VAR_88CHIP + if(!(UCSR0A & (1<