diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-12-05 22:45:53 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-12-05 22:45:53 -0500 |
| commit | 40434d691934cf7f5792f91ce0288beb568bab85 (patch) | |
| tree | e2f7d0191685f0b519e98c3e1551626fbbf49585 /shared-module/bitbangio/SPI.c | |
| parent | 1505da784f228d43df41a773cfe504e7e4da330a (diff) | |
| parent | 15886b1505d854d76e353b9c5261568c7065d2bf (diff) | |
wip
Diffstat (limited to 'shared-module/bitbangio/SPI.c')
| -rw-r--r-- | shared-module/bitbangio/SPI.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/shared-module/bitbangio/SPI.c b/shared-module/bitbangio/SPI.c index 6d3a28523..d02adf34f 100644 --- a/shared-module/bitbangio/SPI.c +++ b/shared-module/bitbangio/SPI.c @@ -43,6 +43,8 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self, if (result != DIGITALINOUT_OK) { mp_raise_ValueError(translate("Clock pin init failed.")); } + common_hal_digitalio_digitalinout_switch_to_output(&self->clock, self->polarity == 1, DRIVE_MODE_PUSH_PULL); + if (mosi != mp_const_none) { result = common_hal_digitalio_digitalinout_construct(&self->mosi, mosi); if (result != DIGITALINOUT_OK) { @@ -50,8 +52,11 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self, mp_raise_ValueError(translate("MOSI pin init failed.")); } self->has_mosi = true; + common_hal_digitalio_digitalinout_switch_to_output(&self->mosi, false, DRIVE_MODE_PUSH_PULL); } + if (miso != mp_const_none) { + // Starts out as input by default, no need to change. result = common_hal_digitalio_digitalinout_construct(&self->miso, miso); if (result != DIGITALINOUT_OK) { common_hal_digitalio_digitalinout_deinit(&self->clock); |
