altos: Shuffle stm-demo SPI test code around a bit
authorKeith Packard <keithp@keithp.com>
Sat, 7 Apr 2012 05:40:49 +0000 (22:40 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 7 Apr 2012 05:40:49 +0000 (22:40 -0700)
Move a debug printf beyond the chip select boundary to
allow for more accurate timing.

Send four bytes instead of just one.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm-demo/ao_demo.c

index 54f7c8f2efb72f46dd5cb93a9bbc1327c791c7a8..5ff2b32a94eeded531e50b6db878e4d4e6034dd0 100644 (file)
@@ -82,7 +82,7 @@ ao_spi_write(void) {
        for (i = 0; i < 10; i++) {
                ao_spi_get(0);
                stm_gpio_set(&stm_gpioc, 12, 0);
-               ao_spi_send(data, 1, 0);
+               ao_spi_send(data, 4, 0);
                stm_gpio_set(&stm_gpioc, 12, 1);
                ao_spi_put(0);
                printf(".");
@@ -100,10 +100,10 @@ ao_spi_read(void) {
                ao_spi_get(0);
                stm_gpio_set(&stm_gpioc, 12, 0);
                ao_spi_recv(data, 4, 0);
-               printf(".");
-               flush();
                stm_gpio_set(&stm_gpioc, 12, 1);
                ao_spi_put(0);
+               printf(".");
+               flush();
                ao_delay(100);
        }
 }