1 #include <lib/gdi/lcd.h>
8 #include <dbox/lcd-ks0713.h>
10 #include <lib/gdi/esize.h>
11 #include <lib/base/init.h>
12 #include <lib/base/init_num.h>
13 #include <lib/gdi/glcddc.h>
15 eDBoxLCD *eDBoxLCD::instance;
17 eLCD::eLCD(eSize size): res(size)
21 _buffer=new unsigned char[res.height()*res.width()];
22 memset(_buffer, 0, res.height()*res.width());
45 eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64))
49 lcdfd = open("/dev/dbox/oled0", O_RDWR);
52 FILE *f=fopen("/proc/stb/fp/oled_brightness", "w");
58 lcdfd = open("/dev/dbox/lcd0", O_RDWR);
61 eDebug("found OLED display!");
70 eDebug("couldn't open LCD - load lcd.o!");
74 ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
79 void eDBoxLCD::setInverted(unsigned char inv)
85 int eDBoxLCD::setLCDContrast(int contrast)
88 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
90 eDebug("[LCD] can't open /dev/dbox/fp0");
94 if(ioctl(lcdfd, LCD_IOCTL_SRV, &contrast))
96 eDebug("[LCD] can't set lcd contrast");
102 int eDBoxLCD::setLCDBrightness(int brightness)
104 eDebug("setLCDBrightness %d", brightness);
105 FILE *f=fopen("/proc/stb/fp/oled_brightness", "w");
108 if (fprintf(f, "%d", brightness) == 0)
109 eDebug("write /proc/stb/fp/oled_brightness failed!! (%m)");
115 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
117 eDebug("[LCD] can't open /dev/dbox/fp0");
121 if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness)<=0)
122 eDebug("[LCD] can't set lcd brightness (%m)");
128 eDBoxLCD::~eDBoxLCD()
137 eDBoxLCD *eDBoxLCD::getInstance()
142 void eDBoxLCD::update()
144 if (!is_oled || is_oled == 2)
146 unsigned char raw[132*8];
150 for (x=0; x<132; x++)
153 for (yy=0; yy<8; yy++)
155 pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
157 raw[y*132+x]=(pix^inverted);
161 write(lcdfd, raw, 132*8);
164 unsigned char raw[64*64];
166 memset(raw, 0, 64*64);
170 for (x=0; x<128 / 2; x++)
172 pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
179 write(lcdfd, raw, 64*64);