5#ifndef ELEC_C7222_DEVICES_SAFE_LED_HPP
6#define ELEC_C7222_DEVICES_SAFE_LED_HPP
9#include <condition_variable>
100 mutable std::mutex mutex_;
102 std::condition_variable cv_;
104 bool locked_ =
false;
Output-only GPIO wrapper intended for LEDs.
Definition led.hpp:39
Disable both copy and move operations.
Definition non_copyable.hpp:75
LedId
Logical LED identifiers mapped to GPIO pins.
Definition c7222_pico_w_board.hpp:52
LED wrapper that prevents simultaneous control from multiple threads.
Definition safe_led.hpp:44
bool AcquireFor(uint32_t timeout)
Acquire exclusive control with a timeout.
Definition safe_led.cpp:16
void Toggle()
Toggle the LED (requires Acquire()).
Definition safe_led.cpp:55
void On()
Turn the LED on (requires Acquire()).
Definition safe_led.cpp:45
SafeLed(PicoWBoard::LedId id)
Construct a SafeLed wrapper for a board LED by logical ID.
Definition safe_led.hpp:57
bool IsHeld() const
Return true if this object currently holds the lock.
Definition safe_led.cpp:35
void Set(bool on)
Set the LED state (requires Acquire()).
Definition safe_led.cpp:40
void Acquire()
Acquire exclusive control of the LED (blocks until available).
Definition safe_led.cpp:10
void Off()
Turn the LED off (requires Acquire()).
Definition safe_led.cpp:50
void Release()
Release exclusive control of the LED.
Definition safe_led.cpp:25
Output-only GPIO abstraction for LEDs.
C7222 course abstractions namespace.
Definition ble.hpp:20
Base classes to control copy/move semantics.