0cf2156a4371b002a2cf4432254c54a26644e4ab
[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 #define LED_IOCTL_SET_DEFAULT 0X13
19
20 class eLCD
21 {
22 #ifdef SWIG
23         eLCD();
24         ~eLCD();
25 #else
26 protected:
27         void setSize(int xres, int yres, int bpp);
28         eSize res;
29         unsigned char *_buffer;
30         int lcdfd;
31         int _stride;
32         int locked;
33 #endif
34 public:
35         int lock();
36         void unlock();
37         int islocked() { return locked; }
38         bool detected() { return lcdfd >= 0; }
39 #ifndef SWIG
40         eLCD();
41         virtual ~eLCD();
42         __u8 *buffer() { return (__u8*)_buffer; }
43         int stride() { return _stride; }
44         eSize size() { return res; }
45         virtual void update()=0;
46 #endif
47 };
48
49 class eDBoxLCD: public eLCD
50 {
51         static eDBoxLCD *instance;
52         unsigned char inverted;
53         int is_oled;
54 #ifdef SWIG
55         eDBoxLCD();
56         ~eDBoxLCD();
57 #endif
58 public:
59 #ifndef SWIG
60         eDBoxLCD();
61         ~eDBoxLCD();
62 #endif
63         static eDBoxLCD *getInstance();
64         void setLED(int value, int option);
65         void setLEDDefault(int normal, int deepstandby, int blinktime);
66         int setLCDContrast(int contrast);
67         int setLCDBrightness(int brightness);
68         void setInverted( unsigned char );
69         bool isOled() const { return !!is_oled; }
70         void update();
71 };
72
73 #endif