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)
20 _buffer=new unsigned char[res.height()*res.width()];
21 memset(_buffer, 0, res.height()*res.width());
41 read( lcdfd, NULL, 0);
45 lcdfd=open("/dev/dbox/lcd0", O_RDWR); // reopen device
48 eDebug("do not reopen lcd.. errno = %d", errno);
53 eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64))
56 lcdfd = open("/dev/dbox/oled0", O_RDWR);
59 lcdfd = open("/dev/dbox/lcd0", O_RDWR);
63 eDebug("found OLED display!");
72 eDebug("couldn't open LCD - load lcd.o!");
76 ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
81 void eDBoxLCD::setInverted(unsigned char inv)
87 int eDBoxLCD::setLCDContrast(int contrast)
90 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
92 eDebug("[LCD] can't open /dev/dbox/fp0");
96 if(ioctl(lcdfd, LCD_IOCTL_SRV, &contrast))
98 eDebug("[LCD] can't set lcd contrast");
104 int eDBoxLCD::setLCDBrightness(int brightness)
107 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
109 eDebug("[LCD] can't open /dev/dbox/fp0");
113 if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness))
115 eDebug("[LCD] can't set lcd brightness");
121 eDBoxLCD::~eDBoxLCD()
130 eDBoxLCD *eDBoxLCD::getInstance()
135 void eDBoxLCD::update()
139 unsigned char raw[132*8];
143 for (x=0; x<132; x++)
146 for (yy=0; yy<8; yy++)
148 pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
150 raw[y*132+x]=(pix^inverted);
154 write(lcdfd, raw, 132*8);
157 unsigned char raw[64*64];
159 memset(raw, 0, 64*64);
162 for (x=0; x<128 / 2; x++)
163 raw[y*64+x] = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
166 write(lcdfd, raw, 64*64);