saur
Member level 2
- Joined
- Feb 23, 2012
- Messages
- 45
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,288
- Activity points
- 1,621
Code:
#define SDRAM_BASE_ADDR 0x28000000
static uint16_t *fb = (uint16_t *)SDRAM_BASE_ADDR;
void GLCD_DrawChar (unsigned int x, unsigned int y, unsigned int cw, unsigned int ch, unsigned char *c) {
unsigned int i, j, k, pixs;
k = (cw + 7)/8;
if (k == 1) {
for (j = 0; j < ch; j++) {
pixs = *(unsigned char *)c;
c += 1;
for (i = 0; i < cw; i++) {
#if (LANDSCAPE == 0)
fb[(y+j)*PHYS_XSZ + (x+i)] = Color[(pixs >> i) & 1];
#else
fb[(x+i)*PHYS_XSZ + (y+j)] = Color[(pixs >> i) & 1];
#endif
}
}
}
else if (k == 2) {
for (j = 0; j < ch; j++) {
pixs = *(unsigned short *)c;
c += 2;
for (i = 0; i < cw; i++) {
#if (LANDSCAPE == 0)
fb[(y+j)*PHYS_XSZ + (x+i)] = Color[(pixs >> i) & 1];
#else
fb[(x+i)*PHYS_XSZ + (y+j)] = Color[(pixs >> i) & 1];
#endif
}
}
}
}
In the above code the only problem I'm facing is that, fb has been defined as a pointer. Then what does the code
Code:
fb[(y+j)*PHYS_XSZ+(x+i)]
Here PHYS_XSZ has been defined as 240. I also understand what
Code:
Color[(pixs>>i)&1]
Just help mw with the fb part of the code.
Thanks