summaryrefslogtreecommitdiff
path: root/bootloader/meizu_m6sl.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/meizu_m6sl.c')
-rw-r--r--bootloader/meizu_m6sl.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/bootloader/meizu_m6sl.c b/bootloader/meizu_m6sl.c
index 442a0f9e18..86c4c5731e 100644
--- a/bootloader/meizu_m6sl.c
+++ b/bootloader/meizu_m6sl.c
@@ -77,9 +77,10 @@ void bl_debug(bool bit)
77 } 77 }
78} 78}
79 79
80void bl_debug_int(unsigned int input) 80void bl_debug_count(unsigned int input)
81{ 81{
82 unsigned int i; 82 unsigned int i;
83 delay(SHORT_DELAY*3);
83 for (i = 0; i < input; i++) 84 for (i = 0; i < input; i++)
84 { 85 {
85 PDAT0 ^= (1 << 2); //Toggle backlight 86 PDAT0 ^= (1 << 2); //Toggle backlight
@@ -87,12 +88,26 @@ void bl_debug_int(unsigned int input)
87 PDAT0 ^= (1 << 2); //Toggle backlight 88 PDAT0 ^= (1 << 2); //Toggle backlight
88 delay(2*SHORT_DELAY); 89 delay(2*SHORT_DELAY);
89 } 90 }
91}
92void bl_debug_int(unsigned int input,unsigned int count)
93{
94 unsigned int i;
95 for (i = 0; i < count; i++)
96 {
97 bl_debug(input>>i & 1);
98 }
90 delay(SHORT_DELAY*6); 99 delay(SHORT_DELAY*6);
91} 100}
92 101
102/* These functions are supposed to be static in lcd-m6sl.c, but
103 we use them here for testing */
104void init_lcd_spi(void);
105unsigned int lcd_read_id(void);
106
93void main(void) 107void main(void)
94{ 108{
95 //Set backlight pin to output and enable 109 //Set backlight pin to output and enable
110 unsigned int model;
96 int oldval = PCON0; 111 int oldval = PCON0;
97 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4)); 112 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
98 PDAT0 |= (1 << 2); 113 PDAT0 |= (1 << 2);
@@ -108,9 +123,18 @@ void main(void)
108 // Wait for play to be released 123 // Wait for play to be released
109 while((PDAT1 & (1 << 4))); 124 while((PDAT1 & (1 << 4)));
110 PDAT0 ^= (1 << 2); //Toggle backlight 125 PDAT0 ^= (1 << 2); //Toggle backlight
126 delay(LONG_DELAY);
127
128 init_lcd_spi();
129 model=lcd_read_id();
130 bl_debug_count((model&0xf000)>>12);
131 bl_debug_count((model&0xf00)>>8);
132 bl_debug_count((model&0xf0)>>4);
133 bl_debug_count(model&0xf);
111 134
112 /* Calibrate the lot */ 135 /* Calibrate the lot */
113 qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI | QT1106_SLD_SLIDER | QT1106_CAL_WHEEL | QT1106_CAL_KEYS | QT1106_RES_4); 136 qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI \
137 | QT1106_SLD_SLIDER | QT1106_CAL_WHEEL | QT1106_CAL_KEYS | QT1106_RES_4);
114 138
115 /* Set to maximum sensitivity */ 139 /* Set to maximum sensitivity */
116 qt1106_io(QT1106_CT | (0x00 << 8) ); 140 qt1106_io(QT1106_CT | (0x00 << 8) );
@@ -119,8 +143,10 @@ void main(void)
119 { 143 {
120 qt1106_wait(); 144 qt1106_wait();
121 145
122 int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_4); 146 int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \
123 bl_debug_int(((slider&0xff)) + 1); 147 | QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_4);
148 if(slider & 0x008000)
149 bl_debug_count(((slider&0xff)) + 1);
124 } 150 }
125 151
126 //power off 152 //power off