Skip to content

Commit

Permalink
Change I2C default to 100khz
Browse files Browse the repository at this point in the history
Greater that 100khz is technically out of the original spec.

Background here: adafruit/Adafruit_CircuitPython_CLUE#36
  • Loading branch information
tannewt committed Sep 25, 2020
1 parent dd86cb0 commit b9d68bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions shared-bindings/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//| class I2C:
//| """Two wire serial protocol"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None:
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None:
//|
//| """I2C is a two-wire protocol for communicating between devices. At the
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
Expand Down Expand Up @@ -70,7 +70,7 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_sda, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 400000} },
{ MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 100000} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 255} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
Expand Down
2 changes: 1 addition & 1 deletion shared-module/board/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mp_obj_t common_hal_board_create_i2c(void) {
busio_i2c_obj_t *self = &i2c_obj;
self->base.type = &busio_i2c_type;

common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 100000, 0);
i2c_singleton = (mp_obj_t)self;
return i2c_singleton;
}
Expand Down

0 comments on commit b9d68bc

Please sign in to comment.