source: titan/titan/oled.h @ 38490

Last change on this file since 38490 was 36824, checked in by gost, 8 years ago

[titan] DM7020hd delete code

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#ifndef OLED_H_
2#define OLED_H_
3
4void write2oled(unsigned char *buf, int xres, int yres)
5{
6        unsigned char* lfb1 = NULL;
7        unsigned char* lfb2 = NULL;
8        int i = 0;
9        int bi = 0;
10        int ret = 0;
11       
12        lfb1 = malloc(xres * yres);
13        if(lfb1 == NULL)
14                return;
15               
16        for(i = 0; i <= xres*yres; i++)
17        {
18                //             R                           B                          G
19                lfb1[i] = ((76 * buf[bi+2]) / 255) + ((150 * buf[bi+1]) / 255) + ((28 * buf[bi]) / 255);
20                bi = bi + 4;
21        }
22       
23        int lcdfd1 = open(getconfig("vfddev", NULL), O_RDWR);
24       
25        if(checkchipset("BCM7424") == 1)
26        {
27                ret = write(lcdfd1, lfb1, xres * yres);
28                if(ret != xres * yres)
29                        err("write to oled - %s - was not ok", getconfig("vfddev", NULL));
30        }
31        //Die Displays der dm7020hd, dm7025+(?), dm7080 und dm8000 haben 128*64*4bpp, DM800se hat 96*64*16bpp (RGB565), dm800 und dm7025(?) haben 132*64*1bpp (ältere ggf. 120*64 oder 128*64)
32        else if(checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1)
33        {
34                unsigned char byte;
35                bi = 0;
36                lfb2 = malloc(xres * yres / 2);
37                if(lfb2 == NULL)
38                        return;
39                for(i = 0; i <= xres*yres; i = i + 2)
40                {
41                        byte = lfb1[i] * 15 / 255;
42                        lfb2[bi] = (byte << 4) & 0xf0;
43                        byte = lfb1[i+1] * 15 / 255;
44                        lfb2[bi] |= byte & 0x0f;
45                        bi = bi + 1;
46                }
47                ret = write(lcdfd1, lfb2, xres * yres / 2);
48                if(ret != xres * yres / 2)
49                        err("write to oled - %s - was not ok", getconfig("vfddev", NULL));
50                free(lfb2);
51        }
52               
53        close(lcdfd1);
54       
55        free(lfb1);
56        return;
57}
58
59int oledtext(char *value)
60{
61        struct skin* OLED_all = NULL;
62       
63        if(getconfigint("oled_off", NULL) == 1)
64                return 0;
65
66        m_lock(&status.drawingmutex, 0);
67       
68        if(checkchipset("BCM7424") == 1)
69        {
70                if(status.updatevfd == PAUSE)
71                        OLED_all = getscreen("OLED_nemesis_menu");
72                else if(status.standby > 0)
73                        OLED_all = getscreen("OLED_nemesis_standby");
74                else
75                {
76                        if(getskinconfig("OLED_nemesis", NULL) == NULL)
77                                OLED_all = getscreen("OLED_nemesis");
78                        else
79                                OLED_all = getscreen(getskinconfig("OLED_nemesis", NULL));
80                }
81        }
82        else if(checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1)
83        {
84                if(status.updatevfd == PAUSE)
85                        OLED_all = getscreen("OLED_dream1_menu");
86                else if(status.standby > 0)
87                        OLED_all = getscreen("OLED_dream1_standby");
88                else
89                {
90                        if(getskinconfig("OLED_dream1", NULL) == NULL)
91                                OLED_all = getscreen("OLED_dream1");
92                        else
93                                OLED_all = getscreen(getskinconfig("OLED_dream1", NULL));
94                }
95        }       
96               
97       
98        struct skin* textbox = getscreennode(OLED_all, "textbox");
99       
100        if(status.standby == 2 && status.epgscanlistthread != NULL)
101                changetext(textbox, "EPG-Scan");
102        else
103                changetext(textbox, value);
104
105        drawscreen(OLED_all, 0, 2);
106        m_unlock(&status.drawingmutex, 0);
107       
108        return 0;
109}
110
111struct fb* oledaddfb(int width, int height)
112{
113        struct fb *newnode = NULL;
114        char *name = ostrcat("oledskinfb", NULL, 0, 0);
115        newnode = (struct fb*)malloc(sizeof(struct fb));
116               
117        unsigned char *newskinfb = calloc(1, 4 * width * height);
118        if(newskinfb == NULL)
119                return NULL;
120        memset(newnode, 0, sizeof(struct fb));
121        newnode->name = name;
122        newnode->dev = 999;
123        newnode->width = width;
124        newnode->height = height;
125        newnode->colbytes = 4;
126        newnode->pitch = newnode->width * newnode->colbytes;
127        newnode->fb = newskinfb;
128        newnode->fblong = (unsigned long*)newnode->fb;
129        newnode->fd = -1;
130        newnode->fixfbsize = 4 * width * height;
131        newnode->data_phys = 0;
132       
133        return newnode;
134}
135
136void initOLEDdream1()
137{
138#ifndef LCD_IOCTL_ASC_MODE
139#define LCDSET                  0x1000
140#define LCD_IOCTL_ASC_MODE              (21|LCDSET)
141#define LCD_MODE_ASC                    0
142#define LCD_MODE_BIN                    1
143#endif
144
145return; //wird nicht benötigt
146
147        int i=LCD_MODE_BIN;
148        //int lcdfd = open("/dev/dbox/oled0", O_RDWR);
149        int lcdfd1 = open(getconfig("vfddev", NULL), O_RDWR);
150        if(lcdfd1 > -1)
151        {
152                ioctl(lcdfd1, LCD_IOCTL_ASC_MODE, &i);
153                close(lcdfd1);
154        }
155}       
156
157#endif 
158       
Note: See TracBrowser for help on using the repository browser.