Base class supporting LEDs of different types.
More...
#include <nrfcxx/led.hpp>
|
| led_type (const led_type &)=delete |
|
led_type & | operator= (const led_type &)=delete |
|
| led_type (const led_type &&)=delete |
|
led_type & | operator= (led_type &&)=delete |
|
virtual bool | exists (void) const |
| Indicate whether the referenced LED exists. More...
|
|
void | enable (void) |
| Set the GPIO associated with the LED to enable the LED. More...
|
|
void | disable (void) |
| Disable the nrf5::GPIO associated with the LED. More...
|
|
void | set (int v) |
| Set the LED to a specific state. More...
|
|
virtual void | off (void) |
| Turn the LED off.
|
|
virtual void | on (void) |
| Turn the LED on.
|
|
virtual void | toggle (void) |
| Toggle the LED state. More...
|
|
virtual bool | is_on (void) const |
| Read the LED. More...
|
|
|
static size_t | count (void) |
| Get the number of LEDs supported by the target board.
|
|
static led_type & | lookup (unsigned int i) |
| Return a reference to an LED identified by ordinal position. More...
|
|
|
virtual void | enable_ () |
|
virtual void | disable_ () |
|
Base class supporting LEDs of different types.
◆ disable()
void nrfcxx::led::led_type::disable |
( |
void |
| ) |
|
|
inline |
Disable the nrf5::GPIO associated with the LED.
You might want to do this for power reduction.
◆ enable()
void nrfcxx::led::led_type::enable |
( |
void |
| ) |
|
|
inline |
Set the GPIO associated with the LED to enable the LED.
The LED begins in the off state.
◆ exists()
virtual bool nrfcxx::led::led_type::exists |
( |
void |
| ) |
const |
|
inlinevirtual |
Indicate whether the referenced LED exists.
This should return false
only for the stub LED instance that is returned when an ordinal lookup requests an LED that is not supported by the target board.
The stub LED instance exists so the application doesn't have to have error handling code.
◆ is_on()
virtual bool nrfcxx::led::led_type::is_on |
( |
void |
| ) |
const |
|
inlinevirtual |
Read the LED.
- Returns
true
iff the LED is active.
◆ lookup()
static led_type& nrfcxx::led::led_type::lookup |
( |
unsigned int |
i | ) |
|
|
inlinestatic |
Return a reference to an LED identified by ordinal position.
- Parameters
-
i | the ordinal position of the desired LED |
- Returns
- a reference to an LED. If
i
specified an LED that does not exist on the target a no-effect mock LED is returned.
◆ set()
void nrfcxx::led::led_type::set |
( |
int |
v | ) |
|
|
inline |
Set the LED to a specific state.
- Parameters
-
v | If zero the LED is turned off; if positive the LED is turned on; if negative the LED changes state (off to on or on to off). |
◆ toggle()
virtual void nrfcxx::led::led_type::toggle |
( |
void |
| ) |
|
|
inlinevirtual |
Toggle the LED state.
- Note
- Subclasses need override this only if toggling can be performed more efficiently than by invoking is_on() and selecting between off() and on().
The documentation for this class was generated from the following file: