summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config/sansaclipzip.h10
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c18
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c10
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c10
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c17
-rw-r--r--firmware/target/arm/as3525/system-as3525.c2
-rw-r--r--firmware/target/arm/as3525/system-target.h2
7 files changed, 35 insertions, 34 deletions
diff --git a/firmware/export/config/sansaclipzip.h b/firmware/export/config/sansaclipzip.h
index fcffbce6ab..1f5a7cd1c8 100644
--- a/firmware/export/config/sansaclipzip.h
+++ b/firmware/export/config/sansaclipzip.h
@@ -45,7 +45,7 @@
45#define LCD_WIDTH 96 45#define LCD_WIDTH 96
46#define LCD_HEIGHT 96 46#define LCD_HEIGHT 96
47#define LCD_DEPTH 16 /* 65536 colours */ 47#define LCD_DEPTH 16 /* 65536 colours */
48#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 swapped */ 48#define LCD_PIXELFORMAT RGB565
49 49
50/* define this if you have LCD enable function */ 50/* define this if you have LCD enable function */
51#define HAVE_LCD_ENABLE 51#define HAVE_LCD_ENABLE
@@ -114,6 +114,8 @@
114/* Define this for LCD backlight available */ 114/* Define this for LCD backlight available */
115#define HAVE_BACKLIGHT 115#define HAVE_BACKLIGHT
116 116
117#define HAVE_BACKLIGHT_BRIGHTNESS
118
117/* define this if you have a flash memory storage */ 119/* define this if you have a flash memory storage */
118#define HAVE_FLASH_STORAGE 120#define HAVE_FLASH_STORAGE
119 121
@@ -189,9 +191,9 @@
189/** Port-specific settings **/ 191/** Port-specific settings **/
190 192
191/* Main LCD backlight brightness range and defaults */ 193/* Main LCD backlight brightness range and defaults */
192#define MIN_BRIGHTNESS_SETTING 1 /* TODO */ 194#define MIN_BRIGHTNESS_SETTING 0
193#define MAX_BRIGHTNESS_SETTING 12 /* TODO */ 195#define MAX_BRIGHTNESS_SETTING 9
194#define DEFAULT_BRIGHTNESS_SETTING 6 /* TODO */ 196#define DEFAULT_BRIGHTNESS_SETTING 6
195 197
196/* Default recording levels */ 198/* Default recording levels */
197#define DEFAULT_REC_MIC_GAIN 23 199#define DEFAULT_REC_MIC_GAIN 23
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 @@
25#include "lcd.h" 25#include "lcd.h"
26#include "as3525v2.h" 26#include "as3525v2.h"
27#include "ascodec-target.h" 27#include "ascodec-target.h"
28#include "lcd-target.h"
28 29
29bool _backlight_init() 30bool _backlight_init()
30{ 31{
31 /* GPIO B1 controls backlight */ 32 /* GPIO B1 controls backlight */
32 GPIOB_DIR |= (1 << 1); 33 GPIOB_DIR |= (1 << 1);
34 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
35 GPIOB_PIN(1) = (1 << 1);
33 36
34 return true; 37 return true;
35} 38}
@@ -37,13 +40,6 @@ bool _backlight_init()
37void _backlight_on(void) 40void _backlight_on(void)
38{ 41{
39 GPIOB_PIN(1) = (1 << 1); 42 GPIOB_PIN(1) = (1 << 1);
40
41 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
42 sleep(1);
43 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
44 sleep(1);
45 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
46
47#ifdef HAVE_LCD_ENABLE 43#ifdef HAVE_LCD_ENABLE
48 lcd_enable(true); 44 lcd_enable(true);
49#endif 45#endif
@@ -54,9 +50,11 @@ void _backlight_off(void)
54#ifdef HAVE_LCD_ENABLE 50#ifdef HAVE_LCD_ENABLE
55 lcd_enable(false); 51 lcd_enable(false);
56#endif 52#endif
57
58 GPIOB_PIN(1) = 0; 53 GPIOB_PIN(1) = 0;
59 54}
60 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); 55
56void _backlight_set_brightness(int brightness)
57{
58 oled_brightness(brightness);
61} 59}
62 60
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)
71 udelay(500); 71 udelay(500);
72 72
73 if (GPIOC_PIN(3)) { 73 if (GPIOC_PIN(3)) {
74 buttons |= BUTTON_LEFT; 74 buttons |= BUTTON_RIGHT;
75 } 75 }
76 if (GPIOC_PIN(4)) { 76 if (GPIOC_PIN(4)) {
77 buttons |= BUTTON_SELECT; 77 buttons |= BUTTON_SELECT;
78 } 78 }
79 if (GPIOC_PIN(5)) { 79 if (GPIOC_PIN(5)) {
80 buttons |= BUTTON_RIGHT; 80 buttons |= BUTTON_UP;
81 } 81 }
82 82
83 /* key matrix buttons, second row */ 83 /* key matrix buttons, second row */
@@ -86,13 +86,13 @@ int button_read_device(void)
86 udelay(500); 86 udelay(500);
87 87
88 if (GPIOC_PIN(3)) { 88 if (GPIOC_PIN(3)) {
89 buttons |= BUTTON_UP; 89 buttons |= BUTTON_HOME;
90 } 90 }
91 if (GPIOC_PIN(4)) { 91 if (GPIOC_PIN(4)) {
92 buttons |= BUTTON_HOME; 92 buttons |= BUTTON_DOWN;
93 } 93 }
94 if (GPIOC_PIN(5)) { 94 if (GPIOC_PIN(5)) {
95 buttons |= BUTTON_DOWN; 95 buttons |= BUTTON_LEFT;
96 } 96 }
97 97
98 /* deselect scan rows */ 98 /* 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)
51 SSP_IMSC &= ~0xF; /* disable interrupts */ 51 SSP_IMSC &= ~0xF; /* disable interrupts */
52 SSP_DMACR &= ~0x3; /* disable DMA */ 52 SSP_DMACR &= ~0x3; /* disable DMA */
53 53
54 /* GPIO A3 is ??? but needs to be set */
55 GPIOA_DIR |= (1 << 3);
56 GPIOA_PIN(3) = (1 << 3);
57
54 /* configure GPIO B2 (lcd D/C#) as output */ 58 /* configure GPIO B2 (lcd D/C#) as output */
55 GPIOB_DIR |= (1<<2); 59 GPIOB_DIR |= (1<<2);
56 60
57 /* configure GPIO B3 (lcd type detect) as input */ 61 /* configure GPIO B3 (lcd type detect) as input */
58 GPIOB_DIR &= ~(1<<3); 62 GPIOB_DIR &= ~(1<<3);
59 63
60 /* configure GPIO A5 (lcd reset#) as output and perform lcd reset */ 64 /* configure GPIO A5 (lcd reset#) as output and perform lcd reset */
61 GPIOA_DIR |= (1 << 5); 65 GPIOA_DIR |= (1 << 5);
62 GPIOA_PIN(5) = 0; 66 GPIOA_PIN(5) = 0;
@@ -154,7 +158,7 @@ static void lcd_write_nibbles(uint8_t val)
154/* initialises lcd type 1 */ 158/* initialises lcd type 1 */
155static void lcd_init_type1(void) 159static void lcd_init_type1(void)
156{ 160{
157 static const uint8_t curve[256] = { 161 static const uint8_t curve[128] = {
158 /* 5-bit curve */ 162 /* 5-bit curve */
159 0, 5, 10, 15, 20, 25, 30, 35, 39, 43, 47, 51, 55, 59, 63, 67, 163 0, 5, 10, 15, 20, 25, 30, 35, 39, 43, 47, 51, 55, 59, 63, 67,
160 71, 75, 79, 83, 87, 91, 95, 99, 103, 105, 109, 113, 117, 121, 123, 127, 164 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)
242 lcd_write_dat(0x10); 246 lcd_write_dat(0x10);
243 247
244 lcd_write_cmd(0x3A); 248 lcd_write_cmd(0x3A);
245 for (i = 0; i < 256; i++) { 249 for (i = 0; i < 128; i++) {
246 lcd_write_nibbles(curve[i]); 250 lcd_write_nibbles(curve[i]);
247 } 251 }
248 252
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 7410b19550..74925a3aab 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -376,11 +376,8 @@ static inline bool card_detect_target(void)
376#if defined(HAVE_MULTIDRIVE) 376#if defined(HAVE_MULTIDRIVE)
377#if defined(SANSA_FUZEV2) 377#if defined(SANSA_FUZEV2)
378 return GPIOA_PIN(2); 378 return GPIOA_PIN(2);
379#elif defined(SANSA_CLIPPLUS) 379#elif defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
380 return !(GPIOA_PIN(2)); 380 return !(GPIOA_PIN(2));
381#elif defined(SANSA_CLIPZIP)
382 /* TODO for ClipZip: determine polarity of uSD detect */
383 return false;
384#else 381#else
385#error "microSD pin not defined for your target" 382#error "microSD pin not defined for your target"
386#endif 383#endif
@@ -398,14 +395,14 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
398 !send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, response)) 395 !send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, response))
399 return false; 396 return false;
400 397
401#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 398#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
402 if (amsv2_variant == 1) 399 if (amsv2_variant == 1)
403 GPIOB_PIN(5) = (drive == INTERNAL_AS3525) ? 1 << 5 : 0; 400 GPIOB_PIN(5) = (drive == INTERNAL_AS3525) ? 1 << 5 : 0;
404#endif 401#endif
405 402
406 MCI_ARGUMENT = arg; 403 MCI_ARGUMENT = arg;
407 404
408#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 405#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
409 if (amsv2_variant == 1) 406 if (amsv2_variant == 1)
410 card_no = 1 << 16; 407 card_no = 1 << 16;
411 else 408 else
@@ -565,7 +562,7 @@ static int sd_init_card(const int drive)
565 return -17; 562 return -17;
566 563
567 /* Now that card is widebus make controller aware */ 564 /* Now that card is widebus make controller aware */
568#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 565#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
569 if (amsv2_variant == 1) 566 if (amsv2_variant == 1)
570 MCI_CTYPE |= 1<<1; 567 MCI_CTYPE |= 1<<1;
571 else 568 else
@@ -575,7 +572,7 @@ static int sd_init_card(const int drive)
575#endif /* ! BOOTLOADER */ 572#endif /* ! BOOTLOADER */
576 573
577 /* Set low power mode */ 574 /* Set low power mode */
578#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 575#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
579 if (amsv2_variant == 1) 576 if (amsv2_variant == 1)
580 MCI_CLKENA |= 1<<(1 + 16); 577 MCI_CLKENA |= 1<<(1 + 16);
581 else 578 else
@@ -673,7 +670,7 @@ static void init_controller(void)
673 int card_mask = (1 << hcon_numcards) - 1; 670 int card_mask = (1 << hcon_numcards) - 1;
674 int pwr_mask; 671 int pwr_mask;
675 672
676#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 673#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
677 if (amsv2_variant == 1) 674 if (amsv2_variant == 1)
678 pwr_mask = 1 << 1; 675 pwr_mask = 1 << 1;
679 else 676 else
@@ -738,7 +735,7 @@ int sd_init(void)
738 semaphore_init(&transfer_completion_signal, 1, 0); 735 semaphore_init(&transfer_completion_signal, 1, 0);
739 semaphore_init(&command_completion_signal, 1, 0); 736 semaphore_init(&command_completion_signal, 1, 0);
740 737
741#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 738#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
742 if (amsv2_variant == 1) 739 if (amsv2_variant == 1)
743 GPIOB_DIR |= 1 << 5; 740 GPIOB_DIR |= 1 << 5;
744#endif 741#endif
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index a79b934aaa..2a40724208 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -184,7 +184,7 @@ static void check_model_variant(void)
184 c200v2_variant = !GPIOA_PIN(7); 184 c200v2_variant = !GPIOA_PIN(7);
185 GPIOA_DIR = saved_dir; 185 GPIOA_DIR = saved_dir;
186} 186}
187#elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 187#elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
188int amsv2_variant; 188int amsv2_variant;
189 189
190static void check_model_variant(void) 190static void check_model_variant(void)
diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h
index 7c9dcccc0c..cdcc2e6687 100644
--- a/firmware/target/arm/as3525/system-target.h
+++ b/firmware/target/arm/as3525/system-target.h
@@ -46,7 +46,7 @@
46 ? (((uintptr_t)(a)) - IRAM_ORIG) \ 46 ? (((uintptr_t)(a)) - IRAM_ORIG) \
47 : ((uintptr_t)(a)))) 47 : ((uintptr_t)(a))))
48 48
49#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 49#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
50extern int amsv2_variant; 50extern int amsv2_variant;
51#endif 51#endif
52 52