Skip to content

Commit e9659e6

Browse files
committed
Switch enum-like attributes to all caps and add print support for them. Make room for this functionality by adding a shared __enter__ function object. #76
1 parent c4ee6d5 commit e9659e6

File tree

14 files changed

+161
-75
lines changed

14 files changed

+161
-75
lines changed

atmel-samd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ SRC_C = \
197197
lib/fatfs/ff.c \
198198
lib/fatfs/option/ccsbcs.c \
199199
lib/timeutils/timeutils.c \
200+
lib/utils/context_manager_helpers.c \
200201
lib/utils/interrupt_char.c \
201202
lib/utils/pyexec.c \
202203
lib/utils/pyhelp.c \

esp8266/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ LIB_SRC_C = $(addprefix lib/,\
165165
mp-readline/readline.c \
166166
netutils/netutils.c \
167167
timeutils/timeutils.c \
168+
utils/context_manager_helpers.c \
168169
utils/pyexec.c \
169170
utils/pyhelp.c \
170171
utils/interrupt_char.c \

lib/utils/context_manager_helpers.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "lib/utils/context_manager_helpers.h"
28+
29+
#include "py/obj.h"
30+
31+
STATIC mp_obj_t default___enter__(mp_obj_t self_in) {
32+
return self_in;
33+
}
34+
MP_DEFINE_CONST_FUN_OBJ_1(default___enter___obj, default___enter__);

lib/utils/context_manager_helpers.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef __MICROPY_INCLUDED_LIB_UTILS_CONTEXT_MANAGER_HELPERS_H__
28+
#define __MICROPY_INCLUDED_LIB_UTILS_CONTEXT_MANAGER_HELPERS_H__
29+
30+
#include "py/obj.h"
31+
32+
MP_DECLARE_CONST_FUN_OBJ_1(default___enter___obj);
33+
34+
#endif // __MICROPY_INCLUDED_LIB_UTILS_CONTEXT_MANAGER_HELPERS_H__

shared-bindings/bitbangio/I2C.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "shared-bindings/bitbangio/I2C.h"
3131
#include "shared-bindings/microcontroller/Pin.h"
3232

33+
#include "lib/utils/context_manager_helpers.h"
3334
#include "py/runtime.h"
3435
//| .. currentmodule:: bitbangio
3536
//|
@@ -83,10 +84,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_deinit_obj, bitbangio_i2c_obj_deinit);
8384
//|
8485
//| No-op used in Context Managers.
8586
//|
86-
STATIC mp_obj_t bitbangio_i2c_obj___enter__(mp_obj_t self_in) {
87-
return self_in;
88-
}
89-
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c___enter___obj, bitbangio_i2c_obj___enter__);
87+
// Provided by context manager helper.
9088

9189
//| .. method:: I2C.__exit__()
9290
//|
@@ -248,7 +246,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_wr
248246

249247
STATIC const mp_rom_map_elem_t bitbangio_i2c_locals_dict_table[] = {
250248
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&bitbangio_i2c_deinit_obj) },
251-
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&bitbangio_i2c___enter___obj) },
249+
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
252250
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&bitbangio_i2c_obj___exit___obj) },
253251
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&bitbangio_i2c_scan_obj) },
254252

shared-bindings/bitbangio/SPI.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "shared-bindings/bitbangio/SPI.h"
3333
#include "shared-bindings/microcontroller/Pin.h"
3434

35+
#include "lib/utils/context_manager_helpers.h"
3536
#include "py/runtime.h"
3637

3738
//| .. currentmodule:: bitbangio
@@ -57,7 +58,6 @@
5758
//|
5859

5960
// TODO(tannewt): Support LSB SPI.
60-
// TODO(tannewt): Support phase, polarity and bit order.
6161
STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
6262
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, true);
6363
bitbangio_spi_obj_t *self = m_new_obj(bitbangio_spi_obj_t);
@@ -97,10 +97,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_deinit_obj, bitbangio_spi_obj_deinit);
9797
//|
9898
//| No-op used by Context Managers.
9999
//|
100-
STATIC mp_obj_t bitbangio_spi_obj___enter__(mp_obj_t self_in) {
101-
return self_in;
102-
}
103-
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi___enter___obj, bitbangio_spi_obj___enter__);
100+
// Provided by context manager helper.
104101

105102
//| .. method:: SPI.__exit__()
106103
//|
@@ -211,7 +208,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_
211208

