diff options
Diffstat (limited to 'firmware/target/coldfire/iaudio/m3')
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/lcd-m3.c | 66 |
1 files changed, 52 insertions, 14 deletions
diff --git a/firmware/target/coldfire/iaudio/m3/lcd-m3.c b/firmware/target/coldfire/iaudio/m3/lcd-m3.c index b1e81f91ba..ae72832a82 100644 --- a/firmware/target/coldfire/iaudio/m3/lcd-m3.c +++ b/firmware/target/coldfire/iaudio/m3/lcd-m3.c | |||
@@ -289,6 +289,35 @@ void lcd_write_data(const fb_data *p_words, int count) | |||
289 | CS_HI; | 289 | CS_HI; |
290 | } | 290 | } |
291 | 291 | ||
292 | static void lcd_mono_data(const unsigned char *p_words, int count) | ||
293 | { | ||
294 | unsigned data; | ||
295 | const unsigned char *p_bytes = p_words; | ||
296 | const unsigned char *p_end = p_words + count; | ||
297 | |||
298 | RS_HI; | ||
299 | CS_LO; | ||
300 | if (cpu_frequency < 50000000) | ||
301 | { | ||
302 | while (p_bytes < p_end) | ||
303 | { | ||
304 | data = *p_bytes++; | ||
305 | _write_fast(data); | ||
306 | _write_fast(data); | ||
307 | } | ||
308 | } | ||
309 | else | ||
310 | { | ||
311 | while (p_bytes < p_end) | ||
312 | { | ||
313 | data = *p_bytes++; | ||
314 | _write_byte(data); | ||
315 | _write_byte(data); | ||
316 | } | ||
317 | } | ||
318 | CS_HI; | ||
319 | } | ||
320 | |||
292 | int lcd_default_contrast(void) | 321 | int lcd_default_contrast(void) |
293 | { | 322 | { |
294 | return DEFAULT_CONTRAST_SETTING; | 323 | return DEFAULT_CONTRAST_SETTING; |
@@ -341,7 +370,7 @@ void lcd_on(void) | |||
341 | lcd_write_command_e(LCD_SET_GRAY | 6, 0xcc); | 370 | lcd_write_command_e(LCD_SET_GRAY | 6, 0xcc); |
342 | lcd_write_command_e(LCD_SET_GRAY | 7, 0x0c); | 371 | lcd_write_command_e(LCD_SET_GRAY | 7, 0x0c); |
343 | 372 | ||
344 | lcd_write_command(LCD_SET_PWM_FRC | 6); /* 4FRC + 12PWM */ | 373 | lcd_write_command(LCD_SET_PWM_FRC | 6); /* 3FRC + 12PWM */ |
345 | 374 | ||
346 | lcd_write_command(LCD_DISPLAY_ON | 1); /* display on */ | 375 | lcd_write_command(LCD_DISPLAY_ON | 1); /* display on */ |
347 | 376 | ||
@@ -428,24 +457,31 @@ void lcd_init_device(void) | |||
428 | #endif | 457 | #endif |
429 | } | 458 | } |
430 | 459 | ||
431 | /* TODO: implement blit functions */ | ||
432 | |||
433 | /* Performance function that works with an external buffer | 460 | /* Performance function that works with an external buffer |
434 | note that by and bheight are in 8-pixel units! */ | 461 | note that by and bheight are in 8-pixel units! */ |
435 | void lcd_blit(const fb_data *data, int x, int by, int width, | 462 | void lcd_blit_mono(const unsigned char *data, int x, int by, int width, |
436 | int bheight, int stride) | 463 | int bheight, int stride) |
437 | { | 464 | { |
438 | (void)data; | 465 | if (initialized) |
439 | (void)x; | 466 | { |
440 | (void)by; | 467 | /* COM48-COM63 are not connected, so we need to skip those */ |
441 | (void)width; | 468 | while (bheight--) |
442 | (void)bheight; | 469 | { |
443 | (void)stride; | 470 | lcd_write_command(LCD_SET_PAGE | ((by > 5 ? by + 2 : by) & 0xf)); |
471 | lcd_write_command_e(LCD_SET_COLUMN | ((x >> 4) & 0xf), x & 0xf); | ||
472 | |||
473 | lcd_mono_data(data, width); | ||
474 | data += stride; | ||
475 | by++; | ||
476 | } | ||
477 | } | ||
444 | } | 478 | } |
445 | 479 | ||
480 | /* TODO: implement grey blit function */ | ||
481 | |||
446 | /* Performance function that works with an external buffer | 482 | /* Performance function that works with an external buffer |
447 | note that by and bheight are in 8-pixel units! */ | 483 | note that by and bheight are in 8-pixel units! */ |
448 | void lcd_grey_phase_blit(unsigned char *values, unsigned char *phases, | 484 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, |
449 | int x, int by, int width, int bheight, int stride) | 485 | int x, int by, int width, int bheight, int stride) |
450 | { | 486 | { |
451 | (void)values; | 487 | (void)values; |
@@ -463,7 +499,8 @@ void lcd_update(void) ICODE_ATTR; | |||
463 | void lcd_update(void) | 499 | void lcd_update(void) |
464 | { | 500 | { |
465 | int y; | 501 | int y; |
466 | if(initialized) { | 502 | if (initialized) |
503 | { | ||
467 | for(y = 0;y < LCD_FBHEIGHT;y++) { | 504 | for(y = 0;y < LCD_FBHEIGHT;y++) { |
468 | /* Copy display bitmap to hardware. | 505 | /* Copy display bitmap to hardware. |
469 | The COM48-COM63 lines are not connected so we have to skip | 506 | The COM48-COM63 lines are not connected so we have to skip |
@@ -480,7 +517,8 @@ void lcd_update(void) | |||
480 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; | 517 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; |
481 | void lcd_update_rect(int x, int y, int width, int height) | 518 | void lcd_update_rect(int x, int y, int width, int height) |
482 | { | 519 | { |
483 | if(initialized) { | 520 | if (initialized) |
521 | { | ||
484 | int ymax; | 522 | int ymax; |
485 | 523 | ||
486 | /* The Y coordinates have to work on even 8 pixel rows */ | 524 | /* The Y coordinates have to work on even 8 pixel rows */ |