Merge pull request #8357 from Theosakamg/default_mode

APDS-9960 - Add default startup mode
This commit is contained in:
Theo Arends 2020-05-06 10:34:02 +02:00 committed by GitHub
commit 4abf498041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

View File

@ -67,6 +67,10 @@
#define USE_APDS9960_PROXIMITY // Enable Proximity feature (>50 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 */
#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;
uint8_t APDS9960_aTime = DEFAULT_ATIME;
uint8_t APDS9960_type = 0;
uint8_t gesture_mode = 1;
uint8_t gesture_mode = 1; // 1 : Gesture | 2 : Color
/******************************************************************************\
* Helper functions
@ -1836,9 +1840,17 @@ void APDS9960_detect(void) {
I2cSetActiveFound(APDS9960_I2C_ADDR, APDS9960_TAG);
enableProximitySensor();
#ifdef USE_APDS9960_GESTURE
#if defined(USE_APDS9960_GESTURE) && USE_APDS9960_STARTMODE == APDS9960_MODE_GESTURE
gesture_mode = 1;
enableGestureSensor();
#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 {
APDS9960_type = 0;
}