Skip to content

Commit 2f6ef76

Browse files
committed
remove instance parameter
1 parent 96c6271 commit 2f6ef76

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

shared-bindings/board/__init__.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ STATIC mp_int_t board_get_instance(size_t n_args, const mp_obj_t *args, const mp
6464
}
6565
#endif
6666

67-
//| def I2C(instance: Optional[int] = 0) -> busio.I2C:
67+
//| def I2C() -> busio.I2C:
6868
//| """Returns the `busio.I2C` object for the board's designated I2C bus(es).
69-
//| If there is more than one default I2C bus, the buses are numbered starting at 0.
7069
//| The object created is a singleton, and uses the default parameter values for `busio.I2C`."""
7170
//| ...
7271
//|
@@ -85,11 +84,13 @@ mp_obj_t board_i2c(size_t n_args, const mp_obj_t *args) {
8584
return MP_ROM_NONE;
8685
}
8786
#endif
88-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(board_i2c_obj, 0, 1, board_i2c);
87+
STATIC mp_obj_t board_i2c_0(void) {
88+
return board_i2c(0, NULL);
89+
}
90+
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0);
8991

90-
//| def SPI(instance: Optional[int] = 0) -> busio.SPI:
92+
//| def SPI() -> busio.SPI:
9193
//| """Returns the `busio.SPI` object for the board's designated SPI bus(es).
92-
//| If there is more than one default SPI bus, the buses are numbered starting at 0.
9394
//| The object created is a singleton, and uses the default parameter values for `busio.SPI`."""
9495
//| ...
9596
//|
@@ -108,11 +109,13 @@ mp_obj_t board_spi(size_t n_args, const mp_obj_t *args) {
108109
return MP_ROM_NONE;
109110
}
110111
#endif
111-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(board_spi_obj, 0, 1, board_spi);
112+
STATIC mp_obj_t board_spi_0(void) {
113+
return board_spi(0, NULL);
114+
}
115+
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0);
112116

113-
//| def UART(instance: Optional[int] = 0) -> busio.UART:
117+
//| def UART() -> busio.UART:
114118
//| """Returns the `busio.UART` object for the board's designated UART bus(es).
115-
//| If there is more than one default UART bus, the buses are numbered starting at 0.
116119
//| The object created is a singleton, and uses the default parameter values for `busio.UART`."""
117120
//| ...
118121
//|
@@ -131,7 +134,10 @@ mp_obj_t board_uart(size_t n_args, const mp_obj_t *args) {
131134
return MP_ROM_NONE;
132135
}
133136
#endif
134-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(board_uart_obj, 0, 1, board_uart);
137+
STATIC mp_obj_t board_uart_0(void) {
138+
return board_uart(0, NULL);
139+
}
140+
MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart_0);
135141

136142
const mp_obj_module_t board_module = {
137143
.base = { &mp_type_module },

shared-bindings/board/__init__.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ bool common_hal_board_is_i2c(mp_obj_t obj);
3939
mp_obj_t common_hal_board_get_i2c(const mp_int_t instance);
4040
mp_obj_t common_hal_board_create_i2c(const mp_int_t instance);
4141
mp_obj_t board_i2c(size_t n_args, const mp_obj_t *args);
42-
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(board_i2c_obj);
42+
MP_DECLARE_CONST_FUN_OBJ_0(board_i2c_obj);
4343

4444
bool common_hal_board_is_spi(mp_obj_t obj);
4545
mp_obj_t common_hal_board_get_spi(const mp_int_t instance);
4646
mp_obj_t common_hal_board_create_spi(const mp_int_t instance);
4747
mp_obj_t board_spi(size_t n_args, const mp_obj_t *args);
48-
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(board_spi_obj);
48+
MP_DECLARE_CONST_FUN_OBJ_0(board_spi_obj);
4949

5050
bool common_hal_board_is_uart(mp_obj_t obj);
5151
mp_obj_t common_hal_board_get_uart(const mp_int_t instance);
5252
mp_obj_t common_hal_board_create_uart(const mp_int_t instance);
5353
mp_obj_t board_uart(size_t n_args, const mp_obj_t *args);
54-
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(board_uart_obj);
54+
MP_DECLARE_CONST_FUN_OBJ_0(board_uart_obj);
5555

5656
#define CIRCUITPY_BOARD_BUS_SINGLETON(name, bus, instance) \
5757
STATIC mp_obj_t board_##name(void) { \

0 commit comments

Comments
 (0)