212209
STATIC const mp_rom_map_elem_t bitbangio_spi_locals_dict_table[] = {
213210
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&bitbangio_spi_deinit_obj) },
214-
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&bitbangio_spi___enter___obj) },
211+
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
215212
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&bitbangio_spi_obj___exit___obj) },
216213

217214
{ MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&bitbangio_spi_configure_obj) },

shared-bindings/nativeio/AnalogIn.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <string.h>
2828

29+
#include "lib/utils/context_manager_helpers.h"
2930
#include "py/binary.h"
3031
#include "py/mphal.h"
3132
#include "py/nlr.h"
@@ -88,10 +89,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(nativeio_analogin_deinit_obj, nativeio_analogin_deinit
8889
//|
8990
//| No-op used by Context Managers.
9091
//|
91-
STATIC mp_obj_t nativeio_analogin___enter__(mp_obj_t self_in) {
92-
return self_in;
93-
}
94-
MP_DEFINE_CONST_FUN_OBJ_1(nativeio_analogin___enter___obj, nativeio_analogin___enter__);
92+
// Provided by context manager helper.
9593

9694
//| .. method:: __exit__()
9795
//|
@@ -150,7 +148,7 @@ mp_obj_property_t nativeio_analogin_reference_voltage_obj = {
150148

151149
STATIC const mp_rom_map_elem_t nativeio_analogin_locals_dict_table[] = {
152150
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&nativeio_analogin_deinit_obj) },
153-
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&nativeio_analogin___enter___obj) },
151+
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
154152
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&nativeio_analogin___exit___obj) },
155153
{ MP_OBJ_NEW_QSTR(MP_QSTR_value), MP_ROM_PTR(&nativeio_analogin_value_obj)},
156154
{ MP_OBJ_NEW_QSTR(MP_QSTR_reference_voltage), MP_ROM_PTR(&nativeio_analogin_reference_voltage_obj)},

shared-bindings/nativeio/AnalogOut.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <stdint.h>
2828
#include <string.h>
2929

30+
#include "lib/utils/context_manager_helpers.h"
3031
#include "py/objproperty.h"
3132
#include "py/runtime.h"
3233
#include "shared-bindings/microcontroller/Pin.h"
@@ -86,10 +87,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nativeio_analogout_deinit_obj, nativeio_analogo
8687
//|
8788
//| No-op used by Context Managers.
8889
//|
89-
STATIC mp_obj_t nativeio_analogout___enter__(mp_obj_t self_in) {
90-
return self_in;
91-
}
92-
MP_DEFINE_CONST_FUN_OBJ_1(nativeio_analogout___enter___obj, nativeio_analogout___enter__);
90+
// Provided by context manager helper.
9391

9492
//| .. method:: __exit__()
9593
//|
@@ -133,7 +131,7 @@ mp_obj_property_t nativeio_analogout_value_obj = {
133131
STATIC const mp_rom_map_elem_t nativeio_analogout_locals_dict_table[] = {
134132
// instance methods
135133
{ MP_OBJ_NEW_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&nativeio_analogout_deinit_obj) },
136-
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&nativeio_analogout___enter___obj) },
134+
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
137135
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&nativeio_analogout___exit___obj) },
138136

139137
// Properties

shared-bindings/nativeio/DigitalInOut.c

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <stdint.h>
2828
#include <string.h>
2929

30+
#include "lib/utils/context_manager_helpers.h"
31+
3032
#include "py/nlr.h"
3133
#include "py/objtype.h"
3234
#include "py/objproperty.h"
@@ -84,10 +86,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(nativeio_digitalinout_deinit_obj, nativeio_digitalinou
8486
//|
8587
//| No-op used by Context Managers.
8688
//|
87-
STATIC mp_obj_t nativeio_digitalinout_obj___enter__(mp_obj_t self_in) {
88-
return self_in;
89-
}
90-
MP_DEFINE_CONST_FUN_OBJ_1(nativeio_digitalinout___enter___obj, nativeio_digitalinout_obj___enter__);
89+
// Provided by context manager helper.
9190

9291
//| .. method:: __exit__()
9392
//|
@@ -101,12 +100,12 @@ STATIC mp_obj_t nativeio_digitalinout_obj___exit__(size_t n_args, const mp_obj_t
101100
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(nativeio_digitalinout_obj___exit___obj, 4, 4, nativeio_digitalinout_obj___exit__);
102101

103102
//|
104-
//| .. method:: switch_to_output(value=False, drive_mode=DriveMode.push_pull)
103+
//| .. method:: switch_to_output(value=False, drive_mode=DriveMode.PUSH_PULL)
105104
//|
106105
//| Switch to writing out digital values.
107106
//|
108107
//| :param bool value: default value to set upon switching
109-
//| :param DriveMode push_pull: drive mode for the output
108+
//| :param DriveMode drive_mode: drive mode for the output
110109
//|
111110
typedef struct {
112111
mp_obj_base_t base;
@@ -146,9 +145,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(nativeio_digitalinout_switch_to_output_obj, 1, native
146145
//| import board
147146
//|
148147
//| with nativeio.DigitalInOut(board.SLIDE_SWITCH) as switch:
149-
//| switch.switch_to_input(pull=nativeio.DigitalInOut.Pull.up)
148+
//| switch.switch_to_input(pull=nativeio.DigitalInOut.Pull.UP)
150149
//| # Or, after switch_to_input
151-
//| switch.pull = nativeio.DigitalInOut.Pull.up
150+
//| switch.pull = nativeio.DigitalInOut.Pull.UP
152151
//| print(switch.value)
153152
//|
154153
typedef struct {
@@ -332,11 +331,11 @@ mp_obj_property_t nativeio_digitalinout_pull_obj = {
332331
//| Enum-like class to define which direction the digital values are
333332
//| going.
334333
//|
335-
//| .. data:: in
334+
//| .. data:: IN
336335
//|
337336
//| Read digital data in
338337
//|
339-
//| .. data:: out
338+
//| .. data:: OUT
340339
//|
341340
//| Write digital data out
342341
//|
@@ -351,14 +350,23 @@ const nativeio_digitalinout_direction_obj_t nativeio_digitalinout_direction_out_
351350
};
352351

353352
STATIC const mp_rom_map_elem_t nativeio_digitalinout_direction_locals_dict_table[] = {
354-
{ MP_ROM_QSTR(MP_QSTR_in), MP_ROM_PTR(&nativeio_digitalinout_direction_in_obj) },
355-
{ MP_ROM_QSTR(MP_QSTR_out), MP_ROM_PTR(&nativeio_digitalinout_direction_out_obj) },
353+
{ MP_ROM_QSTR(MP_QSTR_IN), MP_ROM_PTR(&nativeio_digitalinout_direction_in_obj) },
354+
{ MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_PTR(&nativeio_digitalinout_direction_out_obj) },
356355
};
357356
STATIC MP_DEFINE_CONST_DICT(nativeio_digitalinout_direction_locals_dict, nativeio_digitalinout_direction_locals_dict_table);
358357

358+
STATIC void nativeio_digitalinout_direction_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
359+
qstr direction = MP_QSTR_IN;
360+
if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&nativeio_digitalinout_direction_out_obj)) {
361+
direction = MP_QSTR_OUT;
362+
}
363+
mp_printf(print, "%q.%q.%q.%q", MP_QSTR_nativeio, MP_QSTR_DigitalInOut, MP_QSTR_Direction, direction);
364+
}
365+
359366
const mp_obj_type_t nativeio_digitalinout_direction_type = {
360367
{ &mp_type_type },
361368
.name = MP_QSTR_Direction,
369+
.print = nativeio_digitalinout_direction_print,
362370
.locals_dict = (mp_obj_t)&nativeio_digitalinout_direction_locals_dict,
363371
};
364372

@@ -367,11 +375,11 @@ const mp_obj_type_t nativeio_digitalinout_direction_type = {
367375
//| Enum-like class to define the drive mode used when outputting
368376
//| digital values.
369377
//|
370-
//| .. data:: push_pull
378+
//| .. data:: PUSH_PULL
371379
//|
372380
//| Output both high and low digital values
373381
//|
374-
//| .. data:: open_drain
382+
//| .. data:: OPEN_DRAIN
375383
//|
376384
//| Output low digital values but go into high z for digital high. This is
377385
//| useful for i2c and other protocols that share a digital line.
@@ -387,14 +395,23 @@ const nativeio_digitalinout_drive_mode_obj_t nativeio_digitalinout_drive_mode_op
387395
};
388396

389397
STATIC const mp_rom_map_elem_t nativeio_digitalinout_drive_mode_locals_dict_table[] = {
390-
{ MP_ROM_QSTR(MP_QSTR_push_pull), MP_ROM_PTR(&nativeio_digitalinout_drive_mode_push_pull_obj) },
391-
{ MP_ROM_QSTR(MP_QSTR_open_drain), MP_ROM_PTR(&nativeio_digitalinout_drive_mode_open_drain_obj) },
398+
{ MP_ROM_QSTR(MP_QSTR_PUSH_PULL), MP_ROM_PTR(&nativeio_digitalinout_drive_mode_push_pull_obj) },
399+
{ MP_ROM_QSTR(MP_QSTR_OPEN_DRAIN), MP_ROM_PTR(&nativeio_digitalinout_drive_mode_open_drain_obj) },
392400
};
393401
STATIC MP_DEFINE_CONST_DICT(nativeio_digitalinout_drive_mode_locals_dict, nativeio_digitalinout_drive_mode_locals_dict_table);
394402

403+
STATIC void nativeio_digitalinout_drive_mode_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
404+
qstr drive_mode = MP_QSTR_PUSH_PULL;
405+
if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&nativeio_digitalinout_drive_mode_open_drain_obj)) {
406+
drive_mode = MP_QSTR_OPEN_DRAIN;
407+
}
408+
mp_printf(print, "%q.%q.%q.%q", MP_QSTR_nativeio, MP_QSTR_DigitalInOut, MP_QSTR_DriveMode, drive_mode);
409+
}
410+
395411
const mp_obj_type_t nativeio_digitalinout_drive_mode_type = {
396412
{ &mp_type_type },
397413
.name = MP_QSTR_DriveMode,
414+
.print = nativeio_digitalinout_drive_mode_print,
398415
.locals_dict = (mp_obj_t)&nativeio_digitalinout_drive_mode_locals_dict,
399416
};
400417

