|
32 | 32 | #define enable_http_keywords // keywords used for http but might be used more general |
33 | 33 | #define enable_dallastemp |
34 | 34 | //#define enable_m5atom_led // need to disable gfx_m5stack (and gfxsupport) for enable_m5atom_led! |
| 35 | +#define enable_m5atom_led_matrix |
35 | 36 |
|
36 | 37 | // Includes |
37 | 38 |
|
@@ -4614,27 +4615,41 @@ object *fn_gettempdevicescount(object *args, object *env) { |
4614 | 4615 |
|
4615 | 4616 | #include <Adafruit_NeoPixel.h> |
4616 | 4617 |
|
| 4618 | +#ifdef enable_m5atom_led_matrix |
| 4619 | +#define ATOM_NUM_LEDS 25 |
| 4620 | +#else |
4617 | 4621 | #define ATOM_NUM_LEDS 1 |
| 4622 | +#endif |
4618 | 4623 | #define ATOM_LED_DATA_PIN 27 |
4619 | 4624 |
|
4620 | 4625 | Adafruit_NeoPixel atom_leds(ATOM_NUM_LEDS, ATOM_LED_DATA_PIN, NEO_GRB); |
4621 | 4626 |
|
4622 | 4627 | void init_atomled () { |
4623 | 4628 | atom_leds.begin(); // INITIALIZE NeoPixel |
| 4629 | +#ifdef enable_m5atom_led_matrix |
| 4630 | + // prevent device from overheating, see M5 atom matrix docs |
| 4631 | + atom_leds.setBrightness(20); |
| 4632 | +#endif |
4624 | 4633 | atom_leds.clear(); |
4625 | 4634 | // atom_leds.setPixelColor(0, atom_leds.Color(150, 150, 0)); |
4626 | 4635 | atom_leds.show(); |
4627 | 4636 | } |
4628 | 4637 |
|
4629 | | -void atomled(uint32_t color) { |
4630 | | - atom_leds.setPixelColor(0, color); |
| 4638 | +void atomled(uint32_t color, uint16_t index) { |
| 4639 | + atom_leds.setPixelColor(index, color); |
4631 | 4640 | atom_leds.show(); |
4632 | 4641 | } |
4633 | 4642 |
|
4634 | 4643 | object *fn_atomled(object *args, object *env) { |
4635 | 4644 | uint32_t color = 0xff0000; |
4636 | | - if (args != NULL) color = checkinteger(ATOMLED, first(args)); |
4637 | | - atomled(color); |
| 4645 | + uint16_t index = 0; |
| 4646 | + if (args != NULL) { |
| 4647 | + color = checkinteger(ATOMLED, first(args)); |
| 4648 | + if (cdr(args) != NULL) { |
| 4649 | + index = checkinteger(ATOMLED, second(args)); |
| 4650 | + } |
| 4651 | + } |
| 4652 | + atomled(color, index); |
4638 | 4653 | return nil; |
4639 | 4654 | } |
4640 | 4655 |
|
@@ -5187,7 +5202,7 @@ const tbl_entry_t lookup_table[] PROGMEM = { |
5187 | 5202 | { user46625f7d60ca8651d4a2b9150c7d, fn_gettempdevicescount, 0x00 }, |
5188 | 5203 | #endif # enable_dallastemp |
5189 | 5204 | #if defined(enable_m5atom_led) |
5190 | | - { user160acae49c44508fee79466e2136, fn_atomled, 0x01 }, |
| 5205 | + { user160acae49c44508fee79466e2136, fn_atomled, 0x02 }, |
5191 | 5206 | #endif # enable_m5atom_led |
5192 | 5207 | { user48fb449eec8a7ce84c164201c1b6, fn_reboot, 0x00 }, |
5193 | 5208 | // functions of m-g-r/ulisp-esp-m5stack - end |
|
0 commit comments