File tree 5 files changed +14
-0
lines changed
adafruit_bus_device/spi_device 5 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 99
99
#define CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS (1)
100
100
#endif
101
101
102
+ #define CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY (1)
103
+
102
104
#endif // MICROPY_INCLUDED_ESPRESSIF_MPCONFIGPORT_H
Original file line number Diff line number Diff line change @@ -582,6 +582,10 @@ void supervisor_run_background_tasks_if_tick(void);
582
582
#define MICROPY_WRAP_MP_EXECUTE_BYTECODE PLACE_IN_ITCM
583
583
#endif
584
584
585
+ #ifndef CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY
586
+ #define CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY (0)
587
+ #endif
588
+
585
589
#ifndef CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL
586
590
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (0)
587
591
#endif
Original file line number Diff line number Diff line change @@ -105,9 +105,13 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type
105
105
if (args [ARG_chip_select ].u_obj != MP_OBJ_NULL ) {
106
106
digitalinout_result_t result = common_hal_digitalio_digitalinout_switch_to_output (MP_OBJ_TO_PTR (args [ARG_chip_select ].u_obj ),
107
107
true, DRIVE_MODE_PUSH_PULL );
108
+ #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY
108
109
if (result == DIGITALINOUT_INPUT_ONLY ) {
109
110
mp_raise_NotImplementedError (translate ("Pin is input only" ));
110
111
}
112
+ #else
113
+ (void )result ;
114
+ #endif
111
115
}
112
116
113
117
return (mp_obj_t )self ;
Original file line number Diff line number Diff line change @@ -53,8 +53,10 @@ STATIC void check_result(digitalinout_result_t result) {
53
53
return ;
54
54
case DIGITALINOUT_PIN_BUSY :
55
55
mp_raise_ValueError_varg (translate ("%q in use" ), MP_QSTR_Pin );
56
+ #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY
56
57
case DIGITALINOUT_INPUT_ONLY :
57
58
mp_raise_ValueError_varg (translate ("Invalid %q" ), MP_QSTR_direction );
59
+ #endif
58
60
#if CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL
59
61
case DIGITALINOUT_INVALID_PULL :
60
62
mp_raise_ValueError_varg (translate ("Invalid %q" ), MP_QSTR_pull );
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ extern const mp_obj_type_t digitalio_digitalinout_type;
38
38
typedef enum {
39
39
DIGITALINOUT_OK ,
40
40
DIGITALINOUT_PIN_BUSY ,
41
+ #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY
41
42
DIGITALINOUT_INPUT_ONLY ,
43
+ #endif
42
44
#if CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL
43
45
DIGITALINOUT_INVALID_PULL ,
44
46
#endif
You can’t perform that action at this time.
0 commit comments