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());
44 eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64))
47 lcdfd = open("/dev/dbox/oled0", O_RDWR);
50 lcdfd = open("/dev/dbox/lcd0", O_RDWR);
54 eDebug("found OLED display!");
63 eDebug("couldn't open LCD - load lcd.o!");
67 ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
72 void eDBoxLCD::setInverted(unsigned char inv)
78 int eDBoxLCD::setLCDContrast(int contrast)
81 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
83 eDebug("[LCD] can't open /dev/dbox/fp0");
87 if(ioctl(lcdfd, LCD_IOCTL_SRV, &contrast))
89 eDebug("[LCD] can't set lcd contrast");
95 int eDBoxLCD::setLCDBrightness(int brightness)
98 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
100 eDebug("[LCD] can't open /dev/dbox/fp0");
104 if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness))
106 eDebug("[LCD] can't set lcd brightness");
112 eDBoxLCD::~eDBoxLCD()
121 eDBoxLCD *eDBoxLCD::getInstance()
126 void eDBoxLCD::update()
130 unsigned char raw[132*8];
134 for (x=0; x<132; x++)
137 for (yy=0; yy<8; yy++)
139 pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
141 raw[y*132+x]=(pix^inverted);
145 write(lcdfd, raw, 132*8);
148 unsigned char raw[64*64];
150 memset(raw, 0, 64*64);
153 for (x=0; x<128 / 2; x++)
154 raw[y*64+x] = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
157 write(lcdfd, raw, 64*64);