DIY Auto-Correlator 1.0
Auto-Correlator Card implementation using Teensy 4.x microcontrollers.
|
#include <ledset.hpp>
Public Types | |
enum | ledstate_t { OFF = 0 , ON = 1 , Analog = 2 } |
Public Member Functions | |
LEDSet (std::initializer_list< unsigned int > pins) | |
Constructor for LEDSet class. More... | |
unsigned int | size () __attribute__((always_inline)) |
Returns the size of the led sets. More... | |
void | init () |
Sets up the pin mode of all LEDs. More... | |
void | state_reload () |
Sets the LEDs based on the value of the corresponding state variable. This function is useful when the state is altered seperately from the digitalWrite calls. The function also calls pinMode() which muxes the pins to gpio. For State == Analog: The state maintains the analog dim state. More... | |
void | ON_todigital () |
Sets all leds with states (ON == 1) and (Analog == 2) to (ON == 1). More... | |
void | toggle_all () |
Toggles the state of all the LEDs. This is a pure digital function and destroys all Analog dim states. More... | |
void | toggle_twice (int pin, double time_ms) |
Toggles the state of a particular LED. This is a pure digital function and destroys all Analog dim states. More... | |
void | toggle_all_routine (int delay_ms) |
void | dim (int pin, unsigned int analog_val) |
dims a particular valid led pin. More... | |
void | dim_all (unsigned int analog_val) |
Dims the ON-LEDs with the provided analog voltage. Only affects LEDs that are ON or on Analog Mode. More... | |
void | dim_all_routine (unsigned int end_analog_val, double time_s) |
void | max_bright_all () |
Sets maximum brightness for all ON-LEDs. More... | |
void | min_bright_all () |
void | set_all () __attribute__((always_inline)) |
Turn on all available LEDs. More... | |
void | unset_all () __attribute__((always_inline)) |
void | set (int led_pin) __attribute__((always_inline)) |
Turn-ON a particular LED Pin. More... | |
void | unset (int led_pin) __attribute__((always_inline)) |
Turn-OFF a particular LED Pin. More... | |
void | set (int led_pin1, int led_pin2) __attribute__((always_inline)) |
Turn-ON two LED Pins simultaneously. The function only works if both the Pins are valid pins. More... | |
void | unset (int led_pin1, int led_pin2) __attribute__((always_inline)) |
Turn-OFF two LED Pins simultaneously. More... | |
void | set (int led_pin1, int led_pin2, int led_pin3) __attribute__((always_inline)) |
Turn-ON three LED Pins simultaneously. More... | |
void | unset (int led_pin1, int led_pin2, int led_pin3) __attribute__((always_inline)) |
Turn-FF three LED Pins simultaneously. More... | |
void | error (int pin) |
Special function that sets a valid pin and sets the flag LedSet::Error_State to true. This function also clears all LED states prior to the Error State but does not modify states set after the error state. More... | |
void | assert_errors () |
Special function that initiates a special routine if the device is in the Error State. It also calls abort() , if that feature macro is enabled. More... | |
bool | is_valid_pin (int pin) |
Returns whether the given pin is a "valid pin". A valid pin is a pin that is registered with the LEDSet. More... | |
Public Attributes | |
const int | LEDs [SET_SIZE] = {SAFE_OUTPUT_DUMP_PIN} |
LED pins. More... | |
unsigned int | State [SET_SIZE] |
ON-OFF/Analog states for all LEDs. More... | |
bool | Error_State = false |
Whether the LED Panel is in an error state. More... | |
Private Member Functions | |
int | fetch_index (int pin) __attribute__((always_inline)) |
Retrive data structure index based on the pin number. Returns -1 if the pin was not found. More... | |
@Provides an interface for accessing the LEDs on the dashboar. The object serves primarily as a bookeeping object, and hence, enables state conservation and switching, and automatically manages dimming, and complex routines.
enum LEDSet::ledstate_t |
|
inline |
Constructor for LEDSet class.
pins | - list of LED pins. |
|
inline |
Special function that initiates a special routine if the device is in the Error State. It also calls abort()
, if that feature macro is enabled.
|
inline |
dims a particular valid led pin.
|
inline |
Dims the ON-LEDs with the provided analog voltage. Only affects LEDs that are ON or on Analog Mode.
|
inline |
|
inline |
Special function that sets a valid pin and sets the flag LedSet::Error_State
to true. This function also clears all LED states prior to the Error State but does not modify states set after the error state.
|
inlineprivate |
Retrive data structure index based on the pin number. Returns -1 if the pin was not found.
|
inline |
Sets up the pin mode of all LEDs.
|
inline |
Returns whether the given pin is a "valid pin". A valid pin is a pin that is registered with the LEDSet.
|
inline |
Sets maximum brightness for all ON-LEDs.
|
inline |
Sets the minimum brighness for all ON-LEDs.
|
inline |
Sets all leds with states (ON == 1) and (Analog == 2) to (ON == 1).
|
inline |
Turn-ON a particular LED Pin.
|
inline |
Turn-ON two LED Pins simultaneously. The function only works if both the Pins are valid pins.
|
inline |
Turn-ON three LED Pins simultaneously.
|
inline |
Turn on all available LEDs.
|
inline |
Returns the size of the led sets.
|
inline |
Sets the LEDs based on the value of the corresponding state variable. This function is useful when the state is altered seperately from the digitalWrite calls. The function also calls pinMode() which muxes the pins to gpio. For State == Analog: The state maintains the analog dim state.
|
inline |
Toggles the state of all the LEDs. This is a pure digital function and destroys all Analog dim states.
|
inline |
|
inline |
Toggles the state of a particular LED. This is a pure digital function and destroys all Analog dim states.
|
inline |
Turn-OFF a particular LED Pin.
|
inline |
Turn-OFF two LED Pins simultaneously.
|
inline |
Turn-FF three LED Pins simultaneously.
|
inline |
Turn off all available LEDs.
bool LEDSet< SET_SIZE >::Error_State = false |
Whether the LED Panel is in an error state.
const int LEDSet< SET_SIZE >::LEDs[SET_SIZE] = {SAFE_OUTPUT_DUMP_PIN} |
LED pins.
unsigned int LEDSet< SET_SIZE >::State[SET_SIZE] |
ON-OFF/Analog states for all LEDs.