drivers/tsl2561: add missing acquire∕release functions
This commit is contained in:
parent
742b6ac4f4
commit
014884264f
@ -84,6 +84,7 @@ int tsl2561_init(tsl2561_t *dev, const tsl2561_params_t *params)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_disable(dev);
|
_disable(dev);
|
||||||
|
i2c_release(DEV_I2C);
|
||||||
|
|
||||||
return TSL2561_OK;
|
return TSL2561_OK;
|
||||||
}
|
}
|
||||||
@ -212,6 +213,8 @@ static void _disable(const tsl2561_t *dev)
|
|||||||
|
|
||||||
static void _read_data(const tsl2561_t *dev, uint16_t *full, uint16_t *ir)
|
static void _read_data(const tsl2561_t *dev, uint16_t *full, uint16_t *ir)
|
||||||
{
|
{
|
||||||
|
/* acquire bus */
|
||||||
|
i2c_acquire(DEV_I2C);
|
||||||
/* Enable the device */
|
/* Enable the device */
|
||||||
_enable(dev);
|
_enable(dev);
|
||||||
|
|
||||||
@ -247,6 +250,8 @@ static void _read_data(const tsl2561_t *dev, uint16_t *full, uint16_t *ir)
|
|||||||
|
|
||||||
/* Turn the device off to save power */
|
/* Turn the device off to save power */
|
||||||
_disable(dev);
|
_disable(dev);
|
||||||
|
/* release bus */
|
||||||
|
i2c_release(DEV_I2C);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _print_init_info(const tsl2561_t *dev)
|
static void _print_init_info(const tsl2561_t *dev)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user