From 487d78995a4fad7fa0cf5700c0752fbc279b5746 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 30 Mar 2009 19:57:42 +0000 Subject: [PATCH] A bit of cleanup in config-fuze (don't define features we do not have yet), a bit of reordering. Cleanup in the lcd driver. Reintroduce the delay in the dbop read function, as it helps avoiding heavy hold button weirdness when boosted git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20583 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-fuze.h | 57 ++++++++----------- .../arm/as3525/sansa-fuze/button-fuze.c | 8 +++ .../target/arm/as3525/sansa-fuze/lcd-fuze.c | 26 ++------- 3 files changed, 37 insertions(+), 54 deletions(-) diff --git a/firmware/export/config-fuze.h b/firmware/export/config-fuze.h index dfd00c3b17..a5ccf63180 100644 --- a/firmware/export/config-fuze.h +++ b/firmware/export/config-fuze.h @@ -17,6 +17,11 @@ #define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ #define REC_SAMPR_DEFAULT SAMPR_22 +/* Default recording levels */ +#define DEFAULT_REC_MIC_GAIN 23 +#define DEFAULT_REC_LEFT_GAIN 23 +#define DEFAULT_REC_RIGHT_GAIN 23 + /* Define bitmask of input sources - recordable bitmask can be defined explicitly if different */ #endif @@ -24,11 +29,10 @@ /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP - /* define this if you have a colour LCD */ #define HAVE_LCD_COLOR -/* define this if you want album art for this target */ +#ifndef BOOTLOADER/* define this if you want album art for this target */ #define HAVE_ALBUMART /* define this if you have a light associated with the buttons */ @@ -43,13 +47,6 @@ /* define this if you would like tagcache to build on this target */ #define HAVE_TAGCACHE -/* LCD dimensions */ -#define LCD_WIDTH 220 -#define LCD_HEIGHT 176 -#define LCD_DEPTH 16 /* 65536 colours */ -#define LCD_PIXELFORMAT RGB565 /* rgb565 */ - -#ifndef BOOTLOADER /* define this if you have LCD enable function */ #define HAVE_LCD_ENABLE @@ -58,14 +55,21 @@ #define HAVE_LCD_SLEEP #define HAVE_LCD_SLEEP_SETTING */ -#endif /* define this if you can flip your LCD */ -#define HAVE_LCD_FLIP +//#define HAVE_LCD_FLIP /* define this if you can invert the colours on your LCD */ -#define HAVE_LCD_INVERT +//#define HAVE_LCD_INVERT + +/* define this if you have a real-time clock */ +#define CONFIG_RTC RTC_AS3514 + +/* There is no hardware tone control */ +#define HAVE_SW_TONE_CONTROLS + +#endif /* !BOOTLOADER */ /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ #define CONFIG_KEYPAD SANSA_FUZE_PAD @@ -73,22 +77,22 @@ /* Define this if you do software codec */ #define CONFIG_CODEC SWCODEC -/* There is no hardware tone control */ -#define HAVE_SW_TONE_CONTROLS + +/* LCD dimensions */ +#define LCD_WIDTH 220 +#define LCD_HEIGHT 176 +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ + /* We're working on the assumption that the AS3525 has something similar to the AS3514 for audio codec etc */ #define HAVE_AS3514 -/* define this if you have a real-time clock */ -#ifndef BOOTLOADER -#define CONFIG_RTC RTC_AS3514 -#endif - /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF -/* Some Sansa E200s seem to be FAT16 formatted */ +/* Some Sansa Fuzes seem to be FAT16 formatted */ #define HAVE_FAT16SUPPORT /* The number of bytes reserved for loadable codecs */ @@ -151,15 +155,8 @@ /* Define this if you want to use the AS2525 i2c interface */ #define CONFIG_I2C I2C_AS3525 -/* define this if the hardware can be powered off while charging */ -/* Sansa can't be powered off while charging */ -/* #define HAVE_POWEROFF_WHILE_CHARGING */ - -/* The start address index for ROM builds */ -#define ROM_START 0x00000000 - /* Define this to the CPU frequency */ -#define CPU_FREQ 75000000 +#define CPU_FREQ 250000000 /* Type of LCD */ #define CONFIG_LCD LCD_FUZE @@ -200,7 +197,3 @@ #endif /* SIMULATOR */ -/* Default recording levels */ -#define DEFAULT_REC_MIC_GAIN 23 -#define DEFAULT_REC_LEFT_GAIN 23 -#define DEFAULT_REC_RIGHT_GAIN 23 diff --git a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c index 4a9996881d..f32776f6eb 100644 --- a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c @@ -133,6 +133,12 @@ bool button_hold(void) return hold_button; } +static void button_delay(void) +{ + int i = 32; + while(i--); +} + static short button_dbop(void) { /* skip home and power reading if lcd_button_support was blocked, @@ -153,6 +159,8 @@ static short button_dbop(void) DBOP_TIMPOL_01 = 0xe167e167; DBOP_TIMPOL_23 = 0xe167006e; + button_delay(); + DBOP_CTRL |= (1<<15); /* start read */ while((DBOP_STAT & (1<<16)) == 0); /* wait for valid data */ diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c index db69c9763a..3e08ba4dff 100644 --- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c @@ -44,7 +44,7 @@ static int xoffset = 20; /* needed for flip */ /* we need to write a red pixel for correct button reads * (see lcd_button_support()), but that must not happen while the lcd is updating * so block lcd_button_support the during updates */ -static volatile bool lcd_busy = false; +static bool lcd_busy = false; static void as3525_dbop_init(void) { @@ -108,32 +108,13 @@ static void lcd_write_reg(int reg, int value) lcd_write_data(&data, 1); } -/*** hardware configuration ***/ - -void lcd_set_contrast(int val) -{ - (void)val; -} - -void lcd_set_invert_display(bool yesno) -{ - (void)yesno; -} - -static void flip_lcd(bool yesno) -{ - (void)yesno; -} - - /* turn the display upside down (call lcd_update() afterwards) */ void lcd_set_flip(bool yesno) { display_flipped = yesno; xoffset = yesno ? 0 : 20; /* TODO: Implement flipped mode */ - if (display_on) - flip_lcd(yesno); + /* TODO */ } @@ -355,7 +336,8 @@ bool lcd_button_support(void) lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); /* Set start position and window */ - lcd_window_x(-1, 1); + lcd_window_x(-1, 0); + lcd_window_y(-1, 0); lcd_write_cmd(R_WRITE_DATA_2_GRAM); lcd_write_data(&data, 1);