Commit ef21ef02 authored by schneider's avatar schneider
Browse files

fix(max86150): Turn off sensor at boot

parent ee655973
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "pb.h" #include "pb.h"
#include "pmic.h" #include "pmic.h"
#include "portexpander.h" #include "portexpander.h"
#include "max86150.h"
#include "gpio.h" #include "gpio.h"
#include "i2c.h" #include "i2c.h"
...@@ -191,6 +192,8 @@ int hardware_early_init(void) ...@@ -191,6 +192,8 @@ int hardware_early_init(void)
*/ */
max86150_mutex_init(); max86150_mutex_init();
max86150_shut_down();
/* Allow user space to trigger interrupts. /* Allow user space to trigger interrupts.
* Used for BLE, not sure if needed. */ * Used for BLE, not sure if needed. */
SCB->CCR |= SCB_CCR_USERSETMPEND_Msk; SCB->CCR |= SCB_CCR_USERSETMPEND_Msk;
......
...@@ -106,23 +106,16 @@ int epic_max86150_disable_sensor(void) ...@@ -106,23 +106,16 @@ int epic_max86150_disable_sensor(void)
mutex_lock(&max86150_mutex); mutex_lock(&max86150_mutex);
hwlock_acquire(HWLOCK_I2C); hwlock_acquire(HWLOCK_I2C);
max86150_shut_down();
max86150_sensor_active = false;
struct stream_info *stream = &max86150_stream; struct stream_info *stream = &max86150_stream;
result = stream_deregister(SD_MAX86150, stream); result = stream_deregister(SD_MAX86150, stream);
if (result < 0) { if (result == 0) {
goto out_free; 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); hwlock_release(HWLOCK_I2C);
mutex_unlock(&max86150_mutex); mutex_unlock(&max86150_mutex);
return result; 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