diff --git a/cpu/nrf52/periph/i2c.c b/cpu/nrf52/periph/i2c.c index b8d681fdeb..2204d39b4a 100644 --- a/cpu/nrf52/periph/i2c.c +++ b/cpu/nrf52/periph/i2c.c @@ -32,7 +32,13 @@ */ #define INVALID_SPEED_MASK (0x0f) -static mutex_t locks[I2C_NUMOF]; +/** + * @brief Initialized bus locks (we have a maximum of two devices...) + */ +static mutex_t locks[] = { + MUTEX_INIT, + MUTEX_INIT +}; static inline NRF_TWIM_Type *dev(i2c_t bus) { @@ -98,9 +104,6 @@ int i2c_init_master(i2c_t bus, i2c_speed_t speed) return -2; } - /* initialize lock */ - mutex_init(&locks[bus]); - /* pin configuration */ NRF_P0->PIN_CNF[i2c_config[bus].pin_scl] = (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos); NRF_P0->PIN_CNF[i2c_config[bus].pin_scl] = (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos);