fix semaphore initialisation in max17048 driver
Previously, we were using the semaphore before initialising it; this is now fixed.
This commit is contained in:
parent
031db47519
commit
72e83db34a
1 changed files with 3 additions and 1 deletions
|
@ -186,13 +186,15 @@ static int max17048_init(const struct device *dev) {
|
|||
return err;
|
||||
}
|
||||
|
||||
// the functions below need the semaphore, so initialise it here
|
||||
k_sem_init(&drv_data->lock, 1, 1);
|
||||
|
||||
// bring the device out of sleep
|
||||
set_sleep_enabled(dev, false);
|
||||
|
||||
// set the default rcomp value -- 0x97, as stated in the datasheet
|
||||
set_rcomp_value(dev, 0x97);
|
||||
|
||||
k_sem_init(&drv_data->lock, 1, 1);
|
||||
LOG_INF("device initialised at 0x%x (version %d)", config->i2c_bus.addr, ic_version);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue