9b83352eb1fd90becd30345209fdef0c3c387c2a
[vuplus_dvbapp] / lib / gdi / lcd.h
1 #ifndef __lcd_h
2 #define __lcd_h
3
4 #include <asm/types.h>
5 #include <lib/gdi/esize.h>
6 #include <lib/gdi/erect.h>
7
8 #define LCD_CONTRAST_MIN 0
9 #define LCD_CONTRAST_MAX 63
10 #define LCD_BRIGHTNESS_MIN 0
11 #define LCD_BRIGHTNESS_MAX 255
12
13 enum op { LED_BRIGHTNESS = 0, LED_DEEPSTANDBY, LED_BLINKINGTIME };
14
15 #define LED_IOCTL_BRIGHTNESS_NORMAL 0X10
16 #define LED_IOCTL_BRIGHTNESS_DEEPSTANDBY 0X11
17 #define LED_IOCTL_BLINKING_TIME 0X12
18
19 class eLCD
20 {
21 #ifdef SWIG
22         eLCD();
23         ~eLCD();
24 #else
25 protected:
26         void setSize(int xres, int yres, int bpp);
27         eSize res;
28         unsigned char *_buffer;
29         int lcdfd;
30         int _stride;
31         int locked;
32 #endif
33 public:
34         int lock();
35         void unlock();
36         int islocked() { return locked; }
37         bool detected() { return lcdfd >= 0; }
38 #ifndef SWIG
39         eLCD();
40         virtual ~eLCD();
41         __u8 *buffer() { return (__u8*)_buffer; }
42         int stride() { return _stride; }
43         eSize size() { return res; }
44         virtual void update()=0;
45 #endif
46 };
47
48 class eDBoxLCD: public eLCD
49 {
50         static eDBoxLCD *instance;
51         unsigned char inverted;
52         int is_oled;
53 #ifdef SWIG
54         eDBoxLCD();
55         ~eDBoxLCD();
56 #endif
57 public:
58 #ifndef SWIG
59         eDBoxLCD();
60         ~eDBoxLCD();
61 #endif
62         static eDBoxLCD *getInstance();
63         int setLED(int value, int option);
64         int setLCDContrast(int contrast);
65         int setLCDBrightness(int brightness);
66         void setInverted( unsigned char );
67         bool isOled() const { return !!is_oled; }
68         void update();
69 };
70
71 #endif