Skip to content

Commit e1cccd3

Browse files
author
Matt Land
committed
rename to UART
1 parent 2210fc6 commit e1cccd3

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

ports/atmel-samd/board_busses.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "shared-bindings/busio/I2C.h"
2828
#include "shared-bindings/busio/SPI.h"
29-
//#include "shared-bindings/busio/UART.h"
29+
#include "shared-bindings/busio/UART.h"
3030

3131
#include "shared-bindings/microcontroller/Pin.h"
3232
#include "mpconfigboard.h"
@@ -87,27 +87,26 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
8787
#endif
8888
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
8989

90-
#if !defined(DEFAULT_SERIAL_BUS_RX) || !defined(DEFAULT_SERIAL_BUS_TX)
91-
STATIC mp_obj_t board_serial(void) {
92-
mp_raise_NotImplementedError("No default serial bus");
90+
#if !defined(DEFAULT_UART_BUS_RX) || !defined(DEFAULT_UART_BUS_TX)
91+
STATIC mp_obj_t board_uart(void) {
92+
mp_raise_NotImplementedError("No default UART bus");
9393
return NULL;
9494
}
9595
#else
96-
STATIC mp_obj_t serial_singleton = NULL;
96+
STATIC mp_obj_t uart_singleton = NULL;
9797

98-
STATIC mp_obj_t board_serial(void) {
99-
if (serial_singleton == NULL) {
100-
//busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
101-
//self->base.type = &busio_uart_type;
98+
STATIC mp_obj_t board_uart(void) {
99+
if (uart_singleton == NULL) {
100+
busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
101+
self->base.type = &busio_uart_type;
102102

103-
assert_pin_free(DEFAULT_SERIAL_BUS_RX);
104-
assert_pin_free(DEFAULT_SERIAL_BUS_TX);
103+
assert_pin_free(DEFAULT_UART_BUS_RX);
104+
assert_pin_free(DEFAULT_UART_BUS_TX);
105105

106-
//common_hal_busio_uart_construct(self, DEFAULT_SERIAL_BUS_TX, DEFAULT_SERIAL_BUS_RX, 9600, 8, PARITY_NONE, 1, 1000, 64);
107-
//serial_singleton = (mp_obj_t)self;
108-
serial_singleton = NULL;
106+
common_hal_busio_uart_construct(self, DEFAULT_UART_BUS_TX, DEFAULT_UART_BUS_RX, 9600, 8, PARITY_NONE, 1, 1000, 64);
107+
uart_singleton = (mp_obj_t)self;
109108
}
110-
return serial_singleton;
109+
return uart_singleton;
111110
}
112111
#endif
113-
MP_DEFINE_CONST_FUN_OBJ_0(board_serial_obj, board_serial);
112+
MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);

ports/atmel-samd/board_busses.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern mp_obj_fun_builtin_fixed_t board_i2c_obj;
3333
void board_spi(void);
3434
extern mp_obj_fun_builtin_fixed_t board_spi_obj;
3535

36-
void board_serial(void);
37-
extern mp_obj_fun_builtin_fixed_t board_serial_obj;
36+
void board_uart(void);
37+
extern mp_obj_fun_builtin_fixed_t board_uart_obj;
3838

3939
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_BUSSES_H

ports/atmel-samd/boards/gemma_m0/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#define DEFAULT_I2C_BUS_SCL (&pin_PA05)
1616
#define DEFAULT_I2C_BUS_SDA (&pin_PA04)
1717

18-
#define DEFAULT_SERIAL_BUS_RX (&pin_PA05)
19-
#define DEFAULT_SERIAL_BUS_TX (&pin_PA04)
18+
#define DEFAULT_UART_BUS_RX (&pin_PA05)
19+
#define DEFAULT_UART_BUS_TX (&pin_PA04)
2020

2121

2222
#include "internal_flash.h"

ports/atmel-samd/boards/gemma_m0/pins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
2222
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
2323
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
2424
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
25-
{ MP_ROM_QSTR(MP_QSTR_SERIAL), MP_ROM_PTR(&board_i2c_obj) },
25+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
2626
};
2727
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy