use sparkfun lib for sensors adafruit has issues

This commit is contained in:
2021-07-28 08:19:40 +02:00
parent 3d740c9387
commit 2873d56b58
16 changed files with 626 additions and 577 deletions

View File

@@ -6,16 +6,45 @@ uint8_t g_previous_mode_button_state = 1;
uint32_t g_last_debounce_time = 0;
uint32_t g_debounce_delay = 50;
Button buttonCenter(BUTTON_CENTER);
Button buttonLeft(BUTTON_LEFT);
Button buttonRight(BUTTON_RIGHT);
void initButtons(void)
{
Serial.print("initButtons:");
buttonCenter.begin();
buttonLeft.begin();
buttonRight.begin();
pinMode(MODE_BUTTON_PIN, INPUT_PULLUP); // Pin for switching screens button
Serial.println(" OK");
}
void handleButtons(void)
{
g_previous_mode_button_state = g_current_mode_button_state;
//handle buttons
buttonCenter.read();
buttonLeft.read();
buttonRight.read();
if (buttonCenter.wasPressed())
{
backlightRefresh();
}
if (buttonLeft.wasPressed())
{
previousSensor();
backlightRefresh();
}
if (buttonRight.wasPressed())
{
nextSensor();
backlightRefresh();
}
g_current_mode_button_state = digitalRead(MODE_BUTTON_PIN);
// Check if button is now pressed and it was previously unpressed