Skip to content

Commit b9d68bc

Browse files
committed
Change I2C default to 100khz
Greater that 100khz is technically out of the original spec. Background here: adafruit/Adafruit_CircuitPython_CLUE#36
1 parent dd86cb0 commit b9d68bc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

shared-bindings/busio/I2C.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//| class I2C:
4040
//| """Two wire serial protocol"""
4141
//|
42-
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None:
42+
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None:
4343
//|
4444
//| """I2C is a two-wire protocol for communicating between devices. At the
4545
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
@@ -70,7 +70,7 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con
7070
static const mp_arg_t allowed_args[] = {
7171
{ MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ },
7272
{ MP_QSTR_sda, MP_ARG_REQUIRED | MP_ARG_OBJ },
73-
{ MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 400000} },
73+
{ MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 100000} },
7474
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 255} },
7575
};
7676
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];

shared-module/board/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mp_obj_t common_hal_board_create_i2c(void) {
6161
busio_i2c_obj_t *self = &i2c_obj;
6262
self->base.type = &busio_i2c_type;
6363

64-
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
64+
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 100000, 0);
6565
i2c_singleton = (mp_obj_t)self;
6666
return i2c_singleton;
6767
}

0 commit comments

Comments
 (0)