Skip to content

Commit 8c03229

Browse files
committed
working on being able to share the SPI Bus
1 parent fb8cf73 commit 8c03229

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

micropy_updates/stm32/machine_spi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
165165
}
166166

167167
// set the SPI configuration values
168-
SPI_InitTypeDef *init = &((spi_t *)(self->spi_bus->user_data)->Init);
168+
169+
spi_t *spi = (spi_t *)self->spi_bus->user_data
170+
SPI_InitTypeDef *init = spi->Init;
169171
init->Mode = SPI_MODE_MASTER;
170172

171173
// these parameters are not currently configurable
@@ -200,7 +202,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
200202
mp_raise_OSError(-ret);
201203
}
202204

203-
self->spi_bus->state == MP_SPI_STATE_STARTED;
205+
self->spi_bus->state = MP_SPI_STATE_STARTED;
204206
}
205207

206208
if (self->cs != mp_const_none) {

0 commit comments

Comments
 (0)