![]() |
RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
|
A very simple standard LED, driven by a single GPIO pin. More...
#include <LED.h>
Public Member Functions | |
| LED (unsigned int pinNumber) | |
| Builds an LED on the given GPIO pin and sets that pin to output mode. More... | |
| virtual | ~LED () |
| Destroys the LED. More... | |
| virtual void | TurnOn () override |
| Turns the LED on (drives its pin high). More... | |
| virtual void | TurnOff () override |
| Turns the LED off (drives its pin low). More... | |
| virtual void | ProcessRawValues () override |
| Processes the LED's raw values. More... | |
| virtual std::string | ToString () const override |
| Serializes the LED's state (its pin number) to a string. More... | |
| unsigned int | GetPinNumber () const |
| Gets the GPIO pin the LED is driven on. More... | |
Public Member Functions inherited from RumPi::BaseComponent | |
| BaseComponent () | |
| Builds a base component with an unknown type and an empty name. More... | |
| virtual | ~BaseComponent () |
| Virtual destructor so deleting a component through a BaseComponent* also cleans up the concrete subclass. More... | |
| virtual void | TurnOn ()=0 |
| Turns the component on (e.g. More... | |
| virtual void | TurnOff ()=0 |
| Turns the component off. More... | |
| virtual std::string | ToString () const =0 |
| Serializes the component's current readings to a string (usually JSON). More... | |
| virtual void | ProcessRawValues ()=0 |
| Reads and processes the component's latest raw values (called once per poll). More... | |
| virtual EComponentType | GetComponentType () const |
| Gets the component's type. More... | |
| const std::string & | GetName () const |
| Gets the component's unique per-instance name. More... | |
| void | SetName (const std::string &name) |
| Sets the component's unique per-instance name. More... | |
Private Attributes | |
| unsigned int | myPinNumber |
| The BCM GPIO pin this LED is driven on. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from RumPi::BaseComponent | |
| static std::string | ComponentTypeToString (const EComponentType theComponentTypeToConvert) |
| Maps an EComponentType to its string name. More... | |
| static EComponentType | StringToComponentType (const std::string &theComponentTypeName) |
| Maps a type name back to its EComponentType (the inverse of ComponentTypeToString), so the client can turn the type carried on the wire back into a value it can look an icon up with. More... | |
Protected Attributes inherited from RumPi::BaseComponent | |
| EComponentType | myComponentType |
| The kind of component this is (set by each concrete subclass). More... | |
| std::string | myName |
| A unique per-instance name, assigned when the component is added to the manager. More... | |
A very simple standard LED, driven by a single GPIO pin.
| RumPi::LED::LED | ( | unsigned int | pinNumber | ) |
Builds an LED on the given GPIO pin and sets that pin to output mode.
| [in] | pinNumber | The BCM GPIO pin to drive the LED on. |
|
virtual |
| unsigned int RumPi::LED::GetPinNumber | ( | ) | const |
|
overridevirtual |
Processes the LED's raw values.
The LED is output-only, so there is nothing to read each cycle - this is a no-op.
Implements RumPi::BaseComponent.
|
overridevirtual |
Serializes the LED's state (its pin number) to a string.
Implements RumPi::BaseComponent.
|
overridevirtual |
Turns the LED off (drives its pin low).
Implements RumPi::BaseComponent.
|
overridevirtual |
Turns the LED on (drives its pin high).
Implements RumPi::BaseComponent.
|
private |
The BCM GPIO pin this LED is driven on.