summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 16:24:06 -0700
committerKeith Packard <keithp@keithp.com>2012-03-28 21:37:03 -0700
commit03fbc18ea17a9e77a1d4d8e0ddb97abbe5da3658 (patch)
treeb23c1b24f907716cadb2173bbcb64dfa90a7a153
parentf560c961ae4fedec0c9f11d5b3635fcb0d67ed8e (diff)
Clean up multiple serial port support for STM32L
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/stm/ao_serial_stm.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/src/stm/ao_serial_stm.c b/src/stm/ao_serial_stm.c
index 9302bdf8..881819db 100644
--- a/src/stm/ao_serial_stm.c
+++ b/src/stm/ao_serial_stm.c
@@ -24,16 +24,6 @@ struct ao_stm_usart {
uint8_t tx_started;
};
-#if HAS_SERIAL_1
-struct ao_stm_usart ao_stm_usart1;
-#endif
-#if HAS_SERIAL_2
-struct ao_stm_usart ao_stm_usart2;
-#endif
-#if HAS_SERIAL_3
-struct ao_stm_usart ao_stm_usart3;
-#endif
-
void
ao_debug_out(char c)
{
@@ -43,14 +33,6 @@ ao_debug_out(char c)
stm_usart1.dr = c;
}
-#if 0
-void
-outbyte(char c)
-{
- putchar(c);
-}
-#endif
-
static void
ao_usart_tx_start(struct ao_stm_usart *usart)
{
@@ -84,16 +66,6 @@ ao_usart_isr(struct ao_stm_usart *usart, int stdin)
}
}
-#if HAS_SERIAL_1
-void stm_usart1_isr(void) { ao_usart_isr(&ao_stm_usart1, USE_SERIAL_STDIN); }
-#endif
-#if HAS_SERIAL_2
-void stm_usart2_isr(void) { ao_usart_isr(&ao_stm_usart2, 0); }
-#endif
-#if HAS_SERIAL_3
-void stm_usart3_isr(void) { ao_usart_isr(&ao_stm_usart3, 0); }
-#endif
-
char
ao_usart_getchar(struct ao_stm_usart *usart)
{
@@ -211,6 +183,19 @@ ao_usart_init(struct ao_stm_usart *usart)
ao_usart_set_speed(usart, AO_SERIAL_SPEED_9600);
}
+#if HAS_SERIAL_1
+struct ao_stm_usart ao_stm_usart1;
+void stm_usart1_isr(void) { ao_usart_isr(&ao_stm_usart1, USE_SERIAL_STDIN); }
+#endif
+#if HAS_SERIAL_2
+struct ao_stm_usart ao_stm_usart2;
+void stm_usart2_isr(void) { ao_usart_isr(&ao_stm_usart2, 0); }
+#endif
+#if HAS_SERIAL_3
+struct ao_stm_usart ao_stm_usart3;
+void stm_usart3_isr(void) { ao_usart_isr(&ao_stm_usart3, 0); }
+#endif
+
void
ao_serial_init(void)
{