diff options
| author | Hierophect <hierophect@gmail.com> | 2019-07-17 14:18:01 -0400 |
|---|---|---|
| committer | Hierophect <hierophect@gmail.com> | 2019-07-17 14:18:01 -0400 |
| commit | 43e8a4110f86a5d0b449d406ba33e27cc88978b0 (patch) | |
| tree | ae9849a645a994678f577169d54cf2335d223c03 | |
| parent | 45e73c414a00e6ab62c58e3d8458fe608dd07f57 (diff) | |
Add missing files for DigitalIO
| -rw-r--r-- | ports/nrf/common-hal/microcontroller/Pin.c | 2 | ||||
| -rw-r--r-- | ports/nrf/tick.c | 2 | ||||
| -rw-r--r-- | shared-bindings/board/__init__.c | 122 | ||||
| -rw-r--r-- | shared-module/board/__init__.c | 12 | ||||
| -rw-r--r-- | supervisor/shared/usb/usb.c | 4 | ||||
| -rw-r--r-- | supervisor/supervisor.mk | 1 |
6 files changed, 73 insertions, 70 deletions
diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c index b9c0ecaca..49b3c15ca 100644 --- a/ports/nrf/common-hal/microcontroller/Pin.c +++ b/ports/nrf/common-hal/microcontroller/Pin.c @@ -105,7 +105,7 @@ void reset_pin_number(uint8_t pin_number) { #ifdef SPEAKER_ENABLE_PIN if (pin_number == SPEAKER_ENABLE_PIN->number) { speaker_enable_in_use = false; - common_hal_digitalio_digitalinout_switch_to_output( + common_hal_digitalio_digitalinout_switch_to_output(); nrf_gpio_pin_dir_set(pin_number, NRF_GPIO_PIN_DIR_OUTPUT); nrf_gpio_pin_write(pin_number, false); } diff --git a/ports/nrf/tick.c b/ports/nrf/tick.c index f4cc9b1ec..6d8fd13e0 100644 --- a/ports/nrf/tick.c +++ b/ports/nrf/tick.c @@ -54,7 +54,7 @@ void SysTick_Handler(void) { } void tick_init() { - //uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000; + uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000; SysTick_Config(ticks_per_ms); // interrupt is enabled } diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index 47e2d64bc..ccf9ec5ab 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -46,72 +46,72 @@ //| Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton. //| -#if BOARD_I2C -mp_obj_t board_i2c(void) { - mp_obj_t singleton = common_hal_board_get_i2c(); - if (singleton != NULL) { - return singleton; - } - assert_pin_free(DEFAULT_I2C_BUS_SDA); - assert_pin_free(DEFAULT_I2C_BUS_SCL); - return common_hal_board_create_i2c(); -} -#else -mp_obj_t board_i2c(void) { - mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_I2C); - return NULL; -} -#endif -MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c); +// #if BOARD_I2C +// mp_obj_t board_i2c(void) { +// mp_obj_t singleton = common_hal_board_get_i2c(); +// if (singleton != NULL) { +// return singleton; +// } +// assert_pin_free(DEFAULT_I2C_BUS_SDA); +// assert_pin_free(DEFAULT_I2C_BUS_SCL); +// return common_hal_board_create_i2c(); +// } +// #else +// mp_obj_t board_i2c(void) { +// mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_I2C); +// return NULL; +// } +// #endif +// MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c); -//| .. function:: SPI() -//| -//| Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a -//| singleton. -//| -#if BOARD_SPI -mp_obj_t board_spi(void) { - mp_obj_t singleton = common_hal_board_get_spi(); - if (singleton != NULL) { - return singleton; - } - assert_pin_free(DEFAULT_SPI_BUS_SCK); - assert_pin_free(DEFAULT_SPI_BUS_MOSI); - assert_pin_free(DEFAULT_SPI_BUS_MISO); - return common_hal_board_create_spi(); -} -#else -mp_obj_t board_spi(void) { - mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI); - return NULL; -} -#endif -MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi); +// //| .. function:: SPI() +// //| +// //| Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a +// //| singleton. +// //| +// #if BOARD_SPI +// mp_obj_t board_spi(void) { +// mp_obj_t singleton = common_hal_board_get_spi(); +// if (singleton != NULL) { +// return singleton; +// } +// assert_pin_free(DEFAULT_SPI_BUS_SCK); +// assert_pin_free(DEFAULT_SPI_BUS_MOSI); +// assert_pin_free(DEFAULT_SPI_BUS_MISO); +// return common_hal_board_create_spi(); +// } +// #else +// mp_obj_t board_spi(void) { +// mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI); +// return NULL; +// } +// #endif +// MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi); -//| .. function:: UART() -//| -//| Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton. -//| -#if BOARD_UART -mp_obj_t board_uart(void) { - mp_obj_t singleton = common_hal_board_get_uart(); - if (singleton != NULL) { - return singleton; - } +// //| .. function:: UART() +// //| +// //| Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton. +// //| +// #if BOARD_UART +// mp_obj_t board_uart(void) { +// mp_obj_t singleton = common_hal_board_get_uart(); +// if (singleton != NULL) { +// return singleton; +// } - assert_pin_free(DEFAULT_UART_BUS_RX); - assert_pin_free(DEFAULT_UART_BUS_TX); +// assert_pin_free(DEFAULT_UART_BUS_RX); +// assert_pin_free(DEFAULT_UART_BUS_TX); - return common_hal_board_create_uart(); -} -#else -mp_obj_t board_uart(void) { - mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI); - return NULL; -} -#endif -MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart); +// return common_hal_board_create_uart(); +// } +// #else +// mp_obj_t board_uart(void) { +// mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI); +// return NULL; +// } +// #endif +// MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart); const mp_obj_module_t board_module = { .base = { &mp_type_module }, diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index be8502bc0..b29e9df61 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -24,18 +24,18 @@ * THE SOFTWARE. */ -#include "shared-bindings/busio/I2C.h" -#include "shared-bindings/busio/SPI.h" -#include "shared-bindings/busio/UART.h" +// #include "shared-bindings/busio/I2C.h" +// #include "shared-bindings/busio/SPI.h" +// #include "shared-bindings/busio/UART.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/translate.h" #include "mpconfigboard.h" #include "py/runtime.h" -#ifdef CIRCUITPY_DISPLAYIO -#include "shared-module/displayio/__init__.h" -#endif +// #ifdef CIRCUITPY_DISPLAYIO +// #include "shared-module/displayio/__init__.h" +// #endif #if BOARD_I2C mp_obj_t common_hal_board_get_i2c(void) { diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index ec778e91c..b3c16f4ae 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -40,7 +40,9 @@ extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2]; void load_serial_number(void) { // create serial number based on device unique id - uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; + +//LUCIAN: edited to fake a serial number + uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH] = {'0','1','2','3'}; //common_hal_mcu_processor_get_uid(raw_id); static const char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 4ea3a8260..5490bf059 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -51,6 +51,7 @@ else SRC_SUPERVISOR += supervisor/internal_flash.c endif +USB=FALSE ifeq ($(USB),FALSE) ifeq ($(wildcard supervisor/serial.c),) SRC_SUPERVISOR += supervisor/stub/serial.c |
