summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/machine_spi.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-07-14 17:14:16 +1000
committerDamien George <damien@micropython.org>2022-09-19 19:06:07 +1000
commita52cd5b07d6d6e2502fff2bbfb9e5b96562452a4 (patch)
treeabfbfe05586fe9c19d31adb32e82c59481ad611a /extmod/machine_spi.c
parente8355eb16357b0bd234a9bcab1c9e8b72fcdbabc (diff)
downloadmicropython-a52cd5b07d6d6e2502fff2bbfb9e5b96562452a4.tar.gz
micropython-a52cd5b07d6d6e2502fff2bbfb9e5b96562452a4.zip
py/obj: Add accessors for type slots and use everywhere.
This is a no-op, but sets the stage for changing the mp_obj_type_t representation. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'extmod/machine_spi.c')
-rw-r--r--extmod/machine_spi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/extmod/machine_spi.c b/extmod/machine_spi.c
index c7fc5877b1..54f1964e21 100644
--- a/extmod/machine_spi.c
+++ b/extmod/machine_spi.c
@@ -43,7 +43,7 @@
STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
- mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)s->type->protocol;
+ mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
spi_p->init(s, n_args - 1, args + 1, kw_args);
return mp_const_none;
}
@@ -51,7 +51,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_spi_init_obj, 1, machine_spi_init);
STATIC mp_obj_t machine_spi_deinit(mp_obj_t self) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(self);
- mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)s->type->protocol;
+ mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
if (spi_p->deinit != NULL) {
spi_p->deinit(s);
}
@@ -61,7 +61,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_spi_deinit_obj, machine_spi_deinit);
STATIC void mp_machine_spi_transfer(mp_obj_t self, size_t len, const void *src, void *dest) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(self);
- mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)s->type->protocol;
+ mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
spi_p->transfer(s, len, src, dest);
}