diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-12-12 13:23:33 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-12-12 13:23:33 +0000 |
commit | 006b2c1c25607d7643bb6cd59052b74197000d06 (patch) | |
tree | 7f733d0fbcccea34e9a0d6ed237af8f24836b794 /firmware | |
parent | 503ce1bc0426fc7987371268db88dfc29dcf3fee (diff) |
adjustments for Neo
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4130 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 3 | ||||
-rw-r--r-- | firmware/drivers/button.c | 34 | ||||
-rw-r--r-- | firmware/drivers/lcd-player.c | 54 | ||||
-rw-r--r-- | firmware/drivers/serial.c | 2 |
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) } queue_wait(&ata_queue, &ev); switch ( ev.id ) { +#ifndef USB_NONE case SYS_USB_CONNECTED: if (poweroff) { mutex_lock(&ata_mtx); @@ -593,7 +594,7 @@ static void ata_thread(void) /* Wait until the USB cable is extracted again */ usb_wait_for_disconnect(&ata_queue); break; - +#endif case Q_SLEEP: last_disk_activity = current_tick - sleep_timeout + (HZ/2); 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) return btn; } +#elif HAVE_NEO_KEYPAD +static bool mStation = false; +void button_init(void) +{ + /* set port pins as input */ + PAIOR &= ~0x4000; //PA14 for stop button + + queue_init(&button_queue); + tick_add_task(button_tick); + + last_keypress = current_tick; +} +int button_read(void) +{ + int btn=BUTTON_NONE; + + btn|=((~PCDR)&0xFF); + + /* mStation does not have a stop button and this floods the button queue + with stops if used on a mStation */ + if (!mStation) + btn|=((~(PADR>>6))&0x100); + + return btn; +} + +/* This function adds a button press event to the button queue, and this + really isn't anything Neo-specific but might be subject for adding to + the generic button driver */ +int button_add(unsigned int button) +{ + queue_post(&button_queue,button,NULL); + return 1; +} #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 */ static bool new_lcd; -extern unsigned short *lcd_ascii; +unsigned short *lcd_ascii; static char lcd_contrast_set; static char lcd_cram; static char lcd_pram; @@ -130,7 +130,9 @@ static void lcd_free_pat(int map_ch) substitute_char=lcd_player_extended_lcd_to_rocklatin1[map_ch]; + /* TODO: use a define for the screen width! */ for (x=0; x<11; x++) { + /* TODO: use a define for the screen height! */ for (y=0; y<2; y++) { if (map_ch==lcd_ascii[buffer_xlcd[x][y]]-512) { buffer_xlcd[x][y]=substitute_char; @@ -480,7 +482,11 @@ void lcd_set_contrast(int val) void lcd_init (void) { +#ifdef HAVE_NEO_LCD + new_lcd = true; +#else new_lcd = has_new_lcd(); +#endif memset(extended_chars_mapped, NO_CHAR, sizeof(extended_chars_mapped)); memset(extended_pattern_content, NO_CHAR,sizeof(extended_pattern_content)); memset(extended_pattern_usage, 0, sizeof(extended_pattern_usage)); @@ -491,7 +497,7 @@ void lcd_init (void) lcd_cram = NEW_LCD_CRAM; lcd_pram = NEW_LCD_PRAM; lcd_iram = NEW_LCD_IRAM; - pattern_size=7; /* Last pattern, 3 for old LCD, 7 for new LCD */ + pattern_size=7; /* Last pattern, 7 for new LCD */ } else { lcd_ascii = old_lcd_rocklatin1_to_xlcd; @@ -499,7 +505,7 @@ void lcd_init (void) lcd_cram = OLD_LCD_CRAM; lcd_pram = OLD_LCD_PRAM; lcd_iram = OLD_LCD_IRAM; - pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */ + pattern_size=3; /* Last pattern, 3 for old LCD */ } lcd_set_contrast(lcd_default_contrast()); @@ -719,4 +725,46 @@ static void scroll_thread(void) } } +#ifdef HAVE_NEO_LCD + +/* + * Function use by the Neo code, but could/should be made a generic one. + */ +void lcd_cursor(int x, int y) +{ + /* If we make sure the display size is setup with proper defines in the + config-*.h files, this should work on all displays */ + if ((cursor.y_pos==y && cursor.x_pos==x) || + x>=20 || + y>3 || + x<0 || + y<0) { + DEBUGF("ignoring request for cursor to %d,%d - currently %d,%d\n", + x,y,cursor.x_pos,cursor.y_pos); + return; + } + + char value=0; + + cursor.y_pos=y; + cursor.x_pos=x; + + switch (y) { + case 0: + value=0x80|x; + break; + case 1: + value=0x80|(x+0x40); + break; + case 2: + value=0x80|(x+0x14); + break; + case 3: + value=0x80|(x+0x54); + break; + } + lcd_write(true,value); +} +#endif + #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) } else { +#ifndef HAVE_NEO_KEYPAD /* This needs to be fixed for Neo */ switch (btn) { case STOP: @@ -126,6 +127,7 @@ int remote_control_rx(void) last_valid_button = BUTTON_NONE; break; } +#endif } } else |