diff options
| author | Damien George | 2017-09-06 13:40:51 +1000 |
|---|---|---|
| committer | Damien George | 2017-09-06 13:40:51 +1000 |
| commit | 01dd7804b87d60b2deab16712eccb3b97351a9b7 (patch) | |
| tree | 1aa21f38a872b8e62a3d4e4f74f68033c6f827e4 /minimal/uart_core.c | |
| parent | a9862b30068fc9df1022f08019fb35aaa5085f64 (diff) | |
ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
Diffstat (limited to 'minimal/uart_core.c')
| -rw-r--r-- | minimal/uart_core.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/minimal/uart_core.c b/minimal/uart_core.c deleted file mode 100644 index d2d17b4d1..000000000 --- a/minimal/uart_core.c +++ /dev/null @@ -1,44 +0,0 @@ -#include <unistd.h> -#include "py/mpconfig.h" - -/* - * Core UART functions to implement for a port - */ - -#if MICROPY_MIN_USE_STM32_MCU -typedef struct { - volatile uint32_t SR; - volatile uint32_t DR; -} periph_uart_t; -#define USART1 ((periph_uart_t*)0x40011000) -#endif - -// Receive single character -int mp_hal_stdin_rx_chr(void) { - unsigned char c = 0; -#if MICROPY_MIN_USE_STDOUT - int r = read(0, &c, 1); - (void)r; -#elif MICROPY_MIN_USE_STM32_MCU - // wait for RXNE - while ((USART1->SR & (1 << 5)) == 0) { - } - c = USART1->DR; -#endif - return c; -} - -// Send string of given length -void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { -#if MICROPY_MIN_USE_STDOUT - int r = write(1, str, len); - (void)r; -#elif MICROPY_MIN_USE_STM32_MCU - while (len--) { - // wait for TXE - while ((USART1->SR & (1 << 7)) == 0) { - } - USART1->DR = *str++; - } -#endif -} |
