Skip to content

Commit 624cdea

Browse files
author
Daniel Campora
committed
docs/wipy: Add pins to the I2C constructor.
1 parent 41f6948 commit 624cdea

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cc3200/mods/pybi2c.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,15 @@ STATIC const mp_arg_t pyb_i2c_init_args[] = {
323323
{ MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 100000} },
324324
{ MP_QSTR_pins, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
325325
};
326-
#define PYB_I2C_INIT_NUM_ARGS MP_ARRAY_SIZE(pyb_i2c_init_args)
327326
STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *all_args) {
328327
// parse args
329328
mp_map_t kw_args;
330329
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
331330
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_i2c_init_args)];
332331
mp_arg_parse_all(n_args, all_args, &kw_args, MP_ARRAY_SIZE(args), pyb_i2c_init_args, args);
333332

334-
// work out the uart id
335-
uint8_t i2c_id;
333+
// work out the i2c id
334+
uint i2c_id;
336335
if (args[0].u_obj == mp_const_none) {
337336
// default id
338337
i2c_id = 0;

docs/library/pyb.I2C.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,13 @@ Methods
181181

182182
.. only:: port_wipy
183183

184-
.. method:: i2c.init(mode, \*, baudrate=100000)
184+
.. method:: i2c.init(mode, \*, baudrate=100000, pins=(SDA, SCL))
185185

186186
Initialise the I2C bus with the given parameters:
187187

188188
- ``mode`` must be ``I2C.MASTER``
189189
- ``baudrate`` is the SCL clock rate
190+
- ``pins`` is an optional tuple with the pins to assign to the I2C bus.
190191

191192
.. method:: i2c.readfrom(addr, nbytes)
192193

0 commit comments

Comments
 (0)