1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #8486 from haukepetersen/fix_nrf52_i2c-mutexinit

cpu/nrf52/i2c: use static mutex initializtion
This commit is contained in:
Peter Kietzmann 2018-02-02 10:53:50 +01:00 committed by GitHub
commit 047219aff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);