Actually return byte read from SPI
[fw/altos] / target / ee / ee.c
index 68b6e4cc2f65a107ca8efe822775f11ce310b4a0..08d551370e8daa12223837e843f4c61ccb8f0e58 100644 (file)
@@ -273,6 +273,8 @@ usart_in_out(uint8_t byte)
        U0DBUF = byte;
        while ((U0CSR & UxCSR_TX_BYTE) == 0)
                ;
+       U0CSR &= ~UxCSR_TX_BYTE;
+       return U0DBUF;
 }
 
 void
@@ -375,6 +377,7 @@ main ()
        uint8_t buf[LENGTH];
        int i;
 
+       P1DIR |= 2;
        CLKCON = 0;
        
        spi_init();
@@ -389,10 +392,10 @@ main ()
         */
        status &= ~(1 << 7);
        wrsr(status);
-//     write(0x0, STRING, LENGTH);
+       write(0x0, STRING, LENGTH);
        for (;;) {
                read(0x0, buf, LENGTH);
                for (i = 0; i < LENGTH; i++)
-                       debug_byte(STRING[i]);
+                       debug_byte(buf[i]);
        }
 }