diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-26 10:47:29 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-26 10:47:29 +0100 |
commit | 6d3c5e4301df363055dc256e6692c610e4d0b918 (patch) | |
tree | a07a18ed1a13d50990cf0e43a2a3c919cb14240d /stmhal/uart.c | |
parent | d139c489bab6b58906868e3fc8383ea813a122d4 (diff) | |
download | micropython-6d3c5e4301df363055dc256e6692c610e4d0b918.tar.gz micropython-6d3c5e4301df363055dc256e6692c610e4d0b918.zip |
Add ARRAY_SIZE macro, and use it where possible.
Diffstat (limited to 'stmhal/uart.c')
-rw-r--r-- | stmhal/uart.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/stmhal/uart.c b/stmhal/uart.c index 1b0d9e1b60..66997ce3e9 100644 --- a/stmhal/uart.c +++ b/stmhal/uart.c @@ -231,7 +231,7 @@ STATIC const mp_arg_parse_t pyb_uart_init_accepted_args[] = { { MP_QSTR_stop, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_INT, {.u_int = 1} }, { MP_QSTR_parity, MP_ARG_PARSE_KW_ONLY | MP_ARG_PARSE_OBJ, {.u_obj = mp_const_none} }, }; -#define PYB_UART_INIT_NUM_ARGS (sizeof(pyb_uart_init_accepted_args) / sizeof(pyb_uart_init_accepted_args[0])) +#define PYB_UART_INIT_NUM_ARGS ARRAY_SIZE(pyb_uart_init_accepted_args) STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { // parse args @@ -331,7 +331,7 @@ STATIC const mp_arg_parse_t pyb_uart_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_UART_SEND_NUM_ARGS (sizeof(pyb_uart_send_accepted_args) / sizeof(pyb_uart_send_accepted_args[0])) +#define PYB_UART_SEND_NUM_ARGS ARRAY_SIZE(pyb_uart_send_accepted_args) STATIC mp_obj_t pyb_uart_send(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { // TODO assumes transmission size is 8-bits wide @@ -363,7 +363,7 @@ STATIC const mp_arg_parse_t pyb_uart_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_UART_RECV_NUM_ARGS (sizeof(pyb_uart_recv_accepted_args) / sizeof(pyb_uart_recv_accepted_args[0])) +#define PYB_UART_RECV_NUM_ARGS ARRAY_SIZE(pyb_uart_recv_accepted_args) STATIC mp_obj_t pyb_uart_recv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { // TODO assumes transmission size is 8-bits wide |