project
Ghost Hand
Public Unreviewedby John Lauer
A small battery gadget that keeps an automatic sink faucet running while you use the sink: it learns the faucet's timeout, re-arms with the shortest blip, and stops after 10 minutes or when picked up.
main
John Lauer
Rev 2: aim, status-dot lights, Adafruit 1317 battery, rev 2 cost, revisions, firmware
363a22f
1d ago
/*
* leds.h : WS2812B-2020-V6 chain (5 LEDs) and the light patterns
*/
#ifndef LEDS_H
#define LEDS_H
#include <stdint.h>
#include <stdbool.h>
typedef enum {
PAT_OFF = 0,
PAT_GAUGE, /* session start: gauge fills to the level over 3 s */
PAT_ARMED, /* status dot breathing soft cyan-white */
PAT_DONE, /* 10 min cap: slow warm fade */
PAT_LOW, /* low battery: red */
PAT_CHARGING, /* filled to the level, next segment pulses */
PAT_FULL, /* all four green 5 s, then a dim pulse every 10 s */
PAT_SHOW_CHARGE /* static level (2 s after unplugging) */
} led_pattern_t;
void leds_init(void);
void leds_pattern(led_pattern_t p, uint8_t percent, uint32_t now_ms);
void leds_flags(bool echoing, bool blip); /* modifiers for PAT_ARMED */
bool leds_frame(uint32_t now_ms); /* render + write if due; false if deferred (echo busy) */
void leds_off(void); /* rail off, data low */
led_pattern_t leds_current(void);
#endif