Add startup mode

Signed-off-by: Mickael Gaillard <mick.gaillard@gmail.com>
This commit is contained in:
Mickael Gaillard 2020-05-05 22:16:36 +02:00
parent 93ac75a5aa
commit 18a0552aa8

View File

@ -67,6 +67,10 @@
#define USE_APDS9960_PROXIMITY // Enable Proximity feature (>50 code) #define USE_APDS9960_PROXIMITY // Enable Proximity feature (>50 code)
#define USE_APDS9960_COLOR // Enable Color feature (+0.8k code) #define USE_APDS9960_COLOR // Enable Color feature (+0.8k code)
#define APDS9960_MODE_GESTURE 0
#define APDS9960_MODE_COLOR 1
#define USE_APDS9960_STARTMODE APDS9960_MODE_GESTURE
/* Gesture parameters */ /* Gesture parameters */
#define GESTURE_THRESHOLD_OUT 10 #define GESTURE_THRESHOLD_OUT 10
@ -355,7 +359,7 @@ volatile uint8_t recovery_loop_counter = 0; // count number of stateloops to sw
bool APDS9960_overload = false; bool APDS9960_overload = false;
uint8_t APDS9960_aTime = DEFAULT_ATIME; uint8_t APDS9960_aTime = DEFAULT_ATIME;
uint8_t APDS9960_type = 0; uint8_t APDS9960_type = 0;
uint8_t gesture_mode = 1; uint8_t gesture_mode = 1; // 1 : Gesture | 2 : Color
/******************************************************************************\ /******************************************************************************\
* Helper functions * Helper functions
@ -1836,9 +1840,17 @@ void APDS9960_detect(void) {
I2cSetActiveFound(APDS9960_I2C_ADDR, APDS9960_TAG); I2cSetActiveFound(APDS9960_I2C_ADDR, APDS9960_TAG);
enableProximitySensor(); enableProximitySensor();
#ifdef USE_APDS9960_GESTURE
#if defined(USE_APDS9960_GESTURE) && USE_APDS9960_STARTMODE == APDS9960_MODE_GESTURE
gesture_mode = 1;
enableGestureSensor(); enableGestureSensor();
#endif // USE_APDS9960_GESTURE #endif // USE_APDS9960_GESTURE
#if ( defined(USE_APDS9960_COLOR) || defined(USE_APDS9960_PROXIMITY) ) && USE_APDS9960_STARTMODE == APDS9960_MODE_COLOR
gesture_mode = 0;
enableLightSensor();
APDS9960_overload = false;
#endif // USE_APDS9960_GESTURE
} else { } else {
APDS9960_type = 0; APDS9960_type = 0;
} }