RTLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Led Class Reference

HAL implementation for LEDs. More...

#include <led.h>

Classes

struct  Config
 Configuration for LED. More...
 

Public Member Functions

 Led (const Config &config)
 Default constructor for LED. More...
 
 ~Led ()=default
 Default trivial destructor. More...
 
 Led (Led &&other) noexcept=default
 Move constructor for LED. More...
 
Ledoperator= (Led &&other) noexcept=default
 Move assignment operator for LED. More...
 
 Led (const Led &)=delete
 Copy constructor for LED. More...
 
Ledoperator= (const Led &)=delete
 Copy assignment operator for LED. More...
 
void SetEnable (bool flag)
 Sets the state of the LED. More...
 
void Switch ()
 Toggles the state of the LED, i.e. On -> Off, vice versa. More...
 

Protected Member Functions

CORE_NS::GPIO * GetGpio ()
 

Detailed Description

HAL implementation for LEDs.

This abstraction layer provides standard state-setting and toggling features for onboard LEDs. One LED object is designed to manage one LED on the mainboard.

Constructor & Destructor Documentation

Led::Led ( const Config config)
explicit

Default constructor for LED.

Parameters
configLED configuration

Here is the call graph for this function:

Led::~Led ( )
default

Default trivial destructor.

Led::Led ( Led &&  other)
defaultnoexcept

Move constructor for LED.

Parameters
otherLED object to move from
Led::Led ( const Led )
delete

Copy constructor for LED.

This constructor is deleted because there should only be one object managing each LED, similar to std::unique_ptr.

Member Function Documentation

CORE_NS::GPIO* Led::GetGpio ( )
inlineprotected
Returns
GPIO object which manages the pin of the button
Led& Led::operator= ( Led &&  other)
defaultnoexcept

Move assignment operator for LED.

Parameters
otherLED object to move from
Returns
Reference to the moved LED.
Led& Led::operator= ( const Led )
delete

Copy assignment operator for LED.

This constructor is deleted because there should only be one object managing each LED, similar to std::unique_ptr.

void Led::SetEnable ( bool  flag)

Sets the state of the LED.

Note
LED will always be in off state after constructor is called. If it isn't, your board may have a pull-up resistor; Set Led::Config::polarity to another value if that is the case.
Parameters
flagTrue if the LED should be on

Here is the caller graph for this function:

void Led::Switch ( )

Toggles the state of the LED, i.e. On -> Off, vice versa.


The documentation for this class was generated from the following files: