rename to UART

This commit is contained in:
Matt Land 2018-05-17 13:21:15 -04:00
parent 2210fc60b1
commit e1cccd3dac
4 changed files with 20 additions and 21 deletions

View File

@ -26,7 +26,7 @@
#include "shared-bindings/busio/I2C.h" #include "shared-bindings/busio/I2C.h"
#include "shared-bindings/busio/SPI.h" #include "shared-bindings/busio/SPI.h"
//#include "shared-bindings/busio/UART.h" #include "shared-bindings/busio/UART.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "mpconfigboard.h" #include "mpconfigboard.h"
@ -87,27 +87,26 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
#endif #endif
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi); MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
#if !defined(DEFAULT_SERIAL_BUS_RX) || !defined(DEFAULT_SERIAL_BUS_TX) #if !defined(DEFAULT_UART_BUS_RX) || !defined(DEFAULT_UART_BUS_TX)
STATIC mp_obj_t board_serial(void) { STATIC mp_obj_t board_uart(void) {
mp_raise_NotImplementedError("No default serial bus"); mp_raise_NotImplementedError("No default UART bus");
return NULL; return NULL;
} }
#else #else
STATIC mp_obj_t serial_singleton = NULL; STATIC mp_obj_t uart_singleton = NULL;
STATIC mp_obj_t board_serial(void) { STATIC mp_obj_t board_uart(void) {
if (serial_singleton == NULL) { if (uart_singleton == NULL) {
//busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t); busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
//self->base.type = &busio_uart_type; self->base.type = &busio_uart_type;
assert_pin_free(DEFAULT_SERIAL_BUS_RX); assert_pin_free(DEFAULT_UART_BUS_RX);
assert_pin_free(DEFAULT_SERIAL_BUS_TX); assert_pin_free(DEFAULT_UART_BUS_TX);
//common_hal_busio_uart_construct(self, DEFAULT_SERIAL_BUS_TX, DEFAULT_SERIAL_BUS_RX, 9600, 8, PARITY_NONE, 1, 1000, 64); common_hal_busio_uart_construct(self, DEFAULT_UART_BUS_TX, DEFAULT_UART_BUS_RX, 9600, 8, PARITY_NONE, 1, 1000, 64);
//serial_singleton = (mp_obj_t)self; uart_singleton = (mp_obj_t)self;
serial_singleton = NULL;
} }
return serial_singleton; return uart_singleton;
} }
#endif #endif
MP_DEFINE_CONST_FUN_OBJ_0(board_serial_obj, board_serial); MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);

View File

@ -33,7 +33,7 @@ extern mp_obj_fun_builtin_fixed_t board_i2c_obj;
void board_spi(void); void board_spi(void);
extern mp_obj_fun_builtin_fixed_t board_spi_obj; extern mp_obj_fun_builtin_fixed_t board_spi_obj;
void board_serial(void); void board_uart(void);
extern mp_obj_fun_builtin_fixed_t board_serial_obj; extern mp_obj_fun_builtin_fixed_t board_uart_obj;
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_BUSSES_H #endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_BUSSES_H

View File

@ -15,8 +15,8 @@
#define DEFAULT_I2C_BUS_SCL (&pin_PA05) #define DEFAULT_I2C_BUS_SCL (&pin_PA05)
#define DEFAULT_I2C_BUS_SDA (&pin_PA04) #define DEFAULT_I2C_BUS_SDA (&pin_PA04)
#define DEFAULT_SERIAL_BUS_RX (&pin_PA05) #define DEFAULT_UART_BUS_RX (&pin_PA05)
#define DEFAULT_SERIAL_BUS_TX (&pin_PA04) #define DEFAULT_UART_BUS_TX (&pin_PA04)
#include "internal_flash.h" #include "internal_flash.h"

View File

@ -22,6 +22,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_SERIAL), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
}; };
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);