]> git.tdb.fi Git - model-railway-devices.git/commitdiff
Use the new serial API in s88w-r
authorMikko Rasa <tdb@tdb.fi>
Thu, 31 Oct 2013 22:08:33 +0000 (00:08 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 31 Oct 2013 22:08:33 +0000 (00:08 +0200)
s88w/s88w-r.c

index 019897483cc63b2b36dc1f6cc79cf151e4064f72..15365b43500d117d7a714b6f4cc383b8948575e6 100644 (file)
@@ -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;