Display text on LCD displays (even on multiple ones). Allow to create windows (frames) on display, and to combine them (split, add, duplicate, scroll). See http://mbed.org/users/hlipka/notebook/lcdwindow/ for more information.
semaphore.h@9:2fe93daa2106, 2011-02-22 (annotated)
- Committer:
- hlipka
- Date:
- Tue Feb 22 22:57:44 2011 +0000
- Revision:
- 9:2fe93daa2106
- Parent:
- 3:e5d5e2fe4bf6
fixed semaphore handling - should now be really thread safe (can be called from interrupts)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hlipka | 3:e5d5e2fe4bf6 | 1 | /** |
hlipka | 3:e5d5e2fe4bf6 | 2 | * code from Igor Skochinsky |
hlipka | 3:e5d5e2fe4bf6 | 3 | * taken from http://mbed.org/forum/mbed/post/799/ |
hlipka | 3:e5d5e2fe4bf6 | 4 | */ |
hlipka | 3:e5d5e2fe4bf6 | 5 | |
hlipka | 3:e5d5e2fe4bf6 | 6 | #ifndef SEMAPHORE_H_ |
hlipka | 3:e5d5e2fe4bf6 | 7 | #define SEMAPHORE_H_ |
hlipka | 3:e5d5e2fe4bf6 | 8 | |
hlipka | 3:e5d5e2fe4bf6 | 9 | class Semaphore |
hlipka | 3:e5d5e2fe4bf6 | 10 | { |
hlipka | 3:e5d5e2fe4bf6 | 11 | public: |
hlipka | 3:e5d5e2fe4bf6 | 12 | // constructor |
hlipka | 3:e5d5e2fe4bf6 | 13 | Semaphore(); |
hlipka | 3:e5d5e2fe4bf6 | 14 | |
hlipka | 3:e5d5e2fe4bf6 | 15 | // try to take the semaphore and return success |
hlipka | 3:e5d5e2fe4bf6 | 16 | // by default block until succeeded |
hlipka | 3:e5d5e2fe4bf6 | 17 | bool take(bool block = true); |
hlipka | 3:e5d5e2fe4bf6 | 18 | // release the semaphore |
hlipka | 3:e5d5e2fe4bf6 | 19 | void release(); |
hlipka | 3:e5d5e2fe4bf6 | 20 | |
hlipka | 9:2fe93daa2106 | 21 | static void setAbort(bool abort){_abort=abort;}; |
hlipka | 9:2fe93daa2106 | 22 | |
hlipka | 3:e5d5e2fe4bf6 | 23 | private: |
hlipka | 3:e5d5e2fe4bf6 | 24 | enum { SemFree, SemTaken }; |
hlipka | 3:e5d5e2fe4bf6 | 25 | // semaphore value |
hlipka | 3:e5d5e2fe4bf6 | 26 | int s; |
hlipka | 9:2fe93daa2106 | 27 | static bool _abort; |
hlipka | 3:e5d5e2fe4bf6 | 28 | |
hlipka | 3:e5d5e2fe4bf6 | 29 | }; |
hlipka | 3:e5d5e2fe4bf6 | 30 | |
hlipka | 3:e5d5e2fe4bf6 | 31 | #endif |