roo_blink
API Documentation for roo_blink
Loading...
Searching...
No Matches
led.h
Go to the documentation of this file.
1#pragma once
2
3#include "roo_time.h"
4#include "stdint.h"
5
6namespace roo_blink {
7
8/// Abstract interface representing a monochrome LED.
9class Led {
10 public:
11 /// Sets the LED brightness in the range 0 (off) to 65535 (max).
12 virtual void setLevel(uint16_t level) = 0;
13
14 /// Sets the LED to the maximum brightness.
15 void turnOn() { setLevel(65535); }
16
17 /// Turns the LED completely off.
18 void turnOff() { setLevel(0); }
19
20 /// Initiates a linear fade to the target level over the duration.
21 virtual bool fade(uint16_t target_level, roo_time::Duration duration) = 0;
22};
23
24} // namespace roo_blink