Add missing files for DigitalIO
This commit is contained in:
parent
45e73c414a
commit
43e8a4110f
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 },
|
||||
|
@ -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) {
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user