Skip to content

Commit 43e8a41

Browse files
committed
Add missing files for DigitalIO
1 parent 45e73c4 commit 43e8a41

6 files changed

Lines changed: 73 additions & 70 deletions

File tree

ports/nrf/common-hal/microcontroller/Pin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void reset_pin_number(uint8_t pin_number) {
105105
#ifdef SPEAKER_ENABLE_PIN
106106
if (pin_number == SPEAKER_ENABLE_PIN->number) {
107107
speaker_enable_in_use = false;
108-
common_hal_digitalio_digitalinout_switch_to_output(
108+
common_hal_digitalio_digitalinout_switch_to_output();
109109
nrf_gpio_pin_dir_set(pin_number, NRF_GPIO_PIN_DIR_OUTPUT);
110110
nrf_gpio_pin_write(pin_number, false);
111111
}

ports/nrf/tick.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void SysTick_Handler(void) {
5454
}
5555

5656
void tick_init() {
57-
//uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000;
57+
uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000;
5858
SysTick_Config(ticks_per_ms); // interrupt is enabled
5959
}
6060

shared-bindings/board/__init__.c

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -46,72 +46,72 @@
4646
//| Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton.
4747
//|
4848

49-
#if BOARD_I2C
50-
mp_obj_t board_i2c(void) {
51-
mp_obj_t singleton = common_hal_board_get_i2c();
52-
if (singleton != NULL) {
53-
return singleton;
54-
}
55-
assert_pin_free(DEFAULT_I2C_BUS_SDA);
56-
assert_pin_free(DEFAULT_I2C_BUS_SCL);
57-
return common_hal_board_create_i2c();
58-
}
59-
#else
60-
mp_obj_t board_i2c(void) {
61-
mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_I2C);
62-
return NULL;
63-
}
64-
#endif
65-
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
49+
// #if BOARD_I2C
50+
// mp_obj_t board_i2c(void) {
51+
// mp_obj_t singleton = common_hal_board_get_i2c();
52+
// if (singleton != NULL) {
53+
// return singleton;
54+
// }
55+
// assert_pin_free(DEFAULT_I2C_BUS_SDA);
56+
// assert_pin_free(DEFAULT_I2C_BUS_SCL);
57+
// return common_hal_board_create_i2c();
58+
// }
59+
// #else
60+
// mp_obj_t board_i2c(void) {
61+
// mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_I2C);
62+
// return NULL;
63+
// }
64+
// #endif
65+
// MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
6666

6767

68-
//| .. function:: SPI()
69-
//|
70-
//| Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a
71-
//| singleton.
72-
//|
73-
#if BOARD_SPI
74-
mp_obj_t board_spi(void) {
75-
mp_obj_t singleton = common_hal_board_get_spi();
76-
if (singleton != NULL) {
77-
return singleton;
78-
}
79-
assert_pin_free(DEFAULT_SPI_BUS_SCK);
80-
assert_pin_free(DEFAULT_SPI_BUS_MOSI);
81-
assert_pin_free(DEFAULT_SPI_BUS_MISO);
82-
return common_hal_board_create_spi();
83-
}
84-
#else
85-
mp_obj_t board_spi(void) {
86-
mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI);
87-
return NULL;
88-
}
89-
#endif
90-
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
68+
// //| .. function:: SPI()
69+
// //|
70+
// //| Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a
71+
// //| singleton.
72+
// //|
73+
// #if BOARD_SPI
74+
// mp_obj_t board_spi(void) {
75+
// mp_obj_t singleton = common_hal_board_get_spi();
76+
// if (singleton != NULL) {
77+
// return singleton;
78+
// }
79+
// assert_pin_free(DEFAULT_SPI_BUS_SCK);
80+
// assert_pin_free(DEFAULT_SPI_BUS_MOSI);
81+
// assert_pin_free(DEFAULT_SPI_BUS_MISO);
82+
// return common_hal_board_create_spi();
83+
// }
84+
// #else
85+
// mp_obj_t board_spi(void) {
86+
// mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI);
87+
// return NULL;
88+
// }
89+
// #endif
90+
// MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
9191

92-
//| .. function:: UART()
93-
//|
94-
//| Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
95-
//|
96-
#if BOARD_UART
97-
mp_obj_t board_uart(void) {
98-
mp_obj_t singleton = common_hal_board_get_uart();
99-
if (singleton != NULL) {
100-
return singleton;
101-
}
92+
// //| .. function:: UART()
93+
// //|
94+
// //| Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
95+
// //|
96+
// #if BOARD_UART
97+
// mp_obj_t board_uart(void) {
98+
// mp_obj_t singleton = common_hal_board_get_uart();
99+
// if (singleton != NULL) {
100+
// return singleton;
101+
// }
102102

103-
assert_pin_free(DEFAULT_UART_BUS_RX);
104-
assert_pin_free(DEFAULT_UART_BUS_TX);
103+
// assert_pin_free(DEFAULT_UART_BUS_RX);
104+
// assert_pin_free(DEFAULT_UART_BUS_TX);
105105

106-
return common_hal_board_create_uart();
107-
}
108-
#else
109-
mp_obj_t board_uart(void) {
110-
mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI);
111-
return NULL;
112-
}
113-
#endif
114-
MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);
106+
// return common_hal_board_create_uart();
107+
// }
108+
// #else
109+
// mp_obj_t board_uart(void) {
110+
// mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI);
111+
// return NULL;
112+
// }
113+
// #endif
114+
// MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);
115115

116116
const mp_obj_module_t board_module = {
117117
.base = { &mp_type_module },

shared-module/board/__init__.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
* THE SOFTWARE.
2525
*/
2626

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

3131
#include "shared-bindings/microcontroller/Pin.h"
3232
#include "supervisor/shared/translate.h"
3333
#include "mpconfigboard.h"
3434
#include "py/runtime.h"
3535

36-
#ifdef CIRCUITPY_DISPLAYIO
37-
#include "shared-module/displayio/__init__.h"
38-
#endif
36+
// #ifdef CIRCUITPY_DISPLAYIO
37+
// #include "shared-module/displayio/__init__.h"
38+
// #endif
3939

4040
#if BOARD_I2C
4141
mp_obj_t common_hal_board_get_i2c(void) {

supervisor/shared/usb/usb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2];
4040

4141
void load_serial_number(void) {
4242
// create serial number based on device unique id
43-
uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH];
43+
44+
//LUCIAN: edited to fake a serial number
45+
uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH] = {'0','1','2','3'};
4446
//common_hal_mcu_processor_get_uid(raw_id);
4547

4648
static const char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',

supervisor/supervisor.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ else
5151
SRC_SUPERVISOR += supervisor/internal_flash.c
5252
endif
5353

54+
USB=FALSE
5455
ifeq ($(USB),FALSE)
5556
ifeq ($(wildcard supervisor/serial.c),)
5657
SRC_SUPERVISOR += supervisor/stub/serial.c

0 commit comments

Comments
 (0)