summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/spi.c')
-rw-r--r--stmhal/spi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stmhal/spi.c b/stmhal/spi.c
index 99bc08c3b1..7e2e4ad4cf 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.c
@@ -158,7 +158,7 @@ STATIC const pyb_spi_obj_t pyb_spi_obj[] = {
{{&pyb_spi_type}, NULL},
#endif
};
-#define PYB_NUM_SPI (sizeof(pyb_spi_obj) / sizeof(pyb_spi_obj[0]))
+#define PYB_NUM_SPI ARRAY_SIZE(pyb_spi_obj)
STATIC void pyb_spi_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_spi_obj_t *self = self_in;
@@ -206,7 +206,7 @@ STATIC const mp_arg_parse_t pyb_spi_init_accepted_args[] = {
{ MP_QSTR_ti, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_BOOL, {.u_bool = false} },
{ MP_QSTR_crc, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_OBJ, {.u_obj = mp_const_none} },
};
-#define PYB_SPI_INIT_NUM_ARGS (sizeof(pyb_spi_init_accepted_args) / sizeof(pyb_spi_init_accepted_args[0]))
+#define PYB_SPI_INIT_NUM_ARGS ARRAY_SIZE(pyb_spi_init_accepted_args)
STATIC mp_obj_t pyb_spi_init_helper(const pyb_spi_obj_t *self, uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// parse args
@@ -299,7 +299,7 @@ STATIC const mp_arg_parse_t pyb_spi_send_accepted_args[] = {
{ MP_QSTR_send, MP_ARG_PARSE_REQUIRED | MP_ARG_PARSE_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_timeout, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_INT, {.u_int = 5000} },
};
-#define PYB_SPI_SEND_NUM_ARGS (sizeof(pyb_spi_send_accepted_args) / sizeof(pyb_spi_send_accepted_args[0]))
+#define PYB_SPI_SEND_NUM_ARGS ARRAY_SIZE(pyb_spi_send_accepted_args)
STATIC mp_obj_t pyb_spi_send(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// TODO assumes transmission size is 8-bits wide
@@ -331,7 +331,7 @@ STATIC const mp_arg_parse_t pyb_spi_recv_accepted_args[] = {
{ MP_QSTR_recv, MP_ARG_PARSE_REQUIRED | MP_ARG_PARSE_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_timeout, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_INT, {.u_int = 5000} },
};
-#define PYB_SPI_RECV_NUM_ARGS (sizeof(pyb_spi_recv_accepted_args) / sizeof(pyb_spi_recv_accepted_args[0]))
+#define PYB_SPI_RECV_NUM_ARGS ARRAY_SIZE(pyb_spi_recv_accepted_args)
STATIC mp_obj_t pyb_spi_recv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// TODO assumes transmission size is 8-bits wide
@@ -368,7 +368,7 @@ STATIC const mp_arg_parse_t pyb_spi_send_recv_accepted_args[] = {
{ MP_QSTR_recv, MP_ARG_PARSE_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_timeout, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_INT, {.u_int = 5000} },
};
-#define PYB_SPI_SEND_RECV_NUM_ARGS (sizeof(pyb_spi_send_recv_accepted_args) / sizeof(pyb_spi_send_recv_accepted_args[0]))
+#define PYB_SPI_SEND_RECV_NUM_ARGS ARRAY_SIZE(pyb_spi_send_recv_accepted_args)
STATIC mp_obj_t pyb_spi_send_recv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// TODO assumes transmission size is 8-bits wide