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))
48 lcdfd = open("/dev/dbox/oled0", O_RDWR);
51 lcdfd = open("/dev/dbox/lcd0", O_RDWR);
55 eDebug("found OLED display!");
64 eDebug("couldn't open LCD - load lcd.o!");
68 ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
73 void eDBoxLCD::setInverted(unsigned char inv)
79 int eDBoxLCD::setLCDContrast(int contrast)
82 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
84 eDebug("[LCD] can't open /dev/dbox/fp0");
88 if(ioctl(lcdfd, LCD_IOCTL_SRV, &contrast))
90 eDebug("[LCD] can't set lcd contrast");
96 int eDBoxLCD::setLCDBrightness(int brightness)
99 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
101 eDebug("[LCD] can't open /dev/dbox/fp0");
105 if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness))
107 eDebug("[LCD] can't set lcd brightness");
113 eDBoxLCD::~eDBoxLCD()
122 eDBoxLCD *eDBoxLCD::getInstance()
127 void eDBoxLCD::update()
131 unsigned char raw[132*8];
135 for (x=0; x<132; x++)
138 for (yy=0; yy<8; yy++)
140 pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
142 raw[y*132+x]=(pix^inverted);
146 write(lcdfd, raw, 132*8);
149 unsigned char raw[64*64];
151 memset(raw, 0, 64*64);
154 for (x=0; x<128 / 2; x++)
155 raw[y*64+x] = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
158 write(lcdfd, raw, 64*64);