From: Mikko Rasa Date: Thu, 31 Oct 2013 22:08:33 +0000 (+0200) Subject: Use the new serial API in s88w-r X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5fdf476c101b0a3a414519798eb72fcc13825167;p=model-railway-devices.git Use the new serial API in s88w-r --- diff --git a/s88w/s88w-r.c b/s88w/s88w-r.c index 0198974..15365b4 100644 --- a/s88w/s88w-r.c +++ b/s88w/s88w-r.c @@ -33,7 +33,7 @@ D5 - S88 RESET #define BIT(n) (1<<(n)) -void receive(uint8_t); +void check_input(); uint8_t hexdigit(uint8_t); uint8_t decode_hex(uint8_t); @@ -67,6 +67,8 @@ int main() { uint8_t b_pins, d_pins; + check_input(); + b_pins = PINB; d_pins = PIND; @@ -133,8 +135,13 @@ int main() } } -void receive(uint8_t c) +void check_input() { + uint8_t c; + if(!serial_read_available()) + return; + + c = serial_read(); if(rx_fill==0xFF) { if(c==':') @@ -197,8 +204,6 @@ void receive(uint8_t c) } } -SERIAL_SET_CALLBACK(receive) - uint8_t hexdigit(uint8_t n) { n &= 0xF;