diff options
| author | BEAST <macbook@Macbooks-MacBook-Pro-2.local> | 2026-11-17 09:40:39 +0530 |
|---|---|---|
| committer | BEAST <macbook@Macbooks-MacBook-Pro-2.local> | 2026-11-17 09:40:39 +0530 |
| commit | d358423b15bbd89ca8b34bb4ffc787811774105a (patch) | |
| tree | 5fa7233c0d5752d59e95c8070e28cd7d09b3170c /lib/HexaLED | |
Add local files and custom README
Diffstat (limited to 'lib/HexaLED')
| -rw-r--r-- | lib/HexaLED/build-manifest.json | 72 | ||||
| -rw-r--r-- | lib/HexaLED/lib/xtensa-esp32s3/libHexaLED_static.a | bin | 0 -> 12552 bytes | |||
| -rw-r--r-- | lib/HexaLED/library.json | 15 | ||||
| -rw-r--r-- | lib/HexaLED/library.properties | 9 | ||||
| -rw-r--r-- | lib/HexaLED/src/HexaLED.h | 70 |
5 files changed, 166 insertions, 0 deletions
diff --git a/lib/HexaLED/build-manifest.json b/lib/HexaLED/build-manifest.json new file mode 100644 index 0000000..5ca9e3b --- /dev/null +++ b/lib/HexaLED/build-manifest.json @@ -0,0 +1,72 @@ +{ + "source_lib": "lib\\HexaLED", + "sdk_version": "1.4.1", + "built_from_commit": "036661d7fa9340e198bf3f6d376121ae8c214f59", + "built_at": "2026-10-10T14:37:40.848498Z", + "harvested_from_project": "RobotFirmware", + "harvested_env": "robot", + "cxx_path": "C:\\Users\\thein\\.platformio\\packages\\toolchain-xtensa-esp32s3\\bin\\xtensa-esp32s3-elf-g++.exe", + "cxx_flags": [ + "-std=gnu++17", + "-fexceptions", + "-fno-rtti", + "-Os", + "-mlongcalls", + "-ffunction-sections", + "-fdata-sections", + "-Wno-error=unused-function", + "-Wno-error=unused-variable", + "-Wno-error=deprecated-declarations", + "-Wno-unused-parameter", + "-Wno-sign-compare", + "-ggdb", + "-freorder-blocks", + "-Wwrite-strings", + "-fstack-protector", + "-fstrict-volatile-bitfields", + "-Wno-error=unused-but-set-variable", + "-fno-jump-tables", + "-fno-tree-switch-conversion", + "-MMD", + "-g0", + "-fno-rtti", + "-fno-exceptions", + "-fno-asynchronous-unwind-tables" + ], + "defines": [ + "PLATFORMIO=60200", + "ARDUINO_ESP32S3_DEV", + "ARDUINO_USB_MODE=1", + "ARDUINO_RUNNING_CORE=1", + "ARDUINO_EVENT_RUNNING_CORE=1", + "CONFIG_FREERTOS_HZ=1000", + "CORE_DEBUG_LEVEL=3", + "ARDUINO_USB_MODE=1", + "ARDUINO_USB_CDC_ON_BOOT=1", + "HAVE_CONFIG_H", + "MBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"", + "UNITY_INCLUDE_CONFIG_H", + "WITH_POSIX", + "_GNU_SOURCE", + "IDF_VER=\"v4.4.7-dirty\"", + "ESP_PLATFORM", + "_POSIX_READER_WRITER_LOCKS", + "ARDUINO_ARCH_ESP32", + "ESP32", + "F_CPU=240000000L", + "ARDUINO=10812", + "ARDUINO_VARIANT=\"esp32s3\"", + "ARDUINO_BOARD=\"Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)\"", + "ARDUINO_PARTITION_partitions" + ], + "hardening": { + "extra_cxx_flags": [ + "-g0", + "-fno-rtti", + "-fno-exceptions", + "-fno-asynchronous-unwind-tables" + ], + "symbols_stripped": true, + "strings_encrypted": true + } +}
\ No newline at end of file diff --git a/lib/HexaLED/lib/xtensa-esp32s3/libHexaLED_static.a b/lib/HexaLED/lib/xtensa-esp32s3/libHexaLED_static.a Binary files differnew file mode 100644 index 0000000..1ddfd77 --- /dev/null +++ b/lib/HexaLED/lib/xtensa-esp32s3/libHexaLED_static.a diff --git a/lib/HexaLED/library.json b/lib/HexaLED/library.json new file mode 100644 index 0000000..14f2eab --- /dev/null +++ b/lib/HexaLED/library.json @@ -0,0 +1,15 @@ +{ + "name": "HexaLED", + "version": "1.0.0", + "description": "NeoPixel status and user LED driver for HEXA COMMAND HUB", + "keywords": ["led", "neopixel", "ws2812b", "rgb", "status", "esp32", "hexa"], + "authors": [ + { + "name": "Rush", + "maintainer": true + } + ], + "license": "MIT", + "platforms": "espressif32", + "frameworks": "arduino" +} diff --git a/lib/HexaLED/library.properties b/lib/HexaLED/library.properties new file mode 100644 index 0000000..b43aa73 --- /dev/null +++ b/lib/HexaLED/library.properties @@ -0,0 +1,9 @@ +name=HexaLED +version=1.0.0 +author=Rush +maintainer=Rush +sentence=NeoPixel status and user LED driver for HEXA COMMAND HUB +paragraph=Drives WS2812B NeoPixels with solid, blink, and pulse patterns. Supports standalone and shared-strip modes for chained pixels. Framework status LED and student-controlled user LED on the same data line. +category=Display +url= +architectures=esp32 diff --git a/lib/HexaLED/src/HexaLED.h b/lib/HexaLED/src/HexaLED.h new file mode 100644 index 0000000..67714a9 --- /dev/null +++ b/lib/HexaLED/src/HexaLED.h @@ -0,0 +1,70 @@ +#pragma once +#include <Adafruit_NeoPixel.h> + +// ============================================================ +// HexaLED — NeoPixel status/user indicator for NRL +// ============================================================ +// +// Two usage modes: +// +// 1. Standalone — HexaLED owns its own strip (controller ctrlLed): +// HexaLED ctrlLed(38, 1); +// +// 2. Shared — HexaLED controls one pixel inside an external strip +// (robot botLed + userLed share the same GPIO 38 data line): +// Adafruit_NeoPixel nrlLedStrip(2, 38, NEO_GRB + NEO_KHZ800); +// HexaLED botLed(nrlLedStrip, 0); // pixel 0 — framework status +// HexaLED userLed(nrlLedStrip, 1); // pixel 1 — student use +// +// Call begin() once, then tick(millis()) every loop iteration. +// Call the stateXxx() / setSolid() / setBlink() / setPulse() methods +// to change the LED; tick() handles all animation without blocking. + +class HexaLED { +public: + // Standalone mode — owns a dedicated strip + HexaLED(uint8_t pin, uint8_t count = 1); + + // Shared mode — controls one pixel inside an externally-owned strip + HexaLED(Adafruit_NeoPixel& strip, uint8_t pixelIndex); + + void begin(); + void tick(uint32_t nowMs); + + // ── Color / pattern methods (student-facing API) ────────── + void setOff(); + void setSolid(uint8_t r, uint8_t g, uint8_t b); + void setBlink(uint8_t r, uint8_t g, uint8_t b, uint16_t periodMs = 500); + void setPulse(uint8_t r, uint8_t g, uint8_t b, uint16_t periodMs = 1000); + + // ── Named NRL framework states (framework use only) ─────── + void stateUnpaired(); + void statePairing(); + void stateReconnecting(); + void stateIdle(); + void stateInit(); + void stateRunningTeleop(); + void stateRunningAuto(); + void stateLoopOverrun(); + +private: + enum class Pattern : uint8_t { SOLID, BLINK, PULSE }; + + void _set(uint8_t r, uint8_t g, uint8_t b, Pattern p, uint16_t periodMs); + void _write(uint8_t r, uint8_t g, uint8_t b); + + Adafruit_NeoPixel _ownStrip; // used in standalone mode + Adafruit_NeoPixel* _strip; // points to _ownStrip (standalone) or external (shared) + uint8_t _pixelIndex; // which pixel in the strip this instance controls + uint8_t _count; // number of pixels controlled (always 1 in shared mode) + + uint8_t _r, _g, _b; + Pattern _pattern; + uint16_t _period; + uint32_t _phaseStart; + bool _on; + + // Last time _write() actually pushed bytes to the strip. SOLID uses this to + // periodically re-assert its colour — see tick(). + uint32_t _lastWriteMs = 0; +}; |
