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()];
40 read( lcdfd, NULL, 0);
44 lcdfd=open("/dev/dbox/lcd0", O_RDWR); // reopen device
47 eDebug("do not reopen lcd.. errno = %d", errno);
52 eDBoxLCD::eDBoxLCD(): eLCD(eSize(128, 64))
55 lcdfd=open("/dev/dbox/lcd0", O_RDWR);
62 eDebug("couldn't open LCD - load lcd.o!");
66 ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
71 void eDBoxLCD::setInverted(unsigned char inv)
77 int eDBoxLCD::setLCDContrast(int contrast)
80 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
82 eDebug("[LCD] can't open /dev/dbox/fp0");
86 if(ioctl(lcdfd, LCD_IOCTL_SRV, &contrast))
88 eDebug("[LCD] can't set lcd contrast");
93 int eDBoxLCD::setLCDBrightness(int brightness)
96 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
98 eDebug("[LCD] can't open /dev/dbox/fp0");
102 if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness))
104 eDebug("[LCD] can't set lcd brightness");
109 eDBoxLCD::~eDBoxLCD()
118 eDBoxLCD *eDBoxLCD::getInstance()
123 void eDBoxLCD::update()
125 unsigned char raw[120*8];
129 for (x=0; x<120; x++)
132 for (yy=0; yy<8; yy++)
134 pix|=(_buffer[(y*8+yy)*128+x]>=108)<<yy;
136 raw[y*120+x]=(pix^inverted);
140 write(lcdfd, raw, 120*8);