summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/uart.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-08-03 00:23:47 +0100
committerDamien George <damien.p.george@gmail.com>2015-08-03 00:23:47 +0100
commit751485fe6b7eeb93f171c2f2b0417803f6e78c05 (patch)
tree3d6beaf4edd81161c7ee33a005bf157409ad4dcf /stmhal/uart.c
parenta632037866c55e04fe6d5c3f96e39067e4ad5579 (diff)
downloadmicropython-751485fe6b7eeb93f171c2f2b0417803f6e78c05.tar.gz
micropython-751485fe6b7eeb93f171c2f2b0417803f6e78c05.zip
stmhal: Add support for USART1 and conditional pins in make-pins.py.
Thanks to Dave Hylands for the patch.
Diffstat (limited to 'stmhal/uart.c')
-rw-r--r--stmhal/uart.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/stmhal/uart.c b/stmhal/uart.c
index 01771be3f8..ebd0b25162 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -132,6 +132,22 @@ STATIC bool uart_init2(pyb_uart_obj_t *uart_obj) {
break;
#endif
+ #if defined(MICROPY_HW_UART1_TX_PORT) && \
+ defined(MICROPY_HW_UART1_TX_PIN) && \
+ defined(MICROPY_HW_UART1_RX_PORT) && \
+ defined(MICROPY_HW_UART1_RX_PIN)
+ case PYB_UART_1:
+ UARTx = USART1;
+ irqn = USART1_IRQn;
+ GPIO_AF_UARTx = GPIO_AF7_USART1;
+ GPIO_Port = MICROPY_HW_UART1_TX_PORT;
+ GPIO_Pin = MICROPY_HW_UART1_TX_PIN;
+ GPIO_Port2 = MICROPY_HW_UART1_RX_PORT;
+ GPIO_Pin2 = MICROPY_HW_UART1_RX_PIN;
+ __USART1_CLK_ENABLE();
+ break;
+ #endif
+
#if defined(MICROPY_HW_UART2_PORT) && defined(MICROPY_HW_UART2_PINS)
// USART2 is on PA2/PA3 (CTS,RTS,CK on PA0,PA1,PA4), PD5/PD6 (CK on PD7)
case PYB_UART_2: