File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
shared-bindings/i2cioexpander
shared-module/i2cioexpander Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -42,16 +42,12 @@ static inline void check_for_deinit(i2cioexpander_iopin_obj_t *self) {
4242 raise_deinited_error ();
4343 }
4444}
45-
46- //| def deinit(self) -> None:
47- //| """Turn off the pin and release it for other use."""
48- //| ...
49- static mp_obj_t i2cioexpander_iopin_deinit (mp_obj_t self_in ) {
50- i2cioexpander_iopin_obj_t * self = MP_OBJ_TO_PTR (self_in );
51- common_hal_i2cioexpander_iopin_deinit (self );
52- return mp_const_none ;
53- }
54- MP_DEFINE_CONST_FUN_OBJ_1 (i2cioexpander_iopin_deinit_obj , i2cioexpander_iopin_deinit );
45+ //| class IOPin:
46+ //| """Control a single pin on an `IOExpander` in the same way as `DigitalInOut`.
47+ //|
48+ //| Not constructed directly. Get from `IOExpander.pins` instead.
49+ //| """
50+ //|
5551
5652//| def switch_to_output(
5753//| self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL
@@ -310,7 +306,6 @@ static const digitalinout_p_t iopin_digitalinout_p = {
310306
311307static const mp_rom_map_elem_t i2cioexpander_iopin_locals_dict_table [] = {
312308 // Methods
313- { MP_ROM_QSTR (MP_QSTR_deinit ), MP_ROM_PTR (& i2cioexpander_iopin_deinit_obj ) },
314309 { MP_ROM_QSTR (MP_QSTR_switch_to_input ), MP_ROM_PTR (& i2cioexpander_iopin_switch_to_input_obj ) },
315310 { MP_ROM_QSTR (MP_QSTR_switch_to_output ), MP_ROM_PTR (& i2cioexpander_iopin_switch_to_output_obj ) },
316311
Original file line number Diff line number Diff line change @@ -26,11 +26,12 @@ mp_errno_t i2cioexpander_iopin_construct(
2626}
2727
2828void common_hal_i2cioexpander_iopin_deinit (i2cioexpander_iopin_obj_t * self ) {
29- self -> expander = NULL ;
29+ // Switch to input on deinit.
30+ common_hal_i2cioexpander_iopin_switch_to_input (self , PULL_NONE );
3031}
3132
3233bool common_hal_i2cioexpander_iopin_deinited (i2cioexpander_iopin_obj_t * self ) {
33- return self -> expander == NULL ;
34+ return self -> expander == NULL || common_hal_i2cioexpander_ioexpander_deinited ( self -> expander ) ;
3435}
3536
3637digitalinout_result_t common_hal_i2cioexpander_iopin_switch_to_input (
You can’t perform that action at this time.
0 commit comments