|
1 /* |
|
2 * GraphLCD driver library |
|
3 * |
|
4 * common.c - various functions |
|
5 * |
|
6 * parts were taken from graphlcd plugin for the Video Disc Recorder |
|
7 * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> |
|
8 * |
|
9 * This file is released under the GNU General Public License. Refer |
|
10 * to the COPYING file distributed with this package. |
|
11 * |
|
12 * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> |
|
13 */ |
|
14 |
|
15 #ifndef _GLCDDRIVERS_COMMON_H_ |
|
16 #define _GLCDDRIVERS_COMMON_H_ |
|
17 |
|
18 #include <string> |
|
19 |
|
20 namespace GLCD |
|
21 { |
|
22 |
|
23 const unsigned char bitmask[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; |
|
24 const unsigned char bitmaskl[8] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; |
|
25 const unsigned char bitmaskr[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01}; |
|
26 |
|
27 // functions to enable/disable very short sleeps. |
|
28 // Therefore, the priority will be changed. => use with care ! |
|
29 int nSleepInit(void); |
|
30 int nSleepDeInit(void); |
|
31 |
|
32 void nSleep(long ns); |
|
33 void uSleep(long us); |
|
34 |
|
35 unsigned char ReverseBits(unsigned char value); |
|
36 void clip(int & value, int min, int max); |
|
37 void sort(int & value1, int & value2); |
|
38 std::string trim(const std::string & s); |
|
39 |
|
40 } // end of namespace |
|
41 |
|
42 #endif |