summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-09-13 21:36:40 +0200
committerDaniel Campora <daniel@wipy.io>2015-09-16 10:10:31 +0200
commit624cdeacc4c2678273ae535f3ede84846afe3ef5 (patch)
tree2752114f4bd1eb5b65834d2ddfe229cb653d63e2
parent41f6948545c8f5909413badbef2dcd5794598bf0 (diff)
downloadmicropython-624cdeacc4c2678273ae535f3ede84846afe3ef5.tar.gz
micropython-624cdeacc4c2678273ae535f3ede84846afe3ef5.zip
docs/wipy: Add pins to the I2C constructor.
-rw-r--r--cc3200/mods/pybi2c.c5
-rw-r--r--docs/library/pyb.I2C.rst3
2 files changed, 4 insertions, 4 deletions
diff --git a/cc3200/mods/pybi2c.c b/cc3200/mods/pybi2c.c
index 04ed0d2c29..cc063bd1e2 100644
--- a/cc3200/mods/pybi2c.c
+++ b/cc3200/mods/pybi2c.c
@@ -323,7 +323,6 @@ STATIC const mp_arg_t pyb_i2c_init_args[] = {
{ MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 100000} },
{ MP_QSTR_pins, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
-#define PYB_I2C_INIT_NUM_ARGS MP_ARRAY_SIZE(pyb_i2c_init_args)
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) {
// parse args
mp_map_t kw_args;
@@ -331,8 +330,8 @@ STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_i2c_init_args)];
mp_arg_parse_all(n_args, all_args, &kw_args, MP_ARRAY_SIZE(args), pyb_i2c_init_args, args);
- // work out the uart id
- uint8_t i2c_id;
+ // work out the i2c id
+ uint i2c_id;
if (args[0].u_obj == mp_const_none) {
// default id
i2c_id = 0;
diff --git a/docs/library/pyb.I2C.rst b/docs/library/pyb.I2C.rst
index caeb3d6630..eb60f22ffa 100644
--- a/docs/library/pyb.I2C.rst
+++ b/docs/library/pyb.I2C.rst
@@ -181,12 +181,13 @@ Methods
.. only:: port_wipy
- .. method:: i2c.init(mode, \*, baudrate=100000)
+ .. method:: i2c.init(mode, \*, baudrate=100000, pins=(SDA, SCL))
Initialise the I2C bus with the given parameters:
- ``mode`` must be ``I2C.MASTER``
- ``baudrate`` is the SCL clock rate
+ - ``pins`` is an optional tuple with the pins to assign to the I2C bus.
.. method:: i2c.readfrom(addr, nbytes)