ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
led.hpp
Go to the documentation of this file.
1
5#ifndef ELEC_C7222_DEVICES_LED_H_
6#define ELEC_C7222_DEVICES_LED_H_
7
8#include <cstdint>
9
10#include "gpio.hpp"
11
12namespace c7222 {
13
39class Led : public GpioOut {
40 public:
49 explicit Led(uint32_t pin,
50 bool initial_on = false,
52 bool active_low = false);
53
59 void Configure(const Config& config) = delete;
60
71 void Reconfigure(bool initial_on = false,
73 bool active_low = false);
74
79 void Set(bool on);
80
84 void On();
85
89 void Off();
90
96 void Toggle();
97
98 private:
99 bool _active_low{false};
100};
101
102} // namespace c7222
103
104#endif // ELEC_C7222_DEVICES_LED_H_
GPIO output-only wrapper with output configuration and drive strength.
Definition gpio.hpp:245
Output-only GPIO wrapper intended for LEDs.
Definition led.hpp:39
void Off()
Turn the LED off.
void Set(bool on)
Set the LED state.
void Toggle()
Toggle the LED state.
void Configure(const Config &config)=delete
Disallow generic reconfiguration.
void Reconfigure(bool initial_on=false, GpioDriveStrength drive=GpioDriveStrength::mA4, bool active_low=false)
Reconfigure LED output settings.
Led(uint32_t pin, bool initial_on=false, GpioDriveStrength drive=GpioDriveStrength::mA4, bool active_low=false)
Construct an LED output pin.
void On()
Turn the LED on.
GPIO abstraction split into explicit input and output classes.
C7222 course abstractions namespace.
Definition ble.hpp:20
GpioDriveStrength
GPIO drive strength.
Definition gpio.hpp:83
Configuration structure for output GPIO setup.
Definition gpio.hpp:250