Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos] / src / stm / ao_serial_stm.c
index e356b9441c3e4bce2381e07ee1b88556534bf63e..88f2d0299ecf65f1b350dde44e0ede1d744c7c1f 100644 (file)
@@ -86,9 +86,9 @@ ao_usart_getchar(struct ao_stm_usart *usart)
 }
 
 static inline uint8_t
-_ao_usart_sleep(struct ao_stm_usart *usart)
+_ao_usart_sleep_for(struct ao_stm_usart *usart, uint16_t timeout)
 {
-       return ao_sleep(&usart->rx_fifo);
+       return ao_sleep_for(&usart->rx_fifo, timeout);
 }
 
 void
@@ -217,9 +217,9 @@ _ao_serial1_pollchar(void)
 }
 
 uint8_t
-_ao_serial1_sleep(void)
+_ao_serial1_sleep_for(uint16_t timeout)
 {
-       return _ao_usart_sleep(&ao_stm_usart1);
+       return _ao_usart_sleep_for(&ao_stm_usart1, timeout);
 }
 
 void
@@ -260,9 +260,9 @@ _ao_serial2_pollchar(void)
 }
 
 uint8_t
-_ao_serial2_sleep(void)
+_ao_serial2_sleep_for(uint16_t timeout)
 {
-       return _ao_usart_sleep(&ao_stm_usart2);
+       return _ao_usart_sleep_for(&ao_stm_usart2, timeout);
 }
 
 void
@@ -303,9 +303,9 @@ _ao_serial3_pollchar(void)
 }
 
 uint8_t
-_ao_serial3_sleep(void)
+_ao_serial3_sleep_for(uint16_t timeout)
 {
-       return _ao_usart_sleep(&ao_stm_usart3);
+       return _ao_usart_sleep_for(&ao_stm_usart3, timeout);
 }
 
 void
@@ -348,7 +348,7 @@ ao_serial_init(void)
 
        stm_nvic_set_enable(STM_ISR_USART1_POS);
        stm_nvic_set_priority(STM_ISR_USART1_POS, 4);
-#if USE_SERIAL_1_STDIN
+#if USE_SERIAL_1_STDIN && !DELAY_SERIAL_1_STDIN
        ao_add_stdio(_ao_serial1_pollchar,
                     ao_serial1_putchar,
                     NULL);
@@ -395,7 +395,7 @@ ao_serial_init(void)
 
        stm_nvic_set_enable(STM_ISR_USART2_POS);
        stm_nvic_set_priority(STM_ISR_USART2_POS, 4);
-#if USE_SERIAL_2_STDIN
+#if USE_SERIAL_2_STDIN && !DELAY_SERIAL_2_STDIN
        ao_add_stdio(_ao_serial2_pollchar,
                     ao_serial2_putchar,
                     NULL);
@@ -439,7 +439,7 @@ ao_serial_init(void)
 
        stm_nvic_set_enable(STM_ISR_USART3_POS);
        stm_nvic_set_priority(STM_ISR_USART3_POS, 4);
-#if USE_SERIAL_3_STDIN
+#if USE_SERIAL_3_STDIN && !DELAY_SERIAL_3_STDIN
        ao_add_stdio(_ao_serial3_pollchar,
                     ao_serial3_putchar,
                     NULL);