ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
c7222::OnBoardLED Class Reference

Simple on-board LED controller. More...

#include <onboard_led.hpp>

Inheritance diagram for c7222::OnBoardLED:
Inheritance graph
Collaboration diagram for c7222::OnBoardLED:
Collaboration graph

Public Member Functions

bool Initialize ()
 Initialize the on-board LED hardware.
 
void Set (bool on)
 Set the LED state.
 
void On ()
 Turn the LED on.
 
void Off ()
 Turn the LED off.
 
void Toggle ()
 Toggle the LED state.
 
 ~OnBoardLED ()=default
 Destructor.
 
- Public Member Functions inherited from c7222::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
- Public Member Functions inherited from c7222::NonMovable
 NonMovable (const NonMovable &)=default
 
NonMovableoperator= (const NonMovable &)=default
 
 NonMovable (NonMovable &&)=delete
 
NonMovableoperator= (NonMovable &&)=delete
 

Static Public Member Functions

static OnBoardLEDGetInstance ()
 Get the singleton instance.
 

Additional Inherited Members

- Protected Member Functions inherited from c7222::NonCopyableNonMovable
 NonCopyableNonMovable ()=default
 
 ~NonCopyableNonMovable ()=default
 
- Protected Member Functions inherited from c7222::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 
- Protected Member Functions inherited from c7222::NonMovable
 NonMovable ()=default
 
 ~NonMovable ()=default
 

Detailed Description

Simple on-board LED controller.

Design intent:

  • Singleton access: only one on-board LED exists, so a singleton is used.
  • Explicit initialization: call Initialize() once before using On(), Off(), or Toggle(). The Platform does not auto-initialize this device.

Example:

led->Initialize();
led->On();
static OnBoardLED * GetInstance()
Get the singleton instance.

Constructor & Destructor Documentation

◆ ~OnBoardLED()

c7222::OnBoardLED::~OnBoardLED ( )
default

Destructor.

Public to allow std::unique_ptr default deleter.

Member Function Documentation

◆ GetInstance()

static OnBoardLED * c7222::OnBoardLED::GetInstance ( )
static

Get the singleton instance.

Here is the caller graph for this function:

◆ Initialize()

bool c7222::OnBoardLED::Initialize ( )

Initialize the on-board LED hardware.

On Pico W, this may initialize the CYW43 subsystem if required. Returns true on success.

Here is the caller graph for this function:

◆ Off()

void c7222::OnBoardLED::Off ( )

Turn the LED off.

Here is the caller graph for this function:

◆ On()

void c7222::OnBoardLED::On ( )

Turn the LED on.

◆ Set()

void c7222::OnBoardLED::Set ( bool  on)

Set the LED state.

Parameters
ontrue to turn on, false to turn off.

◆ Toggle()

void c7222::OnBoardLED::Toggle ( )

Toggle the LED state.

Here is the caller graph for this function:

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