REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
leds.h
Go to the documentation of this file.
1#pragma once
2#include <chips/SR74HCT595.h>
3#include <cstdint>
4#include <lucidac/leds.h>
5#include <utils/error.h>
6
7namespace platform {
8
9class TeensyLEDs : public LEDs {
10public:
11 TeensyLEDs();
12
14 bool set(const uint8_t led, bool on) override;
16 void set_all(const uint8_t states) override;
18 void reset() override;
19
21 uint8_t get_all() const override;
22
23 utils::status write_to_hardware() const override;
24
25private:
26 const functions::SR74HCT595 led_register;
27 const functions::TriggerFunction led_register_store;
28 const functions::TriggerFunction led_register_reset;
29
30 uint8_t led_states = 0;
31
32 static constexpr uint8_t LED_REGISTER_IDX = 4;
33 static constexpr uint8_t LED_REGISTER_STORE_IDX = 5;
34 static constexpr uint8_t LED_REGISTER_RESET_IDX = 6;
35};
36} // namespace platform
The SR74HCT595 is an 8-Bit Shift Register with 3-State Output Registers.
Definition SR74HCT595.h:15
A trigger function exploits the fact that setting an address on the bus triggers an action (TODO: Is ...
Definition functions.h:33
uint8_t get_all() const override
Returns the current state of the front leds.
Definition leds.cpp:28
void reset() override
Disables all eight front leds.
Definition leds.cpp:23
bool set(const uint8_t led, bool on) override
Sets specified front led to the specified value.
Definition leds.cpp:9
void set_all(const uint8_t states) override
Sets all eight front leds at once.
Definition leds.cpp:21
utils::status write_to_hardware() const override
Definition leds.cpp:30
Definition leds.h:7