Skip to content

Commit 7e809b4

Browse files
committed
esp8266/modpybspi: Configure pins when initialising an SPI object.
1 parent 68e222a commit 7e809b4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

esp8266/modpybspi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ STATIC void pyb_spi_init_helper(pyb_spi_obj_t *self, size_t n_args, const mp_obj
123123
if (args[ARG_miso].u_obj != MP_OBJ_NULL) {
124124
self->miso = mp_hal_get_pin_obj(args[ARG_miso].u_obj);
125125
}
126+
127+
// configure pins
128+
mp_hal_pin_write(self->sck, self->polarity);
129+
mp_hal_pin_output(self->sck);
130+
mp_hal_pin_output(self->mosi);
131+
mp_hal_pin_input(self->miso);
126132
}
127133

128134
STATIC mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {

0 commit comments

Comments
 (0)