summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-12-12 13:23:33 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-12-12 13:23:33 +0000
commit006b2c1c25607d7643bb6cd59052b74197000d06 (patch)
tree7f733d0fbcccea34e9a0d6ed237af8f24836b794
parent503ce1bc0426fc7987371268db88dfc29dcf3fee (diff)
downloadrockbox-006b2c1c25607d7643bb6cd59052b74197000d06.tar.gz
rockbox-006b2c1c25607d7643bb6cd59052b74197000d06.zip
adjustments for Neo
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4130 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c3
-rw-r--r--firmware/drivers/button.c34
-rw-r--r--firmware/drivers/lcd-player.c54
-rw-r--r--firmware/drivers/serial.c2
4 files changed, 89 insertions, 4 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 3f266f2c0b..5a08db4f33 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -577,6 +577,7 @@ static void ata_thread(void)
577 } 577 }
578 queue_wait(&ata_queue, &ev); 578 queue_wait(&ata_queue, &ev);
579 switch ( ev.id ) { 579 switch ( ev.id ) {
580#ifndef USB_NONE
580 case SYS_USB_CONNECTED: 581 case SYS_USB_CONNECTED:
581 if (poweroff) { 582 if (poweroff) {
582 mutex_lock(&ata_mtx); 583 mutex_lock(&ata_mtx);
@@ -593,7 +594,7 @@ static void ata_thread(void)
593 /* Wait until the USB cable is extracted again */ 594 /* Wait until the USB cable is extracted again */
594 usb_wait_for_disconnect(&ata_queue); 595 usb_wait_for_disconnect(&ata_queue);
595 break; 596 break;
596 597#endif
597 case Q_SLEEP: 598 case Q_SLEEP:
598 last_disk_activity = current_tick - sleep_timeout + (HZ/2); 599 last_disk_activity = current_tick - sleep_timeout + (HZ/2);
599 break; 600 break;
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 847a0ba82d..c0cd046db6 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -328,4 +328,38 @@ static int button_read(void)
328 return btn; 328 return btn;
329} 329}
330 330
331#elif HAVE_NEO_KEYPAD
332static bool mStation = false;
333void button_init(void)
334{
335 /* set port pins as input */
336 PAIOR &= ~0x4000; //PA14 for stop button
337
338 queue_init(&button_queue);
339 tick_add_task(button_tick);
340
341 last_keypress = current_tick;
342}
343int button_read(void)
344{
345 int btn=BUTTON_NONE;
346
347 btn|=((~PCDR)&0xFF);
348
349 /* mStation does not have a stop button and this floods the button queue
350 with stops if used on a mStation */
351 if (!mStation)
352 btn|=((~(PADR>>6))&0x100);
353
354 return btn;
355}
356
357/* This function adds a button press event to the button queue, and this
358 really isn't anything Neo-specific but might be subject for adding to
359 the generic button driver */
360int button_add(unsigned int button)
361{
362 queue_post(&button_queue,button,NULL);
363 return 1;
364}
331#endif 365#endif
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 3344a7478a..90e1d48e00 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -105,7 +105,7 @@ static char pattern_size; /* Last pattern, 3 for old LCD, 7 for new LCD */
105 105
106static bool new_lcd; 106static bool new_lcd;
107 107
108extern unsigned short *lcd_ascii; 108unsigned short *lcd_ascii;
109static char lcd_contrast_set; 109static char lcd_contrast_set;
110static char lcd_cram; 110static char lcd_cram;
111static char lcd_pram; 111static char lcd_pram;
@@ -130,7 +130,9 @@ static void lcd_free_pat(int map_ch)
130 130
131 substitute_char=lcd_player_extended_lcd_to_rocklatin1[map_ch]; 131 substitute_char=lcd_player_extended_lcd_to_rocklatin1[map_ch];
132 132
133 /* TODO: use a define for the screen width! */
133 for (x=0; x<11; x++) { 134 for (x=0; x<11; x++) {
135 /* TODO: use a define for the screen height! */
134 for (y=0; y<2; y++) { 136 for (y=0; y<2; y++) {
135 if (map_ch==lcd_ascii[buffer_xlcd[x][y]]-512) { 137 if (map_ch==lcd_ascii[buffer_xlcd[x][y]]-512) {
136 buffer_xlcd[x][y]=substitute_char; 138 buffer_xlcd[x][y]=substitute_char;
@@ -480,7 +482,11 @@ void lcd_set_contrast(int val)
480 482
481void lcd_init (void) 483void lcd_init (void)
482{ 484{
485#ifdef HAVE_NEO_LCD
486 new_lcd = true;
487#else
483 new_lcd = has_new_lcd(); 488 new_lcd = has_new_lcd();
489#endif
484 memset(extended_chars_mapped, NO_CHAR, sizeof(extended_chars_mapped)); 490 memset(extended_chars_mapped, NO_CHAR, sizeof(extended_chars_mapped));
485 memset(extended_pattern_content, NO_CHAR,sizeof(extended_pattern_content)); 491 memset(extended_pattern_content, NO_CHAR,sizeof(extended_pattern_content));
486 memset(extended_pattern_usage, 0, sizeof(extended_pattern_usage)); 492 memset(extended_pattern_usage, 0, sizeof(extended_pattern_usage));
@@ -491,7 +497,7 @@ void lcd_init (void)
491 lcd_cram = NEW_LCD_CRAM; 497 lcd_cram = NEW_LCD_CRAM;
492 lcd_pram = NEW_LCD_PRAM; 498 lcd_pram = NEW_LCD_PRAM;
493 lcd_iram = NEW_LCD_IRAM; 499 lcd_iram = NEW_LCD_IRAM;
494 pattern_size=7; /* Last pattern, 3 for old LCD, 7 for new LCD */ 500 pattern_size=7; /* Last pattern, 7 for new LCD */
495 } 501 }
496 else { 502 else {
497 lcd_ascii = old_lcd_rocklatin1_to_xlcd; 503 lcd_ascii = old_lcd_rocklatin1_to_xlcd;
@@ -499,7 +505,7 @@ void lcd_init (void)
499 lcd_cram = OLD_LCD_CRAM; 505 lcd_cram = OLD_LCD_CRAM;
500 lcd_pram = OLD_LCD_PRAM; 506 lcd_pram = OLD_LCD_PRAM;
501 lcd_iram = OLD_LCD_IRAM; 507 lcd_iram = OLD_LCD_IRAM;
502 pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */ 508 pattern_size=3; /* Last pattern, 3 for old LCD */
503 } 509 }
504 510
505 lcd_set_contrast(lcd_default_contrast()); 511 lcd_set_contrast(lcd_default_contrast());
@@ -719,4 +725,46 @@ static void scroll_thread(void)
719 } 725 }
720} 726}
721 727
728#ifdef HAVE_NEO_LCD
729
730/*
731 * Function use by the Neo code, but could/should be made a generic one.
732 */
733void lcd_cursor(int x, int y)
734{
735 /* If we make sure the display size is setup with proper defines in the
736 config-*.h files, this should work on all displays */
737 if ((cursor.y_pos==y && cursor.x_pos==x) ||
738 x>=20 ||
739 y>3 ||
740 x<0 ||
741 y<0) {
742 DEBUGF("ignoring request for cursor to %d,%d - currently %d,%d\n",
743 x,y,cursor.x_pos,cursor.y_pos);
744 return;
745 }
746
747 char value=0;
748
749 cursor.y_pos=y;
750 cursor.x_pos=x;
751
752 switch (y) {
753 case 0:
754 value=0x80|x;
755 break;
756 case 1:
757 value=0x80|(x+0x40);
758 break;
759 case 2:
760 value=0x80|(x+0x14);
761 break;
762 case 3:
763 value=0x80|(x+0x54);
764 break;
765 }
766 lcd_write(true,value);
767}
768#endif
769
722#endif /* HAVE_LCD_CHARCELLS */ 770#endif /* HAVE_LCD_CHARCELLS */
diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c
index 8fe051dd9e..bc32dde5eb 100644
--- a/firmware/drivers/serial.c
+++ b/firmware/drivers/serial.c
@@ -91,6 +91,7 @@ int remote_control_rx(void)
91 } 91 }
92 else 92 else
93 { 93 {
94#ifndef HAVE_NEO_KEYPAD /* This needs to be fixed for Neo */
94 switch (btn) 95 switch (btn)
95 { 96 {
96 case STOP: 97 case STOP:
@@ -126,6 +127,7 @@ int remote_control_rx(void)
126 last_valid_button = BUTTON_NONE; 127 last_valid_button = BUTTON_NONE;
127 break; 128 break;
128 } 129 }
130#endif
129 } 131 }
130 } 132 }
131 else 133 else