SPI for FastLED
This commit is contained in:
parent
185bf91a7a
commit
91f8ba0e4d
|
@ -1,6 +1,9 @@
|
||||||
#ifdef BOARD_OBP60S3
|
#ifdef BOARD_OBP60S3
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#define FASTLED_ALL_PINS_HARDWARE_SPI
|
||||||
|
#define FASTLED_ESP32_SPI_BUS HSPI
|
||||||
|
#define FASTLED_ESP32_FLASH_LOCK 1
|
||||||
#include <FastLED.h> // Driver for WS2812 RGB LED
|
#include <FastLED.h> // Driver for WS2812 RGB LED
|
||||||
#include <PCF8574.h> // Driver for PCF8574 output modul from Horter
|
#include <PCF8574.h> // Driver for PCF8574 output modul from Horter
|
||||||
#include <Wire.h> // I2C
|
#include <Wire.h> // I2C
|
||||||
|
@ -110,15 +113,22 @@ CHSV colorMapping(String colorString){
|
||||||
|
|
||||||
// All defined colors see pixeltypes.h in FastLED lib
|
// All defined colors see pixeltypes.h in FastLED lib
|
||||||
void setBacklightLED(uint brightness, CHSV color){
|
void setBacklightLED(uint brightness, CHSV color){
|
||||||
FastLED.setBrightness(255); // Brightness for flash LED
|
static uint oldbrightness;
|
||||||
color.value = brightness;
|
static CHSV oldcolor;
|
||||||
backlight[0] = color; // Backlight LEDs on with color
|
// If changed the values then set new values
|
||||||
backlight[1] = color;
|
if(brightness != oldbrightness || color != oldcolor){
|
||||||
backlight[2] = color;
|
FastLED.setBrightness(255); // Brightness for flash LED
|
||||||
backlight[3] = color;
|
color.value = brightness;
|
||||||
backlight[4] = color;
|
backlight[0] = color; // Backlight LEDs on with color
|
||||||
backlight[5] = color;
|
backlight[1] = color;
|
||||||
FastLED.show();
|
backlight[2] = color;
|
||||||
|
backlight[3] = color;
|
||||||
|
backlight[4] = color;
|
||||||
|
backlight[5] = color;
|
||||||
|
FastLED.show();
|
||||||
|
oldbrightness = brightness;
|
||||||
|
oldcolor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleBacklightLED(uint brightness, CHSV color){
|
void toggleBacklightLED(uint brightness, CHSV color){
|
||||||
|
@ -145,9 +155,9 @@ void toggleBacklightLED(uint brightness, CHSV color){
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFlashLED(bool status){
|
void setFlashLED(bool status){
|
||||||
statusLED = status;
|
static bool oldstatus;
|
||||||
FastLED.setBrightness(255); // Brightness for flash LED
|
FastLED.setBrightness(255); // Brightness for flash LED
|
||||||
if(statusLED == true){
|
if(status == true){
|
||||||
fled[0] = CRGB::Red; // Flash LED on in red
|
fled[0] = CRGB::Red; // Flash LED on in red
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "OBP60Hardware.h"
|
#include "OBP60Hardware.h"
|
||||||
|
#define FASTLED_ALL_PINS_HARDWARE_SPI
|
||||||
|
#define FASTLED_ESP32_SPI_BUS HSPI
|
||||||
|
#define FASTLED_ESP32_FLASH_LOCK 1
|
||||||
#include <FastLED.h> // Driver for WS2812 RGB LED
|
#include <FastLED.h> // Driver for WS2812 RGB LED
|
||||||
#include <GxEPD2_BW.h> // E-paper lib V2
|
#include <GxEPD2_BW.h> // E-paper lib V2
|
||||||
|
|
||||||
|
|
|
@ -262,8 +262,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
while(getdisplay().nextPage()); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
while(getdisplay().nextPage()); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -387,9 +387,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
while(getdisplay().nextPage()); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
while(getdisplay().nextPage()); // Partial update (fast)
|
|
||||||
while(getdisplay().nextPage()); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue