many updates..
new sensors.. display.. led.. drawing.. stuff..
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "../../data/Color.h"
|
||||
#include "../../Platforms.h"
|
||||
#include "../../Debug.h"
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +15,11 @@
|
||||
|
||||
template <int numLEDs> class WS2812B {
|
||||
|
||||
#define LED_SET_PIN_TO_OUTPUT GPIO5_OUTPUT_SET
|
||||
#define LED_SET_PIN_H GPIO5_H
|
||||
#define LED_SET_PIN_L GPIO5_L
|
||||
static constexpr const char* NAME = "WS2812B";
|
||||
|
||||
// #define LED_SET_PIN_TO_OUTPUT GPIO5_OUTPUT_SET
|
||||
// #define LED_SET_PIN_H GPIO5_H
|
||||
// #define LED_SET_PIN_L GPIO5_L
|
||||
|
||||
//#define NS_PER_TICK ( (1000ul*1000ul*1000ul) / (80ul*1000ul*1000ul) )
|
||||
|
||||
@@ -35,6 +38,7 @@
|
||||
|
||||
void init() {
|
||||
LED_SET_PIN_TO_OUTPUT;
|
||||
debugMod1(NAME, "init with %d leds", numLEDs);
|
||||
}
|
||||
|
||||
/** set the color for the given LED */
|
||||
@@ -78,7 +82,7 @@
|
||||
ets_intr_lock();
|
||||
|
||||
// process each LED
|
||||
for (uint8_t i = 0; i < numLEDs; ++i) {
|
||||
for (int i = 0; i < numLEDs; ++i) {
|
||||
|
||||
// send each LEDs 24-bit GRB data
|
||||
if (enabled[i]) {
|
||||
@@ -100,6 +104,36 @@
|
||||
|
||||
}
|
||||
|
||||
/** flush configured changes, including global brightness */
|
||||
void flushBrightness(const uint8_t brightness) {
|
||||
|
||||
LED_SET_PIN_TO_OUTPUT;
|
||||
|
||||
ets_intr_lock();
|
||||
|
||||
// process each LED
|
||||
for (int i = 0; i < numLEDs; ++i) {
|
||||
|
||||
// send each LEDs 24-bit GRB data
|
||||
if (enabled[i]) {
|
||||
const Color rgb = colors[i].brightness(brightness);
|
||||
sendByte(rgb.g);
|
||||
sendByte(rgb.r);
|
||||
sendByte(rgb.b);
|
||||
} else {
|
||||
sendByte(0);
|
||||
sendByte(0);
|
||||
sendByte(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ets_intr_unlock();
|
||||
|
||||
reset();
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
inline void sendByte(uint8_t b) {
|
||||
@@ -212,7 +246,7 @@
|
||||
|
||||
};
|
||||
|
||||
#elif ESP32aaa
|
||||
#elif false// ESP32aaa
|
||||
|
||||
//#include <driver/gpio.h>
|
||||
#include <rom/ets_sys.h>
|
||||
@@ -419,7 +453,7 @@
|
||||
|
||||
};
|
||||
|
||||
#elif ESP32
|
||||
#elif false //ESP32
|
||||
|
||||
#include <driver/gpio.h>
|
||||
#include <rom/ets_sys.h>
|
||||
@@ -612,7 +646,7 @@
|
||||
|
||||
};
|
||||
|
||||
#elif othertest
|
||||
#elif false //othertest
|
||||
|
||||
//#include <driver/gpio.h>
|
||||
#include <rom/ets_sys.h>
|
||||
|
||||
Reference in New Issue
Block a user