altos: Clear stm i2c transfer timeout alarm
authorKeith Packard <keithp@keithp.com>
Mon, 28 May 2012 17:47:28 +0000 (11:47 -0600)
committerKeith Packard <keithp@keithp.com>
Mon, 28 May 2012 17:47:28 +0000 (11:47 -0600)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm/ao_i2c_stm.c

index 763ae6cd5c0ec0fefa7074912c19bada14134175..d82342db14e500631850729adec5cb061e401ad8 100644 (file)
@@ -250,10 +250,9 @@ ao_i2c_send(void *block, uint16_t len, uint8_t index, uint8_t stop)
        ao_alarm(1 + len);
        cli();
        while (!ao_dma_done[tx_dma_index])
-               if (ao_sleep(&ao_dma_done[tx_dma_index])) {
-                       printf ("send timeout\n");
+               if (ao_sleep(&ao_dma_done[tx_dma_index]))
                        break;
-               }
+       ao_clear_alarm();
        ao_dma_done_transfer(tx_dma_index);
        out_cr2("send enable isr", stm_i2c,
                AO_STM_I2C_CR2 | (1 << STM_I2C_CR2_ITEVTEN) | (1 << STM_I2C_CR2_ITERREN));