#include <ao.h>
#include <ao_exti.h>
-void
-ao_debug_out(char c)
-{
- if (c == '\n')
- ao_debug_out('\r');
- while (!(stm_usart1.isr & (1 << STM_USART_ISR_TXE)));
- stm_usart1.tdr = c;
-}
-
static int
_ao_usart_tx_start(struct ao_stm_usart *usart)
{
ao_arch_release_interrupts();
}
+#if 0
static void
ao_usart_drain(struct ao_stm_usart *usart)
{
}
ao_arch_release_interrupts();
}
+#endif
-static const uint32_t ao_usart_speeds[] = {
+const uint32_t ao_usart_speeds[] = {
[AO_SERIAL_SPEED_4800] = 4800,
[AO_SERIAL_SPEED_9600] = 9600,
[AO_SERIAL_SPEED_19200] = 19200,
}
#endif
+#if 0
void
ao_serial1_drain(void)
{
ao_usart_drain(&ao_stm_usart1);
ao_usart_set_speed(&ao_stm_usart1, speed);
}
+#endif
#endif /* HAS_SERIAL_1 */
#if HAS_SERIAL_2
{
return _ao_usart_sleep_for(&ao_stm_usart2, timeout);
}
-#endif
void
ao_serial2_drain(void)
ao_usart_drain(&ao_stm_usart2);
ao_usart_set_speed(&ao_stm_usart2, speed);
}
+#endif
#if USE_SERIAL_2_FLOW && USE_SERIAL_2_SW_FLOW
void
}
#endif
+#if 0
void
ao_serial_shutdown(void)
{
+# if SERIAL_2_PA2_PA3
+ stm_moder_set(&stm_gpioa, 2, STM_MODER_INPUT);
+ stm_moder_set(&stm_gpioa, 3, STM_MODER_INPUT);
+# elif SERIAL_2_PA9_PA10
+ stm_moder_set(&stm_gpioa, 9, STM_MODER_INPUT);
+ stm_moder_set(&stm_gpioa, 10, STM_MODER_INPUT);
+# elif SERIAL_2_PA14_PA15
+ stm_moder_set(&stm_gpioa, 14, STM_MODER_INPUT);
+ stm_moder_set(&stm_gpioa, 15, STM_MODER_INPUT);
+# elif SERIAL_2_PB6_PB7
+ stm_moder_set(&stm_gpiob, 6, STM_MODER_INPUT);
+ stm_moder_set(&stm_gpiob, 7, STM_MODER_INPUT);
+#endif
#if HAS_SERIAL_1
stm_rcc.apb2enr &= ~(1 << STM_RCC_APB2ENR_USART1EN);
#endif
#if HAS_SERIAL_2
+ stm_nvic_set_disable(STM_ISR_USART2_POS);
stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_USART2EN);
#endif
}
+#endif
void
ao_serial_init(void)