Merge ccdbg and altos sources into one giant repository
[fw/altos] / target / serial / serial.c
index ebe7e2fc891b3be7a529c5c8b113db177f166cfb..63f6c6de0c32ec477249f2cfb5db3c0995f509a6 100644 (file)
@@ -241,18 +241,30 @@ usart_in_byte(void)
        return b;
 }
 
+void
+debug_byte(uint8_t byte)
+{
+       uint8_t s;
+
+       for (s = 0; s < 8; s++) {
+               DEBUG = byte & 1;
+               delay(5);
+               byte >>= 1;
+       }
+}
+
 main ()
 {
        P1DIR |= 2;
        CLKCON = 0;
        while (!(SLEEP & SLEEP_XOSC_STB))
                ;
-       
+
        usart_init();
 
        for (;;) {
                usart_out_string("hello world\r\n");
-               delay(5);
-               P1 ^= 2;
+               debug_byte(usart_in_byte());
        }
+
 }