@@ -403,12 +420,12 @@ const mp_obj_type_t nativeio_digitalinout_drive_mode_type = {
403420
//| Enum-like class to define the pull value, if any, used while reading
404421
//| digital values in.
405422
//|
406-
//| .. data:: up
423+
//| .. data:: UP
407424
//|
408425
//| When the input line isn't being driven the pull up can pull the state
409426
//| of the line high so it reads as true.
410427
//|
411-
//| .. data:: down
428+
//| .. data:: DOWN
412429
//|
413430
//| When the input line isn't being driven the pull down can pull the
414431
//| state of the line low so it reads as false.
@@ -424,21 +441,30 @@ const nativeio_digitalinout_pull_obj_t nativeio_digitalinout_pull_down_obj = {
424441
};
425442

426443
STATIC const mp_rom_map_elem_t nativeio_digitalinout_pull_locals_dict_table[] = {
427-
{ MP_ROM_QSTR(MP_QSTR_up), MP_ROM_PTR(&nativeio_digitalinout_pull_up_obj) },
428-
{ MP_ROM_QSTR(MP_QSTR_down), MP_ROM_PTR(&nativeio_digitalinout_pull_down_obj) },
444+
{ MP_ROM_QSTR(MP_QSTR_UP), MP_ROM_PTR(&nativeio_digitalinout_pull_up_obj) },
445+
{ MP_ROM_QSTR(MP_QSTR_DOWN), MP_ROM_PTR(&nativeio_digitalinout_pull_down_obj) },
429446
};
430447
STATIC MP_DEFINE_CONST_DICT(nativeio_digitalinout_pull_locals_dict, nativeio_digitalinout_pull_locals_dict_table);
431448

449+
STATIC void nativeio_digitalinout_pull_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
450+
qstr pull = MP_QSTR_UP;
451+
if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&nativeio_digitalinout_pull_down_obj)) {
452+
pull = MP_QSTR_DOWN;
453+
}
454+
mp_printf(print, "%q.%q.%q.%q", MP_QSTR_nativeio, MP_QSTR_DigitalInOut, MP_QSTR_Pull, pull);
455+
}
456+
432457
const mp_obj_type_t nativeio_digitalinout_pull_type = {
433458
{ &mp_type_type },
434459
.name = MP_QSTR_Pull,
460+
.print = nativeio_digitalinout_pull_print,
435461
.locals_dict = (mp_obj_t)&nativeio_digitalinout_pull_locals_dict,
436462
};
437463

438464
STATIC const mp_rom_map_elem_t nativeio_digitalinout_locals_dict_table[] = {
439465
// instance methods
440466
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&nativeio_digitalinout_deinit_obj) },
441-
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&nativeio_digitalinout___enter___obj) },
467+
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
442468
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&nativeio_digitalinout_obj___exit___obj) },
443469
{ MP_ROM_QSTR(MP_QSTR_switch_to_output), MP_ROM_PTR(&nativeio_digitalinout_switch_to_output_obj) },
444470
{ MP_ROM_QSTR(MP_QSTR_switch_to_input), MP_ROM_PTR(&nativeio_digitalinout_switch_to_input_obj) },

0 commit comments

Comments
 (0)