RC5 Demo
|
Main Application class that aggregates all other components. More...
#include <application.h>
Public Member Functions | |
Application (Logger *logger, TimerManager *timerManager, InputPin *samplePin, ExternalInterrupt *extInterrupt) | |
void | init (void) |
void | deinit (void) |
void | run (void) |
virtual void | onTelegram (const RC5Telegram &telegram) override |
Private Member Functions | |
void | print (const RC5Telegram &telegram) |
Private Attributes | |
Logger * | m_logger |
Reference to Logger instance. More... | |
RC5Receiver | m_receiver |
Instance of RC5Receiver component. More... | |
SynchronizedRingBuffer< RC5Telegram, 3 > | m_inputQueue |
Input queue to decouple ISR context from main context. More... | |
bool | m_inputOverflow |
Overflow flag indicating telgram loss in ISR context. More... | |
Main Application class that aggregates all other components.
This class contains the application specific logic and handles the received RC5 telegrams by writing their content to the Logger. It has an internal buffer for a small number of telegrams. Its main purpose is to decouple the interrupt context from the main context:
|
inline |
The constructor stores the passed dependencies inside the member variables.
[in] | logger | Logger instance to use |
[in] | timerManager | TimerManager instance to use |
[in] | samplePin | SamplePin instance passed to the RC5Receiver |
[in] | extInterrupt | ExternalInterrupt instance passed to the RC5Receiver |
|
inline |
Deinitializes the application and its sub components.
|
inline |
Initializes the application and its sub components.
|
inlineoverridevirtual |
Telegram handler that stores the passed telegram inside the input queue. In case the queue is full the overflow flag is set.
[in] | telegram | Telegram to handle |
Implements RC5Receiver::TelegramHandler.
|
inlineprivate |
Prints the content of a RC5 telegram using the logger.
[in] | telegram | Telegram to print |
|
inline |
Method to be called from main context to perform lengthy operations. Here the telegrams are dequeued from the input queue and print using the logger. Input queue overflows are also logged.
|
private |
Overflow flag indicating telgram loss in ISR context.
|
private |
Input queue to decouple ISR context from main context.
|
private |
Instance of RC5Receiver component.