Commit ef21ef02 authored by schneider's avatar schneider
Browse files

fix(max86150): Turn off sensor at boot

parent ee655973
......@@ -13,6 +13,7 @@
#include "pb.h"
#include "pmic.h"
#include "portexpander.h"
#include "max86150.h"
#include "gpio.h"
#include "i2c.h"
......@@ -191,6 +192,8 @@ int hardware_early_init(void)
*/
max86150_mutex_init();
max86150_shut_down();
/* Allow user space to trigger interrupts.
* Used for BLE, not sure if needed. */
SCB->CCR |= SCB_CCR_USERSETMPEND_Msk;
......
......@@ -106,23 +106,16 @@ int epic_max86150_disable_sensor(void)
mutex_lock(&max86150_mutex);
hwlock_acquire(HWLOCK_I2C);
max86150_shut_down();
max86150_sensor_active = false;
struct stream_info *stream = &max86150_stream;
result = stream_deregister(SD_MAX86150, stream);
if (result < 0) {
goto out_free;
if (result == 0) {
vQueueDelete(stream->queue);
stream->queue = NULL;
}
vQueueDelete(stream->queue);
stream->queue = NULL;
// disable max86150 leds
max86150_set_led_red_amplitude(0);
max86150_set_led_ir_amplitude(0);
max86150_sensor_active = false;
result = 0;
out_free:
hwlock_release(HWLOCK_I2C);
mutex_unlock(&max86150_mutex);
return result;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment