nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Go to the documentation of this file. 26 static uint8_t
const nleds_;
92 virtual void off (
void)
96 virtual void on (
void)
144 virtual void enable_ ()
147 virtual void disable_ ()
151 inline led_type& lookup (
unsigned int i)
165 template <
bool active_low = true>
180 bool exists (
void)
const override 185 void enable_ (
void)
override 190 void disable_ (
void)
override 195 void off (
void)
override 204 void on (
void)
override 216 bool is_on (
void)
const override 236 static constexpr uint8_t FLAG_LOOP = 0x01;
237 static constexpr uint8_t FLAG_ACTIVE = 0x02;
244 static constexpr
unsigned int MIN_INTERVAL_utt = 8U;
249 alarm_{alarm_callback,
this}
265 notify_complete_ = notify;
278 return (FLAG_LOOP & flags_) ? -1 : initial_reps_;
308 return FLAG_ACTIVE & flags_;
315 return FLAG_LOOP & flags_;
345 int start (
int delay_utt = -1);
358 void complete_ (
bool notify);
365 unsigned int pattern_ = 0;
366 unsigned int interval_ = 0;
374 uint8_t initial_reps_ = 0;
int reps() const
Return the configured number of repetitions.
Definition: led.hpp:276
unsigned int deadline() const
Return the deadline of the underlying alarm.
Definition: led.hpp:322
virtual void clear()
Set the pin to drive the output low.
Definition: gpio.hpp:460
Class that supports background LED toggles in a repeating pattern.
Definition: led.hpp:234
static size_t count(void)
Get the number of LEDs supported by the target board.
Definition: led.hpp:122
virtual bool is_on(void) const
Read the LED.
Definition: led.hpp:116
unsigned int pattern() const
Return the currently configured pattern.
Definition: led.hpp:256
void disable(void)
Disable the nrf5::GPIO associated with the LED.
Definition: led.hpp:70
Class supporting a generic GPIO pin interface.
Definition: gpio.hpp:439
virtual void on(void)
Turn the LED on.
Definition: led.hpp:96
Core clock-related functionality.
int configure(unsigned int pattern, unsigned int interval_utt, int reps=-1)
Configure the pattern.
virtual bool exists(void) const
Indicate whether the referenced LED exists.
Definition: led.hpp:53
constexpr uint32_t PIN_CNF_WRONLY
GPIO pin configuration for output only.
Definition: gpio.hpp:31
active_signal< false > active_low
Alias type used for CSn, RESETn, and other active low output signals.
Definition: gpio.hpp:669
virtual bool is_set() const
Return true iff the pin is valid and is configured to drive the output high.
Definition: gpio.hpp:500
void enable(void)
Set the GPIO associated with the LED to enable the LED.
Definition: led.hpp:61
generic_led(gpio::generic_pin &pin)
Create an LED instance that is bound to a generic GPIO pin.
Definition: led.hpp:173
Pattern(led_type &led)
Construct referencing a specific LED.
Definition: led.hpp:247
void cancel()
Cancel an active pattern.
virtual void off(void)
Turn the LED off.
Definition: led.hpp:92
void set(int v)
Set the LED to a specific state.
Definition: led.hpp:80
virtual void toggle(void)
Toggle the LED state.
Definition: led.hpp:104
int set_deadline(unsigned int deadline)
Set the deadline of the underlying alarm.
led_type & led
Provide access to the LED controlled by the pattern.
Definition: led.hpp:253
static led_type & lookup(unsigned int i)
Return a reference to an LED identified by ordinal position.
Definition: led.hpp:133
Primary header for nrfcxx implementation dependencies.
std::function< void()> notifier_type
Type used to hold a notifier.
Definition: core.hpp:514
virtual void set()
Set the pin to drive the output high.
Definition: gpio.hpp:456
bool loops() const
Indicates whether the pattern is configured to loop until cancel() is invoked.
Definition: led.hpp:313
Class supporting an alarm with custom callback and repeatability.
Definition: clock.hpp:498
int start(int delay_utt=-1)
Enable led and start the pattern.
constexpr uint32_t PIN_CNF_PWRUP
GPIO pin configuration at power-up.
Definition: gpio.hpp:54
unsigned int deadline() const
The value of (the low 32 bits of) uptime::now() at which the alarm should fire.
Definition: clock.hpp:767
void set_notify_complete(notifier_type notify)
Provide an event setter used to tell the application when the pattern has completed.
Definition: led.hpp:263
Base class supporting LEDs of different types.
Definition: led.hpp:22
unsigned int interval_utt() const
Return the interval between bits of the pattern.
Definition: led.hpp:282
Primary namespace for nrfcxx functionality.
Definition: clock.hpp:17
bool active() const
Indicates whether the pattern is currently running.
Definition: led.hpp:306
A class used to manage LEDs.
Definition: led.hpp:166
virtual void configure(unsigned int pin_cnf)
Set the PIN_CNF entry for the pin if the reference is valid.
Definition: gpio.hpp:480