Skip to content

Commit 7533700

Browse files
committed
stmhal: Rename USART to UART.
It's really a UART because there is no external clock line (and hence no synchronous ability, at least in the implementation of this module). USART should be reserved for a module that has "S"ynchronous capabilities. Also, UART is shorter and easier to type :)
1 parent 806f4ae commit 7533700

9 files changed

Lines changed: 178 additions & 180 deletions

File tree

stmhal/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ SRC_C = \
6666
led.c \
6767
pin.c \
6868
pin_named_pins.c \
69-
usart.c \
69+
bufhelper.c \
70+
i2c.c \
71+
spi.c \
72+
uart.c \
7073
usb.c \
7174
printf.c \
7275
math.c \
@@ -97,9 +100,6 @@ SRC_C = \
97100
servo.c \
98101
dac.c \
99102
adc.c \
100-
bufhelper.c \
101-
i2c.c \
102-
spi.c \
103103

104104
# pybwlan.c \
105105

stmhal/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "pyexec.h"
2121
#include "i2c.h"
2222
#include "spi.h"
23-
#include "usart.h"
23+
#include "uart.h"
2424
#include "timer.h"
2525
#include "led.h"
2626
#include "pin.h"
@@ -267,20 +267,20 @@ int main(void) {
267267
// GC init
268268
gc_init(&_heap_start, &_heap_end);
269269

270-
// Change #if 0 to #if 1 if you want REPL on USART_6 (or another usart)
270+
// Change #if 0 to #if 1 if you want REPL on UART_6 (or another uart)
271271
// as well as on USB VCP
272272
#if 0
273273
{
274274
mp_obj_t args[2] = {
275-
MP_OBJ_NEW_SMALL_INT(PYB_USART_6),
275+
MP_OBJ_NEW_SMALL_INT(PYB_UART_6),
276276
MP_OBJ_NEW_SMALL_INT(115200),
277277
};
278-
pyb_usart_global_debug = pyb_usart_type.make_new((mp_obj_t)&pyb_usart_type,
279-
sizeof(args) / sizeof(args[0]),
280-
0, args);
278+
pyb_uart_global_debug = pyb_uart_type.make_new((mp_obj_t)&pyb_uart_type,
279+
sizeof(args) / sizeof(args[0]),
280+
0, args);
281281
}
282282
#else
283-
pyb_usart_global_debug = NULL;
283+
pyb_uart_global_debug = NULL;
284284
#endif
285285

286286
// Micro Python init

stmhal/modpyb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "rtc.h"
2121
#include "i2c.h"
2222
#include "spi.h"
23-
#include "usart.h"
23+
#include "uart.h"
2424
#include "adc.h"
2525
#include "storage.h"
2626
#include "sdcard.h"
@@ -292,7 +292,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
292292
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED), (mp_obj_t)&pyb_led_type },
293293
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2C), (mp_obj_t)&pyb_i2c_type },
294294
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPI), (mp_obj_t)&pyb_spi_type },
295-
{ MP_OBJ_NEW_QSTR(MP_QSTR_USART), (mp_obj_t)&pyb_usart_type },
295+
{ MP_OBJ_NEW_QSTR(MP_QSTR_UART), (mp_obj_t)&pyb_uart_type },
296296

297297
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type },
298298
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADCAll), (mp_obj_t)&pyb_adc_all_type },

stmhal/printf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#if 0
1313
#include "lcd.h"
1414
#endif
15-
#include "usart.h"
15+
#include "uart.h"
1616
#include "usb.h"
1717

1818
#if MICROPY_ENABLE_FLOAT
@@ -170,11 +170,11 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, va_list args) {
170170
}
171171

172172
void stdout_print_strn(void *data, const char *str, unsigned int len) {
173-
// send stdout to USART, USB CDC VCP, and LCD if nothing else
173+
// send stdout to UART, USB CDC VCP, and LCD if nothing else
174174
bool any = false;
175175

176-
if (pyb_usart_global_debug != PYB_USART_NONE) {
177-
usart_tx_strn_cooked(pyb_usart_global_debug, str, len);
176+
if (pyb_uart_global_debug != PYB_UART_NONE) {
177+
uart_tx_strn_cooked(pyb_uart_global_debug, str, len);
178178
any = true;
179179
}
180180
if (usb_vcp_is_enabled()) {

stmhal/pybstdio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#include "stream.h"
1111
#include "pybstdio.h"
1212
#include "usb.h"
13-
#include "usart.h"
13+
#include "uart.h"
1414

1515
void stdout_tx_str(const char *str) {
16-
if (pyb_usart_global_debug != PYB_USART_NONE) {
17-
usart_tx_str(pyb_usart_global_debug, str);
16+
if (pyb_uart_global_debug != PYB_UART_NONE) {
17+
uart_tx_str(pyb_uart_global_debug, str);
1818
}
1919
#if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD
2020
lcd_print_str(str);
@@ -23,8 +23,8 @@ void stdout_tx_str(const char *str) {
2323
}
2424

2525
void stdout_tx_strn(const char *str, uint len) {
26-
if (pyb_usart_global_debug != PYB_USART_NONE) {
27-
usart_tx_strn(pyb_usart_global_debug, str, len);
26+
if (pyb_uart_global_debug != PYB_UART_NONE) {
27+
uart_tx_strn(pyb_uart_global_debug, str, len);
2828
}
2929
#if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD
3030
lcd_print_strn(str, len);
@@ -45,8 +45,8 @@ int stdin_rx_chr(void) {
4545
#endif
4646
if (usb_vcp_rx_num() != 0) {
4747
return usb_vcp_rx_get();
48-
} else if (pyb_usart_global_debug != PYB_USART_NONE && usart_rx_any(pyb_usart_global_debug)) {
49-
return usart_rx_char(pyb_usart_global_debug);
48+
} else if (pyb_uart_global_debug != PYB_UART_NONE && uart_rx_any(pyb_uart_global_debug)) {
49+
return uart_rx_char(pyb_uart_global_debug);
5050
}
5151
__WFI();
5252
}

stmhal/qstrdefsport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ Q(off)
7979
Q(toggle)
8080
Q(intensity)
8181

82-
// for USART class
83-
Q(USART)
82+
// for UART class
83+
Q(UART)
8484
Q(baudrate)
8585
Q(bits)
8686
Q(stop)

0 commit comments

Comments
 (0)