Allow user to connect multiple screen.

Dependencies:   mbed-rtos mbed

Committer:
Ratchapong
Date:
Wed Mar 11 05:00:37 2015 +0000
Revision:
0:052d0f82433e
Working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ratchapong 0:052d0f82433e 1 #ifndef SCREENUPDATER_H
Ratchapong 0:052d0f82433e 2 #define SCREENUPDATER_H
Ratchapong 0:052d0f82433e 3 #include <queue>
Ratchapong 0:052d0f82433e 4 #include "rtos.h"
Ratchapong 0:052d0f82433e 5 #include "uLCD_4DGL.h"
Ratchapong 0:052d0f82433e 6 #include "Command.h"
Ratchapong 0:052d0f82433e 7 /**
Ratchapong 0:052d0f82433e 8 * Attaches a thread to a physical screen and makes it operate on all input instructions.
Ratchapong 0:052d0f82433e 9 */
Ratchapong 0:052d0f82433e 10 class ScreenUpdater {
Ratchapong 0:052d0f82433e 11 private:
Ratchapong 0:052d0f82433e 12 uLCD_4DGL *uLCD;
Ratchapong 0:052d0f82433e 13 Thread *uLCD_thread;
Ratchapong 0:052d0f82433e 14 std::queue<Command*> commands;
Ratchapong 0:052d0f82433e 15 Mutex commands_mutex;
Ratchapong 0:052d0f82433e 16 public:
Ratchapong 0:052d0f82433e 17 /**
Ratchapong 0:052d0f82433e 18 * Attaches an LCD to the updater.
Ratchapong 0:052d0f82433e 19 */
Ratchapong 0:052d0f82433e 20 ScreenUpdater(uLCD_4DGL *uLCD);
Ratchapong 0:052d0f82433e 21 /**
Ratchapong 0:052d0f82433e 22 * Add a command to the queue.
Ratchapong 0:052d0f82433e 23 */
Ratchapong 0:052d0f82433e 24 void addCommand(Command *_command);
Ratchapong 0:052d0f82433e 25 /**
Ratchapong 0:052d0f82433e 26 * Destructor.
Ratchapong 0:052d0f82433e 27 */
Ratchapong 0:052d0f82433e 28 ~ScreenUpdater();
Ratchapong 0:052d0f82433e 29 };
Ratchapong 0:052d0f82433e 30 typedef struct uLCD_Thread_Args {
Ratchapong 0:052d0f82433e 31 uLCD_4DGL* uLCD;
Ratchapong 0:052d0f82433e 32 std::queue<Command*>* commands;
Ratchapong 0:052d0f82433e 33 Mutex* commands_mutex;
Ratchapong 0:052d0f82433e 34 } uLCD_Thread_Args;
Ratchapong 0:052d0f82433e 35 #endif