Skip to main content


Configures the I²C clock speed and enables the port




Name Type Description
clockSpeed Constant The preferred I²C clock speed




This method enables the specified I²C port and sets its clock speed. Only certain clock speeds are available; select the one you require by consulting the datasheet of the peripheral you are connecting to the imp and passing one of the following constants into i2c.configure()’s only parameter:

Clock Speed Constant Value Description
CLOCK_SPEED_10_KHZ 10000 Clock speed of 10kHz
CLOCK_SPEED_50_KHZ 50000 Clock speed of 50kHz
CLOCK_SPEED_100_KHZ 100000 Clock speed of 100kHz
CLOCK_SPEED_400_KHZ 400000 Clock speed of 400kHz

The values assigned to the constants may change in a future impOS™ release.

Example Code

The code below provides an example of using an I²C device. It configures an SA56004X temperature sensor — as found on the Hannah R2 reference design, for example — by requesting the CLOCK_SPEED_400_KHZ clocking rate.

The following code snippet shows how a you might support multiple versions of a product, each based on a different imp type, in the same application code by aliasing I²C peripherals to imp-specific objects.