Skip to content

Commit 847a6b3

Browse files
committed
Incorporate stylistic changes suggested by @dhylands
1 parent e687fdb commit 847a6b3

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

stmhal/i2c.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,15 @@ STATIC mp_obj_t pyb_i2c_recv(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
453453
}
454454
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_recv_obj, 1, pyb_i2c_recv);
455455

456-
/// \method mem_read(data, addr, memaddr, timeout=5000, memaddr_use_16b=False)
456+
/// \method mem_read(data, addr, memaddr, timeout=5000, use_16bit_addr=False)
457457
///
458458
/// Read from the memory of an I2C device:
459459
///
460460
/// - `data` can be an integer or a buffer to read into
461461
/// - `addr` is the I2C device address
462462
/// - `memaddr` is the memory location within the I2C device
463463
/// - `timeout` is the timeout in milliseconds to wait for the read
464-
/// - `memaddr_use_16b` selects width of memaddr: 8 or 16 bits
464+
/// - `use_16bit_addr` selects width of memaddr: 8 or 16 bits
465465
///
466466
/// Returns the read data.
467467
/// This is only valid in master mode.
@@ -470,7 +470,7 @@ STATIC const mp_arg_t pyb_i2c_mem_read_args[] = {
470470
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
471471
{ MP_QSTR_memaddr, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
472472
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 5000} },
473-
{ MP_QSTR_memaddr_use_16b, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
473+
{ MP_QSTR_use_16bit_addr, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
474474
};
475475
#define PYB_I2C_MEM_READ_NUM_ARGS MP_ARRAY_SIZE(pyb_i2c_mem_read_args)
476476

@@ -494,8 +494,8 @@ STATIC mp_obj_t pyb_i2c_mem_read(uint n_args, const mp_obj_t *args, mp_map_t *kw
494494
mp_uint_t mem_addr = vals[2].u_int;
495495
// determine width of mem_addr
496496
mp_uint_t mem_addr_size = I2C_MEMADD_SIZE_8BIT;
497-
if( vals[4].u_bool ) {
498-
mem_addr_size = I2C_MEMADD_SIZE_16BIT;
497+
if (vals[4].u_bool) {
498+
mem_addr_size = I2C_MEMADD_SIZE_16BIT;
499499
}
500500

501501
HAL_StatusTypeDef status = HAL_I2C_Mem_Read(self->i2c, i2c_addr, mem_addr, mem_addr_size, bufinfo.buf, bufinfo.len, vals[3].u_int);
@@ -514,15 +514,15 @@ STATIC mp_obj_t pyb_i2c_mem_read(uint n_args, const mp_obj_t *args, mp_map_t *kw
514514
}
515515
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_mem_read_obj, 1, pyb_i2c_mem_read);
516516

517-
/// \method mem_write(data, addr, memaddr, timeout=5000, memaddr_use_16b=False)
517+
/// \method mem_write(data, addr, memaddr, timeout=5000, use_16bit_addr=False)
518518
///
519519
/// Write to the memory of an I2C device:
520520
///
521521
/// - `data` can be an integer or a buffer to write from
522522
/// - `addr` is the I2C device address
523523
/// - `memaddr` is the memory location within the I2C device
524524
/// - `timeout` is the timeout in milliseconds to wait for the write
525-
/// - `memaddr_use_16b` selects width of memaddr: 8 or 16 bits
525+
/// - `use_16bit_addr` selects width of memaddr: 8 or 16 bits
526526
///
527527
/// Returns `None`.
528528
/// This is only valid in master mode.
@@ -547,8 +547,8 @@ STATIC mp_obj_t pyb_i2c_mem_write(uint n_args, const mp_obj_t *args, mp_map_t *k
547547
mp_uint_t mem_addr = vals[2].u_int;
548548
// determine width of mem_addr
549549
mp_uint_t mem_addr_size = I2C_MEMADD_SIZE_8BIT;
550-
if( vals[4].u_bool ) {
551-
mem_addr_size = I2C_MEMADD_SIZE_16BIT;
550+
if (vals[4].u_bool) {
551+
mem_addr_size = I2C_MEMADD_SIZE_16BIT;
552552
}
553553

554554
HAL_StatusTypeDef status = HAL_I2C_Mem_Write(self->i2c, i2c_addr, mem_addr, mem_addr_size, bufinfo.buf, bufinfo.len, vals[3].u_int);

stmhal/qstrdefsport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Q(baudrate)
160160
Q(gencall)
161161
Q(data)
162162
Q(memaddr)
163-
Q(memaddr_use_16b)
163+
Q(use_16bit_addr)
164164
Q(timeout)
165165
Q(init)
166166
Q(deinit)

0 commit comments

Comments
 (0)