From e90f961593e92fa5d98efa67b569e7efe5f4fbe0 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sat, 29 Oct 2011 17:08:05 +0000 Subject: Sansa clip zip: update mkamsboot and fix various drivers to make it boot to the main firmware git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30853 a1c6a512-1295-4272-9138-f99709370657 --- .../arm/as3525/sansa-clipzip/backlight-clipzip.c | 18 ++++++++---------- .../target/arm/as3525/sansa-clipzip/button-clipzip.c | 10 +++++----- firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c | 10 +++++++--- 3 files changed, 20 insertions(+), 18 deletions(-) (limited to 'firmware/target/arm/as3525/sansa-clipzip') diff --git a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c index 758aa875cc..589f80436e 100644 --- a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c +++ b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c @@ -25,11 +25,14 @@ #include "lcd.h" #include "as3525v2.h" #include "ascodec-target.h" +#include "lcd-target.h" bool _backlight_init() { /* GPIO B1 controls backlight */ GPIOB_DIR |= (1 << 1); + ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); + GPIOB_PIN(1) = (1 << 1); return true; } @@ -37,13 +40,6 @@ bool _backlight_init() void _backlight_on(void) { GPIOB_PIN(1) = (1 << 1); - - ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); - sleep(1); - ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); - sleep(1); - ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); - #ifdef HAVE_LCD_ENABLE lcd_enable(true); #endif @@ -54,9 +50,11 @@ void _backlight_off(void) #ifdef HAVE_LCD_ENABLE lcd_enable(false); #endif - GPIOB_PIN(1) = 0; - - ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); +} + +void _backlight_set_brightness(int brightness) +{ + oled_brightness(brightness); } diff --git a/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c index 104c227378..e960b49b77 100644 --- a/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c +++ b/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c @@ -71,13 +71,13 @@ int button_read_device(void) udelay(500); if (GPIOC_PIN(3)) { - buttons |= BUTTON_LEFT; + buttons |= BUTTON_RIGHT; } if (GPIOC_PIN(4)) { buttons |= BUTTON_SELECT; } if (GPIOC_PIN(5)) { - buttons |= BUTTON_RIGHT; + buttons |= BUTTON_UP; } /* key matrix buttons, second row */ @@ -86,13 +86,13 @@ int button_read_device(void) udelay(500); if (GPIOC_PIN(3)) { - buttons |= BUTTON_UP; + buttons |= BUTTON_HOME; } if (GPIOC_PIN(4)) { - buttons |= BUTTON_HOME; + buttons |= BUTTON_DOWN; } if (GPIOC_PIN(5)) { - buttons |= BUTTON_DOWN; + buttons |= BUTTON_LEFT; } /* deselect scan rows */ diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c index 899eb538ea..0ae049b6ff 100644 --- a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c +++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c @@ -51,12 +51,16 @@ static int lcd_hw_init(void) SSP_IMSC &= ~0xF; /* disable interrupts */ SSP_DMACR &= ~0x3; /* disable DMA */ + /* GPIO A3 is ??? but needs to be set */ + GPIOA_DIR |= (1 << 3); + GPIOA_PIN(3) = (1 << 3); + /* configure GPIO B2 (lcd D/C#) as output */ GPIOB_DIR |= (1<<2); /* configure GPIO B3 (lcd type detect) as input */ GPIOB_DIR &= ~(1<<3); - + /* configure GPIO A5 (lcd reset#) as output and perform lcd reset */ GPIOA_DIR |= (1 << 5); GPIOA_PIN(5) = 0; @@ -154,7 +158,7 @@ static void lcd_write_nibbles(uint8_t val) /* initialises lcd type 1 */ static void lcd_init_type1(void) { - static const uint8_t curve[256] = { + static const uint8_t curve[128] = { /* 5-bit curve */ 0, 5, 10, 15, 20, 25, 30, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 105, 109, 113, 117, 121, 123, 127, @@ -242,7 +246,7 @@ static void lcd_init_type1(void) lcd_write_dat(0x10); lcd_write_cmd(0x3A); - for (i = 0; i < 256; i++) { + for (i = 0; i < 128; i++) { lcd_write_nibbles(curve[i]); } -- cgit v1.2.3