diff options
author | Damien George <damien.p.george@gmail.com> | 2016-10-03 12:39:31 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-10-03 12:39:31 +1100 |
commit | 5bb28c7f10ebd1036302cf7ac0b24a7a233de2aa (patch) | |
tree | 6f8546bc8346bee9193251443122212f76d2af94 /extmod/machine_spi.h | |
parent | a0d97fe40872b46872657bedc0e47cfd704c59aa (diff) |
extmod/machine_spi: Simplify SPI xfer function to only take one buf len.
There is no need to take src_len and dest_len arguments. The case of
reading-only with a single output byte (originally src_len=1, dest_len>1)
is now handled by using the output buffer as the input buffer, and using
memset to fill the output byte into this buffer. This simplifies the
implementations of the spi_transfer protocol function.
Diffstat (limited to 'extmod/machine_spi.h')
-rw-r--r-- | extmod/machine_spi.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/machine_spi.h b/extmod/machine_spi.h index 26d716fc1..35a911d91 100644 --- a/extmod/machine_spi.h +++ b/extmod/machine_spi.h @@ -31,7 +31,7 @@ // SPI protocol typedef struct _mp_machine_spi_p_t { - void (*transfer)(mp_obj_base_t *obj, size_t slen, const uint8_t *src, size_t dlen, uint8_t *dest); + void (*transfer)(mp_obj_base_t *obj, size_t len, const uint8_t *src, uint8_t *dest); } mp_machine_spi_p_t; MP_DECLARE_CONST_FUN_OBJ(mp_machine_spi_read_obj); |