Allows users to seamlessly write to 2 or 3 uLCD screens as if they were one large screen.
Dependencies: 4DGL-uLCD-SE mbed-rtos mbed
ScreenUpdater.h@0:15002a72309b, 2015-03-11 (annotated)
- Committer:
- Mkuchnik3
- Date:
- Wed Mar 11 21:33:18 2015 +0000
- Revision:
- 0:15002a72309b
First Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mkuchnik3 | 0:15002a72309b | 1 | #ifndef SCREENUPDATER_H |
Mkuchnik3 | 0:15002a72309b | 2 | #define SCREENUPDATER_H |
Mkuchnik3 | 0:15002a72309b | 3 | #include <queue> |
Mkuchnik3 | 0:15002a72309b | 4 | #include "rtos.h" |
Mkuchnik3 | 0:15002a72309b | 5 | #include "uLCD_4DGL.h" |
Mkuchnik3 | 0:15002a72309b | 6 | #include "Command.h" |
Mkuchnik3 | 0:15002a72309b | 7 | /** |
Mkuchnik3 | 0:15002a72309b | 8 | * Attaches a thread to a physical screen and makes it operate on all input instructions. |
Mkuchnik3 | 0:15002a72309b | 9 | */ |
Mkuchnik3 | 0:15002a72309b | 10 | class ScreenUpdater { |
Mkuchnik3 | 0:15002a72309b | 11 | private: |
Mkuchnik3 | 0:15002a72309b | 12 | uLCD_4DGL *uLCD; |
Mkuchnik3 | 0:15002a72309b | 13 | Thread *uLCD_thread; |
Mkuchnik3 | 0:15002a72309b | 14 | std::queue<Command*> commands; |
Mkuchnik3 | 0:15002a72309b | 15 | Mutex commands_mutex; |
Mkuchnik3 | 0:15002a72309b | 16 | public: |
Mkuchnik3 | 0:15002a72309b | 17 | /** |
Mkuchnik3 | 0:15002a72309b | 18 | * Attaches an LCD to the updater. |
Mkuchnik3 | 0:15002a72309b | 19 | */ |
Mkuchnik3 | 0:15002a72309b | 20 | ScreenUpdater(uLCD_4DGL *uLCD); |
Mkuchnik3 | 0:15002a72309b | 21 | /** |
Mkuchnik3 | 0:15002a72309b | 22 | * Add a command to the queue. |
Mkuchnik3 | 0:15002a72309b | 23 | */ |
Mkuchnik3 | 0:15002a72309b | 24 | void addCommand(Command *_command); |
Mkuchnik3 | 0:15002a72309b | 25 | /** |
Mkuchnik3 | 0:15002a72309b | 26 | * Destructor. |
Mkuchnik3 | 0:15002a72309b | 27 | */ |
Mkuchnik3 | 0:15002a72309b | 28 | ~ScreenUpdater(); |
Mkuchnik3 | 0:15002a72309b | 29 | }; |
Mkuchnik3 | 0:15002a72309b | 30 | typedef struct uLCD_Thread_Args { |
Mkuchnik3 | 0:15002a72309b | 31 | uLCD_4DGL* uLCD; |
Mkuchnik3 | 0:15002a72309b | 32 | std::queue<Command*>* commands; |
Mkuchnik3 | 0:15002a72309b | 33 | Mutex* commands_mutex; |
Mkuchnik3 | 0:15002a72309b | 34 | } uLCD_Thread_Args; |
Mkuchnik3 | 0:15002a72309b | 35 | #endif |