##// END OF EJS Templates
sync
Jeandet Alexis -
r64:b702edc52366 dev_alexis
parent child
Show More
@@ -1,312 +1,312
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 #include <stm32f4xx_gpio.h>
28 #include <stm32f4xx_gpio.h>
29 #include <stm32f4xx_fsmc.h>
29 #include <stm32f4xx_fsmc.h>
30 #include <i2c.h>
30 #include <i2c.h>
31 #include <core.h>
31 #include <core.h>
32 #include <terminal.h>
32 #include <terminal.h>
33
33
34 uint32_t OSC0 =8000000;
34 uint32_t OSC0 =8000000;
35 uint32_t INTOSC =16000000;
35 uint32_t INTOSC =16000000;
36 uint32_t RTCOSC =32768;
36 uint32_t RTCOSC =32768;
37 uint32_t currentCpuFreq=0;
37 uint32_t currentCpuFreq=0;
38 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
38 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
39
39
40 LCD_IF_t lcdIF0={
40 LCD_IF_t lcdIF0={
41 .init = &bsp_FSMC_init,
41 .init = &bsp_FSMC_init,
42 .writereg = &bsp_lcd0_write_reg,
42 .writereg = &bsp_lcd0_write_reg,
43 .readreg = &bsp_lcd0_read_reg,
43 .readreg = &bsp_lcd0_read_reg,
44 .writeGRAM = &bsp_lcd0_writeGRAM,
44 .writeGRAM = &bsp_lcd0_writeGRAM,
45 .readGRAM = &bsp_lcd0_readGRAM
45 .readGRAM = &bsp_lcd0_readGRAM
46 };
46 };
47
47
48 LCD_t lcd0={
48 LCD_t lcd0={
49 .interface = &lcdIF0,
49 .interface = &lcdIF0,
50 .init = &ili9328init,
50 .init = &ili9328init,
51 .paint = &ili9328paint,
51 .paint = &ili9328paint,
52 .paintText = &ili9328paintText,
52 .paintText = &ili9328paintText,
53 .paintFilRect = &ili9328paintFilRect,
53 .paintFilRect = &ili9328paintFilRect,
54 .refreshenable = &ili9328refreshenable,
54 .refreshenable = &ili9328refreshenable,
55 .width= 240,
55 .width= 240,
56 .height = 320
56 .height = 320
57 };
57 };
58
58
59 terminal_t terminal0;
59 terminal_t terminal0;
60
60
61 volatile int16_t* lcd0_CMD=(volatile int16_t*) 0x60000000;
61 volatile int16_t* lcd0_CMD=(volatile int16_t*) 0x60000000;
62 volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x61FFFFF0);
62 volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x61FFFFF0);
63
63
64 float VREF0 =(float)3.3;
64 float VREF0 =(float)3.3;
65
65
66 int bsp_init()
66 int bsp_init()
67 {
67 {
68 int i=0;
68 int i=0;
69 for(i=0;i<32;i++)
69 for(i=0;i<32;i++)
70 {
70 {
71 __opnfiles__[i] = NULL;
71 __opnfiles__[i] = NULL;
72 }
72 }
73 bsp_GPIO_init();
73 bsp_GPIO_init();
74 bsp_uart_init();
74 bsp_uart_init();
75 bsp_iic_init();
75 bsp_iic_init();
76 bsp_FSMC_init();
76 bsp_FSMC_init();
77 bsp_GTerm_init();
77 bsp_GTerm_init();
78 printf("\r=====================\n\r");
78 printf("\r=====================\n\r");
79 printf( "=====================\n\r");
79 printf( "=====================\n\r");
80 printf(BSP);
80 printf(BSP);
81 printf(" initialised\n\r");
81 printf(" initialised\n\r");
82 printf( "=====================\n\r");
82 printf( "=====================\n\r");
83 return 1;
83 return 1;
84 }
84 }
85
85
86 void bsp_GPIO_init()
86 void bsp_GPIO_init()
87 {
87 {
88 gpio_t gpio1 = gpioopen(LED1);
88 gpio_t gpio1 = gpioopen(LED1);
89 gpio_t gpio2 = gpioopen(LED2);
89 gpio_t gpio2 = gpioopen(LED2);
90 gpio_t gpio3 = gpioopen(LED3);
90 gpio_t gpio3 = gpioopen(LED3);
91 gpio_t gpio4 = gpioopen(PSU_DISABLE);
91 gpio_t gpio4 = gpioopen(PSU_DISABLE);
92 gpio_t gpio5 = gpioopen(PSU_ALERT_5V);
92 gpio_t gpio5 = gpioopen(PSU_ALERT_5V);
93 gpio_t gpio6 = gpioopen(PSU_ALERT_1_5V);
93 gpio_t gpio6 = gpioopen(PSU_ALERT_1_5V);
94 gpio_t gpio7 = gpioopen(PSU_ALERT_3_3V);
94 gpio_t gpio7 = gpioopen(PSU_ALERT_3_3V);
95 gpiosetspeed(&gpio1,gpiohighspeed);
95 gpiosetspeed(&gpio1,gpiohighspeed);
96 gpiosetspeed(&gpio2,gpiohighspeed);
96 gpiosetspeed(&gpio2,gpiohighspeed);
97 gpiosetspeed(&gpio3,gpiohighspeed);
97 gpiosetspeed(&gpio3,gpiohighspeed);
98 gpiosetspeed(&gpio4,gpiohighspeed);
98 gpiosetspeed(&gpio4,gpiohighspeed);
99 gpiosetspeed(&gpio5,gpiohighspeed);
99 gpiosetspeed(&gpio5,gpiohighspeed);
100 gpiosetspeed(&gpio6,gpiohighspeed);
100 gpiosetspeed(&gpio6,gpiohighspeed);
101 gpiosetspeed(&gpio7,gpiohighspeed);
101 gpiosetspeed(&gpio7,gpiohighspeed);
102 gpioclr(PSU_DISABLE);
102 gpioclr(PSU_DISABLE);
103 gpiosetdir(&gpio1,gpiooutdir);
103 gpiosetdir(&gpio1,gpiooutdir);
104 gpiosetdir(&gpio3,gpiooutdir);
104 gpiosetdir(&gpio3,gpiooutdir);
105 gpiosetdir(&gpio2,gpiooutdir);
105 gpiosetdir(&gpio2,gpiooutdir);
106 gpiosetdir(&gpio4,gpiooutdir);
106 gpiosetdir(&gpio4,gpiooutdir);
107 gpiosetdir(&gpio5,gpioindir);
107 gpiosetdir(&gpio5,gpioindir);
108 gpiosetdir(&gpio6,gpioindir);
108 gpiosetdir(&gpio6,gpioindir);
109 gpiosetdir(&gpio7,gpioindir);
109 gpiosetdir(&gpio7,gpioindir);
110 gpioclr(PSU_DISABLE);
110 gpioclr(PSU_DISABLE);
111 }
111 }
112
112
113 void bsp_uart_init()
113 void bsp_uart_init()
114 {
114 {
115 //if(__opnfiles__[1]==NULL)
115 //if(__opnfiles__[1]==NULL)
116 //{
116 //{
117 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
117 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
118 // streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
118 // streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
119 // uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
119 // uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
120 //uartmkstreamdev(uart,fd1);
120 //uartmkstreamdev(uart,fd1);
121 //__opnfiles__[1] = fd1;
121 //__opnfiles__[1] = fd1;
122 //}
122 //}
123 //else
123 //else
124 //{
124 //{
125 uartopenandconfig(0,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
125 uartopenandconfig(0,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
126 //}
126 //}
127 }
127 }
128
128
129
129
130
130
131 int bsp_FSMC_init()
131 int bsp_FSMC_init()
132 {
132 {
133 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
133 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
134 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
134 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
135
135
136 gpio_t gpio1 = gpioopen(LCD_RESET);
136 gpio_t gpio1 = gpioopen(LCD_RESET);
137 gpiosetspeed(&gpio1,gpiohighspeed);
137 gpiosetspeed(&gpio1,gpiohighspeed);
138 gpiosetdir(&gpio1,gpiooutdir);
138 gpiosetdir(&gpio1,gpiooutdir);
139 gpioclr(LCD_RESET);
139 gpioclr(LCD_RESET);
140
140
141 gpio_t LCD_DBxList[]={PD14,PD15,PD0,PD1,PE7,PE8,PE9,PE10,PE11,PE12,PE13,PE14,PE15\
141 gpio_t LCD_DBxList[]={PD14,PD15,PD0,PD1,PE7,PE8,PE9,PE10,PE11,PE12,PE13,PE14,PE15\
142 ,PD8,PD9,PD10,PD4,PD5,PD7,PE4};
142 ,PD8,PD9,PD10,PD4,PD5,PD7,PE4};
143 for(int i=0;i<20;i++)
143 for(int i=0;i<20;i++)
144 {
144 {
145 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
145 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
146 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
146 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
147 gpiosetconfig(&LCD_DBx);
147 gpiosetconfig(&LCD_DBx);
148 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
148 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
149 }
149 }
150
150
151 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
151 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
152 FSMC_NORSRAMTimingInitTypeDef p;
152 FSMC_NORSRAMTimingInitTypeDef p;
153
153
154 /* Enable FSMC clock */
154 /* Enable FSMC clock */
155 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
155 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
156
156
157 /*-- FSMC Configuration ------------------------------------------------------*/
157 /*-- FSMC Configuration ------------------------------------------------------*/
158 /*----------------------- SRAM Bank 3 ----------------------------------------*/
158 /*----------------------- SRAM Bank 3 ----------------------------------------*/
159 /* FSMC_Bank1_NORSRAM4 configuration */
159 /* FSMC_Bank1_NORSRAM4 configuration */
160 //p.FSMC_AddressSetupTime = 5;
160 //p.FSMC_AddressSetupTime = 5;
161 p.FSMC_AddressSetupTime = 1;
161 p.FSMC_AddressSetupTime = 1;
162 p.FSMC_AddressHoldTime = 0;
162 p.FSMC_AddressHoldTime = 0;
163 //p.FSMC_DataSetupTime = 9;
163 //p.FSMC_DataSetupTime = 9;
164 p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11;
164 p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11;
165 p.FSMC_BusTurnAroundDuration = 0;
165 p.FSMC_BusTurnAroundDuration = 0;
166 p.FSMC_CLKDivision = 0;
166 p.FSMC_CLKDivision = 0;
167 p.FSMC_DataLatency = 0;
167 p.FSMC_DataLatency = 0;
168 p.FSMC_AccessMode = FSMC_AccessMode_A;
168 p.FSMC_AccessMode = FSMC_AccessMode_A;
169 /* Color LCD configuration ------------------------------------
169 /* Color LCD configuration ------------------------------------
170 LCD configured as follow:
170 LCD configured as follow:
171 - Data/Address MUX = Disable
171 - Data/Address MUX = Disable
172 - Memory Type = SRAM
172 - Memory Type = SRAM
173 - Data Width = 16bit
173 - Data Width = 16bit
174 - Write Operation = Enable
174 - Write Operation = Enable
175 - Extended Mode = Enable
175 - Extended Mode = Enable
176 - Asynchronous Wait = Disable */
176 - Asynchronous Wait = Disable */
177
177
178 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
178 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
179 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
179 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
180 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
180 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
181 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
181 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
182 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
182 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
183 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
183 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
184 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
184 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
185 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
185 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
186 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
186 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
187 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
187 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
188 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
188 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
189 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
189 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
190 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
190 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
191 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
191 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
192 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
192 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
193
193
194 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
194 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
195
195
196 /* Enable FSMC NOR/SRAM Bank1 */
196 /* Enable FSMC NOR/SRAM Bank1 */
197 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
197 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
198 gpioset(LCD_RESET);
198 gpioset(LCD_RESET);
199 lcd0.init(&lcd0);
199 lcd0.init(&lcd0);
200 return 1;
200 return 1;
201 }
201 }
202
202
203 void bsp_spi_init()
203 void bsp_spi_init()
204 {
204 {
205
205
206 }
206 }
207
207
208
208
209 void bsp_iic_init()
209 void bsp_iic_init()
210 {
210 {
211 i2copenandconfig(i2c2,0,10000,PF0,PF1);
211 i2copenandconfig(i2c2,0,10000,PF0,PF1);
212 }
212 }
213
213
214 void bsp_SD_init()
214 void bsp_SD_init()
215 {
215 {
216
216
217 }
217 }
218
218
219 void vs10XXclearXCS(){}
219 void vs10XXclearXCS(){}
220 void vs10XXsetXCS(){}
220 void vs10XXsetXCS(){}
221 int vs10XXDREQ()
221 int vs10XXDREQ()
222 {
222 {
223 return 1;
223 return 1;
224 }
224 }
225
225
226
226
227 void bsppowersdcard(char onoff) //always ON
227 void bsppowersdcard(char onoff) //always ON
228 {
228 {
229
229
230 }
230 }
231
231
232 char bspsdcardpresent()
232 char bspsdcardpresent()
233 {
233 {
234 return 0;
234 return 0;
235 }
235 }
236
236
237 char bspsdcardwriteprotected()
237 char bspsdcardwriteprotected()
238 {
238 {
239 return 0;
239 return 0;
240 }
240 }
241
241
242 void bspsdcardselect(char YESNO)
242 void bspsdcardselect(char YESNO)
243 {
243 {
244
244
245 }
245 }
246
246
247
247
248 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
248 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
249 {
249 {
250 *lcd0_CMD=(uint16_t)reg;
250 *lcd0_CMD=(uint16_t)reg;
251 *lcd0_DATA=(uint16_t)data;
251 *lcd0_DATA=(uint16_t)data;
252 }
252 }
253
253
254 uint32_t bsp_lcd0_read_reg(uint32_t reg)
254 uint32_t bsp_lcd0_read_reg(uint32_t reg)
255 {
255 {
256 *lcd0_CMD=(uint16_t)reg;
256 *lcd0_CMD=(uint16_t)reg;
257 return (uint16_t)*lcd0_DATA;
257 return (uint16_t)*lcd0_DATA;
258 }
258 }
259
259
260 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
260 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
261 {
261 {
262 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
262 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
263 uint16_t* castedBuff=(uint16_t*)buffer;
263 uint16_t* castedBuff=(uint16_t*)buffer;
264 for(int i=0;i<(int)count;i++)
264 for(int i=0;i<(int)count;i++)
265 {
265 {
266 *lcd0_DATA=castedBuff[i];
266 *lcd0_DATA=castedBuff[i];
267 }
267 }
268 }
268 }
269
269
270 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
270 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
271 {
271 {
272 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
272 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
273 uint16_t* castedBuff=(uint16_t*)buffer;
273 uint16_t* castedBuff=(uint16_t*)buffer;
274 castedBuff[0]=*lcd0_DATA;
274 castedBuff[0]=*lcd0_DATA;
275 for(int i=0;i<(int)count;i++)
275 for(int i=0;i<(int)count;i++)
276 {
276 {
277 castedBuff[i]=*lcd0_DATA;
277 castedBuff[i]=*lcd0_DATA;
278 }
278 }
279 }
279 }
280
280
281
281
282 void bsp_GTerm_init()
282 void bsp_GTerm_init()
283 {
283 {
284 if(__opnfiles__[1]==NULL)
284 if(__opnfiles__[1]==NULL)
285 {
285 {
286 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
286 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
287 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
287 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
288 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_8,fd1);
288 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_8,fd1);
289 __opnfiles__[1] = fd1;
289 __opnfiles__[1] = fd1;
290 }
290 }
291 else
291 else
292 {
292 {
293
293
294 }
294 }
295 }
295 }
296
296
297
297
298
298
299
299
300
300
301
301
302
302
303
303
304
304
305
305
306
306
307
307
308
308
309
309
310
310
311
311
312
312
@@ -1,106 +1,106
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_rcc.h>
27 #include <gpio.h>
27 #include <gpio.h>
28 #include <ili9328.h>
28 #include <ili9328.h>
29 #include <genericLCD_Controler.h>
29 #include <genericLCD_Controler.h>
30
30
31 #define __MAX_OPENED_FILES__ 4
31 #define __MAX_OPENED_FILES__ 4
32 #define __FS_ROOT_SIZE__ 4
32 #define __FS_ROOT_SIZE__ 4
33 /*
33 /*
34 #ifndef PD8
34 #ifndef PD8
35 #define PD8
35 #define PD8
36 #endif
36 #endif
37 #ifndef PD9
37 #ifndef PD9
38 #define PD9
38 #define PD9
39 #endif
39 #endif
40 */
40 */
41
41
42
42
43 #define LED1 PF6
43 #define LED1 PF6
44 #define LED2 PF7
44 #define LED2 PF7
45 #define LED3 PF8
45 #define LED3 PF8
46
46
47 #define PSU_DISABLE PH2
47 #define PSU_DISABLE PH2
48 #define PSU_ALERT_5V PF2
48 #define PSU_ALERT_5V PF2
49 #define PSU_ALERT_1_5V PF3
49 #define PSU_ALERT_1_5V PF3
50 #define PSU_ALERT_3_3V PF4
50 #define PSU_ALERT_3_3V PF4
51
51
52 #define LCD_RESET PE2
52 #define LCD_RESET PE2
53
53
54 extern float VREF0;
54 extern float VREF0;
55
55
56 extern uint32_t currentCpuFreq;
56 extern uint32_t currentCpuFreq;
57 extern LCD_t lcd0;
57 extern LCD_t lcd0;
58
58
59
59
60 extern int bsp_init();
60 extern int bsp_init();
61
61
62 extern void bsp_GPIO_init();
62 extern void bsp_GPIO_init();
63 extern void bsp_uart_init();
63 extern void bsp_uart_init();
64 extern void bsp_iic_init();
64 extern void bsp_iic_init();
65 extern void bsp_spi_init();
65 extern void bsp_spi_init();
66 extern void bsp_SD_init();
66 extern void bsp_SD_init();
67 extern void bsp_GTerm_init();
67 extern void bsp_GTerm_init();
68 extern int bsp_FSMC_init();
68 extern int bsp_FSMC_init();
69
69
70 /* VS1053 */
70 /* VS1053 */
71 extern void clearXCS();
71 extern void clearXCS();
72 extern void setXCS();
72 extern void setXCS();
73 extern int vs10XXDREQ();
73 extern int vs10XXDREQ();
74
74
75 /* SD CARD */
75 /* SD CARD */
76 void bsppowersdcard(char onoff);
76 void bsppowersdcard(char onoff);
77 char bspsdcardpresent();
77 char bspsdcardpresent();
78 void bspsdcardselect(char YESNO);
78 void bspsdcardselect(char YESNO);
79 char bspsdcardwriteprotected();
79 char bspsdcardwriteprotected();
80
80
81
81
82 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
82 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
83 uint32_t bsp_lcd0_read_reg(uint32_t reg);
83 uint32_t bsp_lcd0_read_reg(uint32_t reg);
84 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
84 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
85 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
85 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
86
86
87 #endif
87 #endif
88
88
89
89
90
90
91
91
92
92
93
93
94
94
95
95
96
96
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
104
105
105
106
106
@@ -1,126 +1,126
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 uint32_t OSC0 =8000000;
28 uint32_t OSC0 =8000000;
29 uint32_t INTOSC =16000000;
29 uint32_t INTOSC =16000000;
30 uint32_t RTCOSC =32768;
30 uint32_t RTCOSC =32768;
31 uint32_t currentCpuFreq=0;
31 uint32_t currentCpuFreq=0;
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
33
33
34 float VREF0 =(float)3.3;
34 float VREF0 =(float)3.3;
35
35
36 int bsp_init()
36 int bsp_init()
37 {
37 {
38 int i=0;
38 int i=0;
39 for(i=0;i<32;i++)
39 for(i=0;i<32;i++)
40 {
40 {
41 __opnfiles__[i] = NULL;
41 __opnfiles__[i] = NULL;
42 }
42 }
43 bsp_GPIO_init();
43 bsp_GPIO_init();
44 bsp_uart_init();
44 bsp_uart_init();
45 printf("\r================================================================\n\r");
45 printf("\r================================================================\n\r");
46 printf("================================================================\n\r");
46 printf("================================================================\n\r");
47 printf(BSP);
47 printf(BSP);
48 printf(" initialised\n\r");
48 printf(" initialised\n\r");
49 printf("================================================================\n\r");
49 printf("================================================================\n\r");
50 return 1;
50 return 1;
51 }
51 }
52
52
53 void bsp_GPIO_init()
53 void bsp_GPIO_init()
54 {
54 {
55 gpio_t gpio1 = gpioopen(PC6);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
55 gpio_t gpio1 = gpioopen(PC6);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
56 gpio_t gpio2 = gpioopen(PC7);//gpioopen(LED2);
56 gpio_t gpio2 = gpioopen(PC7);//gpioopen(LED2);
57 gpiosetspeed(&gpio1,gpiohighspeed);
57 gpiosetspeed(&gpio1,gpiohighspeed);
58 gpiosetspeed(&gpio2,gpiohighspeed);
58 gpiosetspeed(&gpio2,gpiohighspeed);
59 gpiosetdir(&gpio1,gpiooutdir);
59 gpiosetdir(&gpio1,gpiooutdir);
60 gpiosetdir(&gpio2,gpiooutdir);
60 gpiosetdir(&gpio2,gpiooutdir);
61 }
61 }
62
62
63 void bsp_uart_init()
63 void bsp_uart_init()
64 {
64 {
65 if(__opnfiles__[1]==NULL)
65 if(__opnfiles__[1]==NULL)
66 {
66 {
67 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
67 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
68 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
68 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
69 uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,LED2,LED1,-1,-1);
69 uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,LED2,LED1,-1,-1);
70 uartmkstreamdev(uart,fd1);
70 uartmkstreamdev(uart,fd1);
71 __opnfiles__[1] = fd1;
71 __opnfiles__[1] = fd1;
72 }
72 }
73 else
73 else
74 {
74 {
75 uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,LED2,LED1,-1,-1);
75 uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,LED2,LED1,-1,-1);
76 }
76 }
77 }
77 }
78
78
79 void bsp_spi_init()
79 void bsp_spi_init()
80 {
80 {
81
81
82 }
82 }
83
83
84
84
85 void bsp_iic_init()
85 void bsp_iic_init()
86 {
86 {
87
87
88 }
88 }
89
89
90 void bsp_SD_init()
90 void bsp_SD_init()
91 {
91 {
92
92
93 }
93 }
94
94
95 void vs10XXclearXCS(){}
95 void vs10XXclearXCS(){}
96 void vs10XXsetXCS(){}
96 void vs10XXsetXCS(){}
97 int vs10XXDREQ()
97 int vs10XXDREQ()
98 {
98 {
99 return 1;
99 return 1;
100 }
100 }
101
101
102
102
103 void bsppowersdcard(char onoff) //always ON
103 void bsppowersdcard(char onoff) //always ON
104 {
104 {
105
105
106 }
106 }
107
107
108 char bspsdcardpresent()
108 char bspsdcardpresent()
109 {
109 {
110 return 0;
110 return 0;
111 }
111 }
112
112
113 char bspsdcardwriteprotected()
113 char bspsdcardwriteprotected()
114 {
114 {
115 return 0;
115 return 0;
116 }
116 }
117
117
118 void bspsdcardselect(char YESNO)
118 void bspsdcardselect(char YESNO)
119 {
119 {
120
120
121 }
121 }
122
122
123
123
124
124
125
125
126
126
@@ -1,86 +1,86
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_rcc.h>
27 #include <gpio.h>
27 #include <gpio.h>
28
28
29
29
30 #define __MAX_OPENED_FILES__ 32
30 #define __MAX_OPENED_FILES__ 32
31 #define __FS_ROOT_SIZE__ 32
31 #define __FS_ROOT_SIZE__ 32
32
32
33 #define LED1 PD8
33 #define LED1 PD8
34 #define LED2 PD9
34 #define LED2 PD9
35
35
36 #define LED3ON GPIOB->BSRRH = GPIO_Pin_15
36 #define LED3ON GPIOB->BSRRH = GPIO_Pin_15
37 #define LED2ON GPIOD->BSRRH = GPIO_Pin_8
37 #define LED2ON GPIOD->BSRRH = GPIO_Pin_8
38 #define LED1ON GPIOD->BSRRH = GPIO_Pin_9
38 #define LED1ON GPIOD->BSRRH = GPIO_Pin_9
39
39
40 #define LED3OFF GPIOB->BSRRL = GPIO_Pin_15
40 #define LED3OFF GPIOB->BSRRL = GPIO_Pin_15
41 #define LED2OFF GPIOD->BSRRL = GPIO_Pin_8
41 #define LED2OFF GPIOD->BSRRL = GPIO_Pin_8
42 #define LED1OFF GPIOD->BSRRL = GPIO_Pin_9
42 #define LED1OFF GPIOD->BSRRL = GPIO_Pin_9
43
43
44 extern float VREF0;
44 extern float VREF0;
45
45
46 extern uint32_t currentCpuFreq;
46 extern uint32_t currentCpuFreq;
47
47
48 extern int bsp_init();
48 extern int bsp_init();
49
49
50 extern void bsp_GPIO_init();
50 extern void bsp_GPIO_init();
51 extern void bsp_uart_init();
51 extern void bsp_uart_init();
52 extern void bsp_iic_init();
52 extern void bsp_iic_init();
53 extern void bsp_spi_init();
53 extern void bsp_spi_init();
54 extern void bsp_SD_init();
54 extern void bsp_SD_init();
55
55
56 /* VS1053 */
56 /* VS1053 */
57 extern void clearXCS();
57 extern void clearXCS();
58 extern void setXCS();
58 extern void setXCS();
59 extern int vs10XXDREQ();
59 extern int vs10XXDREQ();
60
60
61 /* SD CARD */
61 /* SD CARD */
62 void bsppowersdcard(char onoff);
62 void bsppowersdcard(char onoff);
63 char bspsdcardpresent();
63 char bspsdcardpresent();
64 void bspsdcardselect(char YESNO);
64 void bspsdcardselect(char YESNO);
65 char bspsdcardwriteprotected();
65 char bspsdcardwriteprotected();
66
66
67 #endif
67 #endif
68
68
69
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
@@ -1,143 +1,143
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <spi.h>
27 #include <spi.h>
28 #include <stdio.h>
28 #include <stdio.h>
29 #include <core.h>
29 #include <core.h>
30 uint32_t OSC0 =8000000;
30 uint32_t OSC0 =8000000;
31 uint32_t INTOSC =16000000;
31 uint32_t INTOSC =16000000;
32 uint32_t RTCOSC =32768;
32 uint32_t RTCOSC =32768;
33 uint32_t currentCpuFreq=0;
33 uint32_t currentCpuFreq=0;
34 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
34 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
35
35
36 float VREF0 =(float)3.3;
36 float VREF0 =(float)3.3;
37
37
38 int bsp_init()
38 int bsp_init()
39 {
39 {
40 int i=0;
40 int i=0;
41 for(i=0;i<32;i++)
41 for(i=0;i<32;i++)
42 {
42 {
43 __opnfiles__[i] = NULL;
43 __opnfiles__[i] = NULL;
44 }
44 }
45 bsp_GPIO_init();
45 bsp_GPIO_init();
46 bsp_uart_init();
46 bsp_uart_init();
47 bsp_spi_init();
47 bsp_spi_init();
48 printf("\r================================================================\n\r");
48 printf("\r================================================================\n\r");
49 printf("================================================================\n\r");
49 printf("================================================================\n\r");
50 printf(BSP);
50 printf(BSP);
51 printf(" initialised\n\r");
51 printf(" initialised\n\r");
52 printf("================================================================\n\r");
52 printf("================================================================\n\r");
53 return 1;
53 return 1;
54 }
54 }
55
55
56 void bsp_GPIO_init()
56 void bsp_GPIO_init()
57 {
57 {
58 gpio_t GPIOList[]={LED1,LED2,LED3,ADC_MODE0,ADC_MODE1,ADC_FSYNC
58 gpio_t GPIOList[]={LED1,LED2,LED3,ADC_MODE0,ADC_MODE1,ADC_FSYNC
59 ,ADC_SYNC,ADC_CLKDIV};
59 ,ADC_SYNC,ADC_CLKDIV};
60 gpio_t GPIOx;
60 gpio_t GPIOx;
61 for(int i=0;i<8;i++)
61 for(int i=0;i<8;i++)
62 {
62 {
63 GPIOx = gpioopen(GPIOList[i]);
63 GPIOx = gpioopen(GPIOList[i]);
64 gpiosetspeed(&GPIOx,gpiohighspeed);
64 gpiosetspeed(&GPIOx,gpiohighspeed);
65 gpiosetdir(&GPIOx,gpiooutdir);
65 gpiosetdir(&GPIOx,gpiooutdir);
66 gpiosetouttype(&GPIOx,gpiopushpulltype);
66 gpiosetouttype(&GPIOx,gpiopushpulltype);
67 }
67 }
68 gpioset(ADC_CLKDIV);
68 gpioset(ADC_CLKDIV);
69 gpioset(ADC_MODE0);
69 gpioset(ADC_MODE0);
70 gpioset(ADC_MODE1);
70 gpioset(ADC_MODE1);
71 gpioclr(ADC_SYNC);
71 gpioclr(ADC_SYNC);
72 gpioclr(ADC_FSYNC);
72 gpioclr(ADC_FSYNC);
73 delay_100us(10);
73 delay_100us(10);
74 gpioset(ADC_SYNC);
74 gpioset(ADC_SYNC);
75
75
76 }
76 }
77
77
78 void bsp_uart_init()
78 void bsp_uart_init()
79 {
79 {
80 if(__opnfiles__[1]==NULL)
80 if(__opnfiles__[1]==NULL)
81 {
81 {
82 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
82 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
83 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
83 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
84 //uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1);
84 //uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1);
85 uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
85 uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
86 uartmkstreamdev(uart,fd1);
86 uartmkstreamdev(uart,fd1);
87 __opnfiles__[1] = fd1;
87 __opnfiles__[1] = fd1;
88 }
88 }
89 else
89 else
90 {
90 {
91 // uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1);
91 // uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1);
92 uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
92 uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
93 }
93 }
94 }
94 }
95
95
96 void bsp_spi_init()
96 void bsp_spi_init()
97 {
97 {
98 spiopenandconfig(spi1,spi8bits | spimaster |spiclkinhlow | spiclkfirstedge | spimsbfirst,4000000,DAC_DIN,ADC_DOUT1,ADC_SCLK,-1);
98 spiopenandconfig(spi1,spi8bits | spimaster |spiclkinhlow | spiclkfirstedge | spimsbfirst,4000000,DAC_DIN,ADC_DOUT1,ADC_SCLK,-1);
99 }
99 }
100
100
101
101
102 void bsp_iic_init()
102 void bsp_iic_init()
103 {
103 {
104
104
105 }
105 }
106
106
107 void bsp_SD_init()
107 void bsp_SD_init()
108 {
108 {
109
109
110 }
110 }
111
111
112 void vs10XXclearXCS(){}
112 void vs10XXclearXCS(){}
113 void vs10XXsetXCS(){}
113 void vs10XXsetXCS(){}
114 int vs10XXDREQ()
114 int vs10XXDREQ()
115 {
115 {
116 return 1;
116 return 1;
117 }
117 }
118
118
119
119
120 void bsppowersdcard(char onoff) //always ON
120 void bsppowersdcard(char onoff) //always ON
121 {
121 {
122
122
123 }
123 }
124
124
125 char bspsdcardpresent()
125 char bspsdcardpresent()
126 {
126 {
127 return 0;
127 return 0;
128 }
128 }
129
129
130 char bspsdcardwriteprotected()
130 char bspsdcardwriteprotected()
131 {
131 {
132 return 0;
132 return 0;
133 }
133 }
134
134
135 void bspsdcardselect(char YESNO)
135 void bspsdcardselect(char YESNO)
136 {
136 {
137
137
138 }
138 }
139
139
140
140
141
141
142
142
143
143
@@ -1,92 +1,92
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_rcc.h>
27 #include <gpio.h>
27 #include <gpio.h>
28
28
29
29
30 #define __MAX_OPENED_FILES__ 32
30 #define __MAX_OPENED_FILES__ 32
31 #define __FS_ROOT_SIZE__ 32
31 #define __FS_ROOT_SIZE__ 32
32
32
33 #define LED1 PD9
33 #define LED1 PD9
34 #define LED2 PD8
34 #define LED2 PD8
35 #define LED3 PB15
35 #define LED3 PB15
36
36
37 #define DAC_CS PA1
37 #define DAC_CS PA1
38 #define DAC_DIN PA7
38 #define DAC_DIN PA7
39
39
40 #define ADC_MODE0 PA2
40 #define ADC_MODE0 PA2
41 #define ADC_MODE1 PA3
41 #define ADC_MODE1 PA3
42 #define ADC_FSYNC PA4
42 #define ADC_FSYNC PA4
43 #define ADC_SCLK PA5
43 #define ADC_SCLK PA5
44 #define ADC_DOUT1 PA6
44 #define ADC_DOUT1 PA6
45
45
46 #define ADC_SYNC PB10
46 #define ADC_SYNC PB10
47 #define ADC_CLKDIV PB11
47 #define ADC_CLKDIV PB11
48
48
49
49
50 extern float VREF0;
50 extern float VREF0;
51
51
52 extern uint32_t currentCpuFreq;
52 extern uint32_t currentCpuFreq;
53
53
54 extern int bsp_init();
54 extern int bsp_init();
55
55
56 extern void bsp_GPIO_init();
56 extern void bsp_GPIO_init();
57 extern void bsp_uart_init();
57 extern void bsp_uart_init();
58 extern void bsp_iic_init();
58 extern void bsp_iic_init();
59 extern void bsp_spi_init();
59 extern void bsp_spi_init();
60 extern void bsp_SD_init();
60 extern void bsp_SD_init();
61
61
62 /* VS1053 */
62 /* VS1053 */
63 extern void clearXCS();
63 extern void clearXCS();
64 extern void setXCS();
64 extern void setXCS();
65 extern int vs10XXDREQ();
65 extern int vs10XXDREQ();
66
66
67 /* SD CARD */
67 /* SD CARD */
68 void bsppowersdcard(char onoff);
68 void bsppowersdcard(char onoff);
69 char bspsdcardpresent();
69 char bspsdcardpresent();
70 void bspsdcardselect(char YESNO);
70 void bspsdcardselect(char YESNO);
71 char bspsdcardwriteprotected();
71 char bspsdcardwriteprotected();
72
72
73 #endif
73 #endif
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
88
88
89
89
90
90
91
91
92
92
@@ -1,523 +1,524
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 #include <stm32f4xx_gpio.h>
28 #include <stm32f4xx_gpio.h>
29 #include <stm32f4xx_fsmc.h>
29 #include <stm32f4xx_fsmc.h>
30 #include <i2c.h>
30 #include <i2c.h>
31 #include <core.h>
31 #include <core.h>
32 #include <terminal.h>
32 #include <terminal.h>
33
33
34 uint32_t OSC0 =8000000;
34 uint32_t OSC0 =8000000;
35 uint32_t INTOSC =16000000;
35 uint32_t INTOSC =16000000;
36 uint32_t RTCOSC =32768;
36 uint32_t RTCOSC =32768;
37 uint32_t currentCpuFreq=0;
37 uint32_t currentCpuFreq=0;
38 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
38 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
39
39
40 LCD_IF_t lcdIF0={
40 LCD_IF_t lcdIF0={
41 .init = &bsp_FSMC_init,
41 .init = &bsp_FSMC_init,
42 .writereg = &bsp_lcd0_write_reg,
42 .writereg = &bsp_lcd0_write_reg,
43 .readreg = &bsp_lcd0_read_reg,
43 .readreg = &bsp_lcd0_read_reg,
44 .writeGRAM = &bsp_lcd0_writeGRAM,
44 .writeGRAM = &bsp_lcd0_writeGRAM,
45 .readGRAM = &bsp_lcd0_readGRAM
45 .readGRAM = &bsp_lcd0_readGRAM
46 };
46 };
47
47
48 LCD_t lcd0={
48 LCD_t lcd0={
49 .interface = &lcdIF0,
49 .interface = &lcdIF0,
50 .init = &ili9328init,
50 .init = &ili9328init,
51 .paint = &ili9328paint,
51 .paint = &ili9328paint,
52 .paintText = &ili9328paintText,
52 .paintText = &ili9328paintText,
53 .paintFilRect = &ili9328paintFilRect,
53 .paintFilRect = &ili9328paintFilRect,
54 .refreshenable = &ili9328refreshenable,
54 .refreshenable = &ili9328refreshenable,
55 .width= 240,
55 .width= 240,
56 .height = 320
56 .height = 320
57 };
57 };
58
58
59 terminal_t terminal0;
59 terminal_t terminal0;
60
60
61 volatile uint8_t* lcd0_CMD=(volatile uint8_t*) 0x60000000;
61 volatile uint8_t* lcd0_CMD=(volatile uint8_t*) 0x60000000;
62 volatile uint8_t* lcd0_DATA=(volatile uint8_t*)(0x61FFFFF0);
62 volatile uint8_t* lcd0_DATA=(volatile uint8_t*)(0x61FFFFF0);
63
63
64 float VREF0 =(float)3.3;
64 float VREF0 =(float)3.3;
65 volatile vs10XXDev audioCodec0;
65 volatile vs10XXDev audioCodec0;
66
66
67 sdcardDev sdcard2;
67 sdcardDev sdcard2;
68 blkdevice sdcard2blkdev;
68 blkdevice sdcard2blkdev;
69 dikpartition sdcard2Part1;
69 dikpartition sdcard2Part1;
70 FAT32fs sdcard2FAT32part1;
70 FAT32fs sdcard2FAT32part1;
71 dikpartition sdcard2Part2;
71 dikpartition sdcard2Part2;
72 FAT32fs sdcard2FAT32part2;
72 FAT32fs sdcard2FAT32part2;
73 dikpartition sdcard2Part3;
73 dikpartition sdcard2Part3;
74 FAT32fs sdcard2FAT32part3;
74 FAT32fs sdcard2FAT32part3;
75 dikpartition sdcard2Part4;
75 dikpartition sdcard2Part4;
76 FAT32fs sdcard2FAT32part4;
76 FAT32fs sdcard2FAT32part4;
77
77
78 int bsp_init()
78 int bsp_init()
79 {
79 {
80 int i=0;
80 int i=0;
81 for(i=0;i<__MAX_OPENED_FILES__;i++)
81 for(i=0;i<__MAX_OPENED_FILES__;i++)
82 {
82 {
83 __opnfiles__[i] = NULL;
83 __opnfiles__[i] = NULL;
84 }
84 }
85 bsp_GPIO_init();
85 bsp_GPIO_init();
86 bsp_uart_init();
86 bsp_uart_init();
87 bsp_iic_init();
87 bsp_iic_init();
88 bsp_FSMC_init();
88 bsp_FSMC_init();
89 bsp_GTerm_init();
89 bsp_GTerm_init();
90 bsp_spi_init();
90 bsp_spi_init();
91 bsp_SD_init();
91 bsp_SD_init();
92 bsp_Audio_init();
92 bsp_Audio_init();
93 printf("\r=====================\n\r");
93 printf("\r=====================\n\r");
94 printf( "=====================\n\r");
94 printf( "=====================\n\r");
95 printf(BSP);
95 printf(BSP);
96 printf(" initialised\n\r");
96 printf(" initialised\n\r");
97 printf( "=====================\n\r");
97 printf( "=====================\n\r");
98 return 1;
98 return 1;
99 }
99 }
100
100
101 void bsp_GPIO_init()
101 void bsp_GPIO_init()
102 {
102 {
103 gpio_t GPIO_Out_init_List[]={LED1,LED2,LCD_RESET,LCD_BACKL,VS1053xCS,VS1053xDCS,VS1053xRESET,SDCARD2CS};
103 gpio_t GPIO_Out_init_List[]={LED1,LED2,LCD_RESET,LCD_BACKL,VS1053xCS,VS1053xDCS,VS1053xRESET,SDCARD2CS};
104 for(int i=0;i<8;i++)
104 for(int i=0;i<8;i++)
105 {
105 {
106 gpio_t GPIO_init = gpioopen(GPIO_Out_init_List[i]);
106 gpio_t GPIO_init = gpioopen(GPIO_Out_init_List[i]);
107 GPIO_init |= gpiohighspeed | gpiooutdir | gpiopushpulltype;
107 GPIO_init |= gpiohighspeed | gpiooutdir | gpiopushpulltype;
108 gpiosetconfig(&GPIO_init);
108 gpiosetconfig(&GPIO_init);
109 }
109 }
110 gpio_t GPIO_In_init_List[]={VS1053DREQ,SDCARD2CD,BP3};
110 gpio_t GPIO_In_init_List[]={VS1053DREQ,SDCARD2CD,BP3};
111 for(int i=0;i<3;i++)
111 for(int i=0;i<3;i++)
112 {
112 {
113 gpio_t GPIO_init = gpioopen(GPIO_In_init_List[i]);
113 gpio_t GPIO_init = gpioopen(GPIO_In_init_List[i]);
114 GPIO_init |= gpiohighspeed | gpioindir;
114 GPIO_init |= gpiohighspeed | gpioindir;
115 gpiosetconfig(&GPIO_init);
115 gpiosetconfig(&GPIO_init);
116 }
116 }
117 gpioclr(VS1053xRESET);
117 gpioclr(VS1053xRESET);
118 gpioset(VS1053xCS);
118 gpioset(VS1053xCS);
119 gpioset(VS1053xDCS);
119 gpioset(VS1053xDCS);
120 gpioset(SDCARD2CS);
120 gpioset(SDCARD2CS);
121 gpioclr(LCD_RESET);
121 gpioclr(LCD_RESET);
122 gpioclr(LCD_BACKL);
122 gpioclr(LCD_BACKL);
123 }
123 }
124
124
125 void bsp_uart_init()
125 void bsp_uart_init()
126 {
126 {
127 // if(__opnfiles__[1]==NULL)
127 // if(__opnfiles__[1]==NULL)
128 // {
128 // {
129 // //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
129 // //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
130 // streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
130 // streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
131 // uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PD8,PD9,-1,-1);
131 // uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PD8,PD9,-1,-1);
132 // uartmkstreamdev(uart,fd1);
132 // uartmkstreamdev(uart,fd1);
133 // __opnfiles__[1] = fd1;
133 // __opnfiles__[1] = fd1;
134 // }
134 // }
135 // else
135 // else
136 // {
136 // {
137 // uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PD8,PD9,-1,-1);
137 // uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PD8,PD9,-1,-1);
138 // }
138 // }
139 }
139 }
140
140
141 /*
141 /*
142 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
142 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
143 D5 PE8 D6 PE9 D7 PE10
143 D5 PE8 D6 PE9 D7 PE10
144 A20 PE4 = RS FSMC_NE1 PD7 CS FSMC_NWE PD5 W/S
144 A20 PE4 = RS FSMC_NE1 PD7 CS FSMC_NWE PD5 W/S
145 FSMC_NOE PD4 RD
145 FSMC_NOE PD4 RD
146 */
146 */
147
147
148 int bsp_FSMC_init()
148 int bsp_FSMC_init()
149 {
149 {
150 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
150 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
151 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
151 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
152
152
153 gpio_t LCD_DBxList[]={PD14,PD15,PD0,PD1,PE7,PE8,PE9,PE10\
153 gpio_t LCD_DBxList[]={PD14,PD15,PD0,PD1,PE7,PE8,PE9,PE10\
154 ,PD4,PD5,PD7,PE4};
154 ,PD4,PD5,PD7,PE4};
155 for(int i=0;i<12;i++)
155 for(int i=0;i<12;i++)
156 {
156 {
157 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
157 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
158 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
158 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
159 gpiosetconfig(&LCD_DBx);
159 gpiosetconfig(&LCD_DBx);
160 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
160 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
161 }
161 }
162
162
163 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
163 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
164 FSMC_NORSRAMTimingInitTypeDef p;
164 FSMC_NORSRAMTimingInitTypeDef p;
165
165
166 /* Enable FSMC clock */
166 /* Enable FSMC clock */
167 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
167 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
168
168
169 /*-- FSMC Configuration ------------------------------------------------------*/
169 /*-- FSMC Configuration ------------------------------------------------------*/
170 /*----------------------- SRAM Bank 3 ----------------------------------------*/
170 /*----------------------- SRAM Bank 3 ----------------------------------------*/
171 /* FSMC_Bank1_NORSRAM4 configuration */
171 /* FSMC_Bank1_NORSRAM4 configuration */
172 //p.FSMC_AddressSetupTime = 5;
172 //p.FSMC_AddressSetupTime = 5;
173 //p.FSMC_AddressSetupTime = 1;
173 //p.FSMC_AddressSetupTime = 1;
174 p.FSMC_AddressSetupTime = 3;
174 p.FSMC_AddressSetupTime = 3;
175 p.FSMC_AddressHoldTime = 3;
175 p.FSMC_AddressHoldTime = 3;
176 //p.FSMC_DataSetupTime = 9;
176 //p.FSMC_DataSetupTime = 9;
177 //ili9328 -> data setup time > 10ns
177 //ili9328 -> data setup time > 10ns
178 p.FSMC_DataSetupTime = 1;
178 p.FSMC_DataSetupTime = 1;
179 if(getCpuFreq()>100*1000*1000)
179 if(getCpuFreq()>100*1000*1000)
180 p.FSMC_DataSetupTime = 2;// 11;
180 p.FSMC_DataSetupTime = 2;// 11;
181 p.FSMC_BusTurnAroundDuration = 0;
181 p.FSMC_BusTurnAroundDuration = 0;
182 p.FSMC_CLKDivision = 0;
182 p.FSMC_CLKDivision = 0;
183 p.FSMC_DataLatency = 0;
183 p.FSMC_DataLatency = 0;
184 //ili9328 -> data hold time > 15ns
184 //ili9328 -> data hold time > 15ns
185 if(getCpuFreq()>66*1000*1000)
185 if(getCpuFreq()>66*1000*1000)
186 p.FSMC_DataLatency = 1;
186 p.FSMC_DataLatency = 1;
187 p.FSMC_AccessMode = FSMC_AccessMode_A;
187 p.FSMC_AccessMode = FSMC_AccessMode_A;
188
188
189 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
189 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
190 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
190 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
191 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
191 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
192 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_8b;
192 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_8b;
193 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
193 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
194 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
194 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
195 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
195 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
196 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
196 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
197 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
197 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
198 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
198 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
199 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
199 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
200 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
200 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
201 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
201 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
202 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
202 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
203 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
203 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
204
204
205 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
205 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
206
206
207 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
207 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
208 gpioset(LCD_RESET);
208 gpioset(LCD_RESET);
209 gpioclr(LCD_RESET);
209 gpioclr(LCD_RESET);
210 delay_100us(500);
210 delay_100us(500);
211 gpioset(LCD_RESET);
211 gpioset(LCD_RESET);
212 delay_100us(500);
212 delay_100us(500);
213 lcd0.init(&lcd0);
213 lcd0.init(&lcd0);
214 gpioset(LCD_BACKL);
214 gpioset(LCD_BACKL);
215 return 1;
215 return 1;
216 }
216 }
217
217
218 void bsp_spi_init()
218 void bsp_spi_init()
219 {
219 {
220 gpio_t VSSPI_DBxList[]={VS1053SCK,VS1053MOSI,VS1053MISO};
220 gpio_t VSSPI_DBxList[]={VS1053SCK,VS1053MOSI,VS1053MISO};
221 for(int i=0;i<3;i++)
221 for(int i=0;i<3;i++)
222 {
222 {
223 gpio_t SPI_DBx = gpioopen(VSSPI_DBxList[i]);
223 gpio_t SPI_DBx = gpioopen(VSSPI_DBxList[i]);
224 SPI_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
224 SPI_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
225 gpiosetconfig(&SPI_DBx);
225 gpiosetconfig(&SPI_DBx);
226 GPIO_PinAFConfig(GPIOGETPORT(SPI_DBx), (uint8_t)(SPI_DBx & 0xF), GPIO_AF_SPI1);
226 GPIO_PinAFConfig(GPIOGETPORT(SPI_DBx), (uint8_t)(SPI_DBx & 0xF), GPIO_AF_SPI1);
227 }
227 }
228 spiopenandconfig(VS1053SPI,spi8bits|spimaster|spimsbfirst,2*1000*1000,VS1053MOSI,VS1053MISO,VS1053SCK,-1);
228 spiopenandconfig(VS1053SPI,spi8bits|spimaster|spimsbfirst,2*1000*1000,VS1053MOSI,VS1053MISO,VS1053SCK,-1);
229
229
230 gpio_t SDSPI_DBxList[]={SDCARD2SCK,SDCARD2MOSI,SDCARD2MISO};
230 gpio_t SDSPI_DBxList[]={SDCARD2SCK,SDCARD2MOSI,SDCARD2MISO};
231 for(int i=0;i<3;i++)
231 for(int i=0;i<3;i++)
232 {
232 {
233 gpio_t SPI_DBx = gpioopen(SDSPI_DBxList[i]);
233 gpio_t SPI_DBx = gpioopen(SDSPI_DBxList[i]);
234 SPI_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
234 SPI_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
235 gpiosetconfig(&SPI_DBx);
235 gpiosetconfig(&SPI_DBx);
236 GPIO_PinAFConfig(GPIOGETPORT(SPI_DBx), (uint8_t)(SPI_DBx & 0xF), GPIO_AF_SPI3);
236 GPIO_PinAFConfig(GPIOGETPORT(SPI_DBx), (uint8_t)(SPI_DBx & 0xF), GPIO_AF_SPI3);
237 }
237 }
238 spiopenandconfig(SDCARD2SPI,spi8bits|spimaster|spimsbfirst,400*1000,SDCARD2MOSI,SDCARD2MISO,SDCARD2SCK,-1);
238 spiopenandconfig(SDCARD2SPI,spi8bits|spimaster|spimsbfirst,400*1000,SDCARD2MOSI,SDCARD2MISO,SDCARD2SCK,-1);
239
239
240 }
240 }
241
241
242
242
243 void bsp_iic_init()
243 void bsp_iic_init()
244 {
244 {
245 // i2copenandconfig(i2c2,0,10000,PF0,PF1);
245 // i2copenandconfig(i2c2,0,10000,PF0,PF1);
246 }
246 }
247
247
248
248
249 void bsp_Audio_init()
249 void bsp_Audio_init()
250 {
250 {
251 vs10XXopen(&audioCodec0,VS1053SPI,vs1052setXCS,vs1052setRST,vs1052setXDCS,vs10XXDREQ);
251 vs10XXopen(&audioCodec0,VS1053SPI,vs1052setXCS,vs1052setRST,vs1052setXDCS,vs10XXDREQ);
252 if(audioCodec0.VERSION!=UNKNOWN)
252 if(audioCodec0.VERSION!=UNKNOWN)
253 {
253 {
254 printf("detected Audio codec ");
254 printf("detected Audio codec ");
255 switch (audioCodec0.VERSION) {
255 switch (audioCodec0.VERSION) {
256 case VS1001:
256 case VS1001:
257 printf("VS1001\n");
257 printf("VS1001\n");
258 break;
258 break;
259 case VS1011:
259 case VS1011:
260 printf("VS1011\n");
260 printf("VS1011\n");
261 break;
261 break;
262 case VS1002:
262 case VS1002:
263 printf("VS1002\n");
263 printf("VS1002\n");
264 break;
264 break;
265 case VS1003:
265 case VS1003:
266 printf("VS1003\n");
266 printf("VS1003\n");
267 break;
267 break;
268 case VS1053:
268 case VS1053:
269 printf("VS1053\n");
269 printf("VS1053\n");
270 break;
270 break;
271 case VS1033:
271 case VS1033:
272 printf("VS1033\n");
272 printf("VS1033\n");
273 break;
273 break;
274 case VS1103:
274 case VS1103:
275 printf("VS1103\n");
275 printf("VS1103\n");
276 break;
276 break;
277 default:
277 default:
278 printf("Unknown device\n");
278 printf("Unknown device\n");
279 break;
279 break;
280 }
280 }
281 }
281 }
282 }
282 }
283
283
284 void bsp_SD_init()
284 void bsp_SD_init()
285 {
285 {
286 if(bspsdcardpresent())
286 if(bspsdcardpresent())
287 {
287 {
288 sdcardspimake(&sdcard2,(UHANDLE)SDCARD2SPI,spigetnc,spiputnc,spisetspeed,spigetspeed);
288 sdcardspimake(&sdcard2,(UHANDLE)SDCARD2SPI,spigetnc,spiputnc,spisetspeed,spigetspeed);
289 sdcardspimakeblkdev(&sdcard2blkdev,&sdcard2,bspsdcardselect,bsppowersdcard,bspsdcardpresent,bspsdcardwriteprotected);
289 sdcardspimakeblkdev(&sdcard2blkdev,&sdcard2,bspsdcardselect,bsppowersdcard,bspsdcardpresent,bspsdcardwriteprotected);
290 if(sdcard2blkdev.initialize(&sdcard2blkdev)!=STA_NOINIT)
290 if(sdcard2blkdev.initialize(&sdcard2blkdev)!=STA_NOINIT)
291 {
291 {
292 if(mbropen(&sdcard2blkdev,&sdcard2Part1,1)==MBRnoErr)
292 if(mbropen(&sdcard2blkdev,&sdcard2Part1,1)==MBRnoErr)
293 {
293 {
294 if(FATnoErr!=fat32open(&sdcard2FAT32part1,&sdcard2Part1))
294 if(FATnoErr!=fat32open(&sdcard2FAT32part1,&sdcard2Part1))
295 printf("Can't open fat32 partition 1\n");
295 printf("Can't open fat32 partition 1\n");
296 }
296 }
297 else
297 else
298 {
298 {
299 printf("Can't open or read MBR\n");
299 printf("Can't open or read MBR\n");
300 }
300 }
301
301 delay_100us(10000);
302 if(mbropen(&sdcard2blkdev,&sdcard2Part2,2)==MBRnoErr)
302 if(mbropen(&sdcard2blkdev,&sdcard2Part2,2)==MBRnoErr)
303 {
303 {
304 if(FATnoErr!=fat32open(&sdcard2FAT32part2,&sdcard2Part2))
304 if(FATnoErr!=fat32open(&sdcard2FAT32part2,&sdcard2Part2))
305 printf("Can't open fat32 partition 2\n");
305 printf("Can't open fat32 partition 2\n");
306 }
306 }
307 else
307 else
308 {
308 {
309 printf("Can't open or read MBR\n");
309 printf("Can't open or read MBR\n");
310 }
310 }
311
311 delay_100us(10000);
312 if(mbropen(&sdcard2blkdev,&sdcard2Part3,3)==MBRnoErr)
312 if(mbropen(&sdcard2blkdev,&sdcard2Part3,3)==MBRnoErr)
313 {
313 {
314 if(FATnoErr!=fat32open(&sdcard2FAT32part3,&sdcard2Part3))
314 if(FATnoErr!=fat32open(&sdcard2FAT32part3,&sdcard2Part3))
315 printf("Can't open fat32 partition 3\n");
315 printf("Can't open fat32 partition 3\n");
316 }
316 }
317 else
317 else
318 {
318 {
319 printf("Can't open or read MBR\n");
319 printf("Can't open or read MBR\n");
320 }
320 }
321
321 delay_100us(10000);
322 if(mbropen(&sdcard2blkdev,&sdcard2Part4,4)==MBRnoErr)
322 if(mbropen(&sdcard2blkdev,&sdcard2Part4,4)==MBRnoErr)
323 {
323 {
324 if(FATnoErr!=fat32open(&sdcard2FAT32part4,&sdcard2Part4))
324 if(FATnoErr!=fat32open(&sdcard2FAT32part4,&sdcard2Part4))
325 printf("Can't open fat32 partition 4\n");
325 printf("Can't open fat32 partition 4\n");
326 }
326 }
327 else
327 else
328 {
328 {
329 printf("Can't open or read MBR\n");
329 printf("Can't open or read MBR\n");
330 }
330 }
331 }
331 }
332 else
332 else
333 {
333 {
334 printf("Can't initialize SDCARD\n");
334 printf("Can't initialize SDCARD\n");
335 }
335 }
336 }
336 }
337 delay_100us(20000);
337 }
338 }
338
339
339 void vs1052setXCS(char val)
340 void vs1052setXCS(char val)
340 {
341 {
341 gpiosetval(VS1053xCS,(int)val);
342 gpiosetval(VS1053xCS,(int)val);
342 }
343 }
343
344
344 void vs1052setXDCS(char val)
345 void vs1052setXDCS(char val)
345 {
346 {
346 //gpiosetval(LED1,(int)val);
347 //gpiosetval(LED1,(int)val);
347 gpiosetval(VS1053xDCS,(int)val);
348 gpiosetval(VS1053xDCS,(int)val);
348 }
349 }
349
350
350 void vs1052setRST(char val)
351 void vs1052setRST(char val)
351 {
352 {
352 if(val)
353 if(val)
353 gpioset(VS1053xRESET);
354 gpioset(VS1053xRESET);
354 else
355 else
355 gpioclr(VS1053xRESET);
356 gpioclr(VS1053xRESET);
356 }
357 }
357
358
358 int vs10XXDREQ()
359 int vs10XXDREQ()
359 {
360 {
360 return gpiogetval(VS1053DREQ);
361 return gpiogetval(VS1053DREQ);
361 }
362 }
362
363
363
364
364 void bsppowersdcard(char onoff) //always ON
365 void bsppowersdcard(char onoff) //always ON
365 {
366 {
366
367
367 }
368 }
368
369
369 char bspsdcardpresent()
370 char bspsdcardpresent()
370 {
371 {
371 return gpiogetval(SDCARD2CD);
372 return gpiogetval(SDCARD2CD);
372 }
373 }
373
374
374 char bspsdcardwriteprotected()
375 char bspsdcardwriteprotected()
375 {
376 {
376 return 0;
377 return 0;
377 }
378 }
378
379
379 void bspsdcardselect(char YESNO)
380 void bspsdcardselect(char YESNO)
380 {
381 {
381 // gpiosetval(LED1,(int)YESNO);
382 // gpiosetval(LED1,(int)YESNO);
382 if(YESNO)
383 if(YESNO)
383 gpioclr(SDCARD2CS);
384 gpioclr(SDCARD2CS);
384 else
385 else
385 gpioset(SDCARD2CS);
386 gpioset(SDCARD2CS);
386 }
387 }
387
388
388
389
389 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
390 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
390 {
391 {
391 uint8_t* pt8 = (uint8_t*)(void*)&reg;
392 uint8_t* pt8 = (uint8_t*)(void*)&reg;
392 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
393 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
393 *lcd0_CMD=pt8[3];
394 *lcd0_CMD=pt8[3];
394 *lcd0_CMD=pt8[2];
395 *lcd0_CMD=pt8[2];
395 pt8 = (uint8_t*)(void*)&data;
396 pt8 = (uint8_t*)(void*)&data;
396 *lcd0_DATA=pt8[3];
397 *lcd0_DATA=pt8[3];
397 *lcd0_DATA=pt8[2];
398 *lcd0_DATA=pt8[2];
398 #else
399 #else
399 *lcd0_CMD=pt8[1];
400 *lcd0_CMD=pt8[1];
400 *lcd0_CMD=pt8[0];
401 *lcd0_CMD=pt8[0];
401 pt8 = (uint8_t*)(void*)&data;
402 pt8 = (uint8_t*)(void*)&data;
402 *lcd0_DATA=pt8[1];
403 *lcd0_DATA=pt8[1];
403 *lcd0_DATA=pt8[0];
404 *lcd0_DATA=pt8[0];
404 #endif
405 #endif
405
406
406 }
407 }
407
408
408 uint32_t bsp_lcd0_read_reg(uint32_t reg)
409 uint32_t bsp_lcd0_read_reg(uint32_t reg)
409 {
410 {
410 uint8_t* pt8 = (uint8_t*)(void*)&reg;
411 uint8_t* pt8 = (uint8_t*)(void*)&reg;
411 uint32_t DATA=0;
412 uint32_t DATA=0;
412 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
413 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
413 *lcd0_CMD=pt8[3];
414 *lcd0_CMD=pt8[3];
414 *lcd0_CMD=pt8[2];
415 *lcd0_CMD=pt8[2];
415 pt8 = (uint8_t*)(void*)&DATA;
416 pt8 = (uint8_t*)(void*)&DATA;
416 pt8[3]=*lcd0_DATA;
417 pt8[3]=*lcd0_DATA;
417 pt8[2]=*lcd0_DATA;
418 pt8[2]=*lcd0_DATA;
418 #else
419 #else
419
420
420 *lcd0_CMD=pt8[1];
421 *lcd0_CMD=pt8[1];
421 *lcd0_CMD=pt8[0];
422 *lcd0_CMD=pt8[0];
422 pt8 = (uint8_t*)(void*)&DATA;
423 pt8 = (uint8_t*)(void*)&DATA;
423 pt8[1]=*lcd0_DATA;
424 pt8[1]=*lcd0_DATA;
424 pt8[0]=*lcd0_DATA;
425 pt8[0]=*lcd0_DATA;
425 #endif
426 #endif
426
427
427 return DATA;
428 return DATA;
428 }
429 }
429
430
430 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
431 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
431 {
432 {
432 uint32_t reg =ILI9328_REGISTER_WRITEDATATOGRAM;
433 uint32_t reg =ILI9328_REGISTER_WRITEDATATOGRAM;
433 uint8_t* pt8 = (uint8_t*)(void*)&reg;
434 uint8_t* pt8 = (uint8_t*)(void*)&reg;
434 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
435 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
435 *lcd0_CMD=pt8[3];
436 *lcd0_CMD=pt8[3];
436 *lcd0_CMD=pt8[2];
437 *lcd0_CMD=pt8[2];
437 pt8 = (uint8_t*)(void*)buffer;
438 pt8 = (uint8_t*)(void*)buffer;
438 for(int i=0;i<(int)count;i++)
439 for(int i=0;i<(int)count;i++)
439 {
440 {
440 *lcd0_DATA=pt8[(2*i) +1];
441 *lcd0_DATA=pt8[(2*i) +1];
441 *lcd0_DATA=pt8[2*i];
442 *lcd0_DATA=pt8[2*i];
442 }
443 }
443 #else
444 #else
444
445
445 *lcd0_CMD=pt8[1];
446 *lcd0_CMD=pt8[1];
446 *lcd0_CMD=pt8[0];
447 *lcd0_CMD=pt8[0];
447 pt8 = (uint8_t*)(void*)buffer;
448 pt8 = (uint8_t*)(void*)buffer;
448 for(int i=0;i<(int)count;i++)
449 for(int i=0;i<(int)count;i++)
449 {
450 {
450
451
451 *lcd0_DATA=pt8[(2*i) +1];
452 *lcd0_DATA=pt8[(2*i) +1];
452 *lcd0_DATA=pt8[2*i];
453 *lcd0_DATA=pt8[2*i];
453 }
454 }
454 #endif
455 #endif
455 }
456 }
456
457
457 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
458 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
458 {
459 {
459 // uint32_t reg =ILI9328_REGISTER_WRITEDATATOGRAM;
460 // uint32_t reg =ILI9328_REGISTER_WRITEDATATOGRAM;
460 // int8_t* pt8 = (int8_t*)(void*)&reg;
461 // int8_t* pt8 = (int8_t*)(void*)&reg;
461 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
462 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
462 *lcd0_CMD=pt8[3];
463 *lcd0_CMD=pt8[3];
463 *lcd0_CMD=pt8[2];
464 *lcd0_CMD=pt8[2];
464 pt8 = (uint8_t*)(void*)buffer;
465 pt8 = (uint8_t*)(void*)buffer;
465 for(int i=0;i<(int)count;i++)
466 for(int i=0;i<(int)count;i++)
466 {
467 {
467 pt8[(2*i) +1]=*lcd0_DATA;
468 pt8[(2*i) +1]=*lcd0_DATA;
468 __asm__("nop");
469 __asm__("nop");
469 __asm__("nop");
470 __asm__("nop");
470 __asm__("nop");
471 __asm__("nop");
471 __asm__("nop");
472 __asm__("nop");
472 __asm__("nop");
473 __asm__("nop");
473 pt8[2*i]=*lcd0_DATA;
474 pt8[2*i]=*lcd0_DATA;
474 }
475 }
475 #else
476 #else
476 // lcd0_CMD=pt8[1];
477 // lcd0_CMD=pt8[1];
477 // lcd0_CMD=pt8[0];
478 // lcd0_CMD=pt8[0];
478 // pt8 = (int8_t*)(void*)buffer;
479 // pt8 = (int8_t*)(void*)buffer;
479 // for(int i=0;i<(int)count;i++)
480 // for(int i=0;i<(int)count;i++)
480 // {
481 // {
481 // pt8[(2*i) +1]=*lcd0_DATA;
482 // pt8[(2*i) +1]=*lcd0_DATA;
482 // __asm__("nop");
483 // __asm__("nop");
483 // __asm__("nop");
484 // __asm__("nop");
484 // __asm__("nop");
485 // __asm__("nop");
485 // __asm__("nop");
486 // __asm__("nop");
486 // __asm__("nop");
487 // __asm__("nop");
487 // pt8[2*i]=*lcd0_DATA;
488 // pt8[2*i]=*lcd0_DATA;
488 //pt8[(2*i) +1]=(uint8_t)0;
489 //pt8[(2*i) +1]=(uint8_t)0;
489 //pt8[(2*i)]=(uint8_t)0;
490 //pt8[(2*i)]=(uint8_t)0;
490 // }
491 // }
491 #endif
492 #endif
492 }
493 }
493
494
494 void bsp_GTerm_init()
495 void bsp_GTerm_init()
495 {
496 {
496 if(__opnfiles__[1]==NULL)
497 if(__opnfiles__[1]==NULL)
497 {
498 {
498 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
499 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
499 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_18,fd1);
500 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_8,fd1);
500 __opnfiles__[1] = fd1;
501 __opnfiles__[1] = fd1;
501 }
502 }
502 else
503 else
503 {
504 {
504
505
505 }
506 }
506 }
507 }
507
508
508
509
509
510
510
511
511
512
512
513
513
514
514
515
515
516
516
517
517
518
518
519
519
520
520
521
521
522
522
523
523
524
@@ -1,133 +1,133
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_rcc.h>
27 #include <gpio.h>
27 #include <gpio.h>
28 #include <spi.h>
28 #include <spi.h>
29 #include <ili9328.h>
29 #include <ili9328.h>
30 #include <genericLCD_Controler.h>
30 #include <genericLCD_Controler.h>
31 #include <sdcard-spi.h>
31 #include <sdcard-spi.h>
32 #include <sdcard.h>
32 #include <sdcard.h>
33 #include <mbr.h>
33 #include <mbr.h>
34 #include <VS10XX.h>
34 #include <VS10XX.h>
35 #include <fat32.h>
35 #include <fat32.h>
36
36
37 #define __MAX_OPENED_FILES__ 4
37 #define __MAX_OPENED_FILES__ 4
38 #define __FS_ROOT_SIZE__ 4
38 #define __FS_ROOT_SIZE__ 4
39
39
40
40
41 #define LED1 PC15
41 #define LED1 PC15
42 #define LED2 PC14
42 #define LED2 PC14
43
43
44 #define BP3 PA0
44 #define BP3 PA0
45
45
46 #define LCD_RESET PD10
46 #define LCD_RESET PD10
47 #define LCD_BACKL PE11
47 #define LCD_BACKL PE11
48
48
49 #define VS1053SPI spi1
49 #define VS1053SPI spi1
50 #define VS1053xCS PA3
50 #define VS1053xCS PA3
51 #define VS1053xRESET PA2
51 #define VS1053xRESET PA2
52 #define VS1053xDCS PA4
52 #define VS1053xDCS PA4
53 #define VS1053DREQ PA1
53 #define VS1053DREQ PA1
54 #define VS1053MISO PA6
54 #define VS1053MISO PA6
55 #define VS1053MOSI PA7
55 #define VS1053MOSI PA7
56 #define VS1053SCK PA5
56 #define VS1053SCK PA5
57
57
58
58
59
59
60 #define SDCARD2SPI spi3
60 #define SDCARD2SPI spi3
61 #define SDCARD2CS PB8
61 #define SDCARD2CS PB8
62 #define SDCARD2CD PB9
62 #define SDCARD2CD PB9
63 #define SDCARD2MISO PB4
63 #define SDCARD2MISO PB4
64 #define SDCARD2MOSI PB5
64 #define SDCARD2MOSI PB5
65 #define SDCARD2SCK PB3
65 #define SDCARD2SCK PB3
66
66
67 extern float VREF0;
67 extern float VREF0;
68
68
69 extern uint32_t currentCpuFreq;
69 extern uint32_t currentCpuFreq;
70 extern LCD_t lcd0;
70 extern LCD_t lcd0;
71
71
72 extern volatile vs10XXDev audioCodec0;
72 extern volatile vs10XXDev audioCodec0;
73
73
74 extern sdcardDev sdcard2;
74 extern sdcardDev sdcard2;
75 extern blkdevice sdcard2blkdev;
75 extern blkdevice sdcard2blkdev;
76 extern dikpartition sdcard2Part1;
76 extern dikpartition sdcard2Part1;
77 extern FAT32fs sdcard2FAT32part1;
77 extern FAT32fs sdcard2FAT32part1;
78 extern dikpartition sdcard2Part2;
78 extern dikpartition sdcard2Part2;
79 extern FAT32fs sdcard2FAT32part2;
79 extern FAT32fs sdcard2FAT32part2;
80 extern dikpartition sdcard2Part3;
80 extern dikpartition sdcard2Part3;
81 extern FAT32fs sdcard2FAT32part3;
81 extern FAT32fs sdcard2FAT32part3;
82 extern dikpartition sdcard2Part4;
82 extern dikpartition sdcard2Part4;
83 extern FAT32fs sdcard2FAT32part4;
83 extern FAT32fs sdcard2FAT32part4;
84
84
85 extern int bsp_init();
85 extern int bsp_init();
86
86
87 extern void bsp_GPIO_init();
87 extern void bsp_GPIO_init();
88 extern void bsp_uart_init();
88 extern void bsp_uart_init();
89 extern void bsp_iic_init();
89 extern void bsp_iic_init();
90 extern void bsp_spi_init();
90 extern void bsp_spi_init();
91 extern void bsp_SD_init();
91 extern void bsp_SD_init();
92 extern void bsp_Audio_init();
92 extern void bsp_Audio_init();
93 extern void bsp_GTerm_init();
93 extern void bsp_GTerm_init();
94 extern int bsp_FSMC_init();
94 extern int bsp_FSMC_init();
95
95
96 /* VS1053 */
96 /* VS1053 */
97 extern void vs1052setXCS(char val);
97 extern void vs1052setXCS(char val);
98 extern void vs1052setXDCS(char val);
98 extern void vs1052setXDCS(char val);
99 extern void vs1052setRST(char val);
99 extern void vs1052setRST(char val);
100 extern int vs10XXDREQ();
100 extern int vs10XXDREQ();
101
101
102 /* SD CARD */
102 /* SD CARD */
103 void bsppowersdcard(char onoff);
103 void bsppowersdcard(char onoff);
104 char bspsdcardpresent();
104 char bspsdcardpresent();
105 void bspsdcardselect(char YESNO);
105 void bspsdcardselect(char YESNO);
106 char bspsdcardwriteprotected();
106 char bspsdcardwriteprotected();
107
107
108
108
109 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
109 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
110 uint32_t bsp_lcd0_read_reg(uint32_t reg);
110 uint32_t bsp_lcd0_read_reg(uint32_t reg);
111 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
111 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
112 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
112 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
113
113
114 #endif
114 #endif
115
115
116
116
117
117
118
118
119
119
120
120
121
121
122
122
123
123
124
124
125
125
126
126
127
127
128
128
129
129
130
130
131
131
132
132
133
133
@@ -1,282 +1,283
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <stdio.h>
25 #include <stdio.h>
26
26
27
27
28 uint32_t OSC0 =8000000;
28 uint32_t OSC0 =8000000;
29 uint32_t INTOSC =16000000;
29 uint32_t INTOSC =16000000;
30 uint32_t RTCOSC =32768;
30 uint32_t RTCOSC =32768;
31 uint32_t currentCpuFreq=0;
31 uint32_t currentCpuFreq=0;
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
33
33
34
34
35 LCD_IF_t lcdIF0={
35 LCD_IF_t lcdIF0={
36 .init = &SDLCD_init,
36 .init = &SDLCD_init,
37 .writereg = &SDLCD_writereg,
37 .writereg = &SDLCD_writereg,
38 .readreg = &SDLCD_readreg,
38 .readreg = &SDLCD_readreg,
39 .writeGRAM = &SDLCD_writeGRAM,
39 .writeGRAM = &SDLCD_writeGRAM_16bpp,
40 .readGRAM = &SDLCD_readGRAM
40 .readGRAM = &SDLCD_readGRAM_16bpp
41 };
41 };
42
42
43 LCD_t lcd0={
43 LCD_t lcd0={
44 .interface = &lcdIF0,
44 .interface = &lcdIF0,
45 .init = &ili9328init,
45 .init = &ili9328init,
46 .paint = &ili9328paint,
46 .paint = &ili9328paint,
47 .paintText = &ili9328paintText,
47 .paintText = &ili9328paintText,
48 .paintFilRect = &ili9328paintFilRect,
48 .paintFilRect = &ili9328paintFilRect,
49 .refreshenable = &ili9328refreshenable,
49 .refreshenable = &ili9328refreshenable,
50 .width= 240,
50 .width= 240,
51 .height = 320
51 .height = 320
52 };
52 };
53
53
54 terminal_t terminal0;
54 terminal_t terminal0;
55
55
56 volatile int8_t* lcd0_CMD=(volatile int8_t*) 0x60000000;
56 volatile int8_t* lcd0_CMD=(volatile int8_t*) 0x60000000;
57 volatile int8_t* lcd0_DATA=(volatile int8_t*)(0x61FFFFF0);
57 volatile int8_t* lcd0_DATA=(volatile int8_t*)(0x61FFFFF0);
58
58
59 float VREF0 =(float)3.3;
59 float VREF0 =(float)3.3;
60 volatile vs10XXDev audioCodec0;
60 volatile vs10XXDev audioCodec0;
61
61
62 sdcardDev sdcard2;
62 sdcardDev sdcard2;
63 blkdevice sdcard2blkdev;
63 blkdevice sdcard2blkdev;
64 dikpartition sdcard2Part1;
64 dikpartition sdcard2Part1;
65 FAT32fs sdcard2FAT32part1;
65 FAT32fs sdcard2FAT32part1;
66 dikpartition sdcard2Part2;
66 dikpartition sdcard2Part2;
67 FAT32fs sdcard2FAT32part2;
67 FAT32fs sdcard2FAT32part2;
68 dikpartition sdcard2Part3;
68 dikpartition sdcard2Part3;
69 FAT32fs sdcard2FAT32part3;
69 FAT32fs sdcard2FAT32part3;
70 dikpartition sdcard2Part4;
70 dikpartition sdcard2Part4;
71 FAT32fs sdcard2FAT32part4;
71 FAT32fs sdcard2FAT32part4;
72
72
73 int bsp_init()
73 int bsp_init()
74 {
74 {
75 int i=0;
75 int i=0;
76 for(i=0;i<__MAX_OPENED_FILES__;i++)
76 for(i=0;i<__MAX_OPENED_FILES__;i++)
77 {
77 {
78 __opnfiles__[i] = NULL;
78 __opnfiles__[i] = NULL;
79 }
79 }
80 bsp_GPIO_init();
80 bsp_GPIO_init();
81 bsp_uart_init();
81 bsp_uart_init();
82 bsp_iic_init();
82 bsp_iic_init();
83 bsp_FSMC_init();
83 bsp_FSMC_init();
84 bsp_GTerm_init();
84 bsp_GTerm_init();
85 bsp_spi_init();
85 bsp_spi_init();
86 bsp_SD_init();
86 bsp_SD_init();
87 bsp_Audio_init();
87 bsp_Audio_init();
88 printf("\r=====================\n\r");
88 printf("\r=====================\n\r");
89 printf( "=====================\n\r");
89 printf( "=====================\n\r");
90 printf(BSP);
90 printf(BSP);
91 printf(" initialised\n\r");
91 printf(" initialised\n\r");
92 printf( "=====================\n\r");
92 printf( "=====================\n\r");
93 return 1;
93 return 1;
94 }
94 }
95
95
96 void bsp_GPIO_init()
96 void bsp_GPIO_init()
97 {
97 {
98
98
99 }
99 }
100
100
101 void bsp_uart_init()
101 void bsp_uart_init()
102 {
102 {
103
103
104 }
104 }
105
105
106 /*
106 /*
107 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
107 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
108 D5 PE8 D6 PE9 D7 PE10
108 D5 PE8 D6 PE9 D7 PE10
109 A20 PE4 = RS FSMC_NE1 PD7 CS FSMC_NWE PD5 W/S
109 A20 PE4 = RS FSMC_NE1 PD7 CS FSMC_NWE PD5 W/S
110 FSMC_NOE PD4 RD
110 FSMC_NOE PD4 RD
111 */
111 */
112
112
113 int bsp_FSMC_init()
113 int bsp_FSMC_init()
114 {
114 {
115
115
116 return 1;
116 return 1;
117 }
117 }
118
118
119 void bsp_spi_init()
119 void bsp_spi_init()
120 {
120 {
121
121
122 }
122 }
123
123
124
124
125 void bsp_iic_init()
125 void bsp_iic_init()
126 {
126 {
127
127
128 }
128 }
129
129
130
130
131 void bsp_Audio_init()
131 void bsp_Audio_init()
132 {
132 {
133
133
134 }
134 }
135
135
136 void bsp_SD_init()
136 void bsp_SD_init()
137 {
137 {
138
138
139 }
139 }
140
140
141 void vs1052setXCS(char val)
141 void vs1052setXCS(char val)
142 {
142 {
143 }
143 }
144
144
145 void vs1052setXDCS(char val)
145 void vs1052setXDCS(char val)
146 {
146 {
147 }
147 }
148
148
149 void vs1052setRST(char val)
149 void vs1052setRST(char val)
150 {
150 {
151 }
151 }
152
152
153 int vs10XXDREQ()
153 int vs10XXDREQ()
154 {
154 {
155 return 1;
155 return 1;
156 }
156 }
157
157
158
158
159 void bsppowersdcard(char onoff) //always ON
159 void bsppowersdcard(char onoff) //always ON
160 {
160 {
161
161
162 }
162 }
163
163
164 char bspsdcardpresent()
164 char bspsdcardpresent()
165 {
165 {
166 return 1;
166 return 1;
167 }
167 }
168
168
169 char bspsdcardwriteprotected()
169 char bspsdcardwriteprotected()
170 {
170 {
171 return 0;
171 return 0;
172 }
172 }
173
173
174 void bspsdcardselect(char YESNO)
174 void bspsdcardselect(char YESNO)
175 {
175 {
176
176
177 }
177 }
178
178
179
179
180 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
180 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
181 {
181 {
182
182
183 }
183 }
184
184
185 uint32_t bsp_lcd0_read_reg(uint32_t reg)
185 uint32_t bsp_lcd0_read_reg(uint32_t reg)
186 {
186 {
187 return 0;
187 return 0;
188 }
188 }
189
189
190 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
190 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
191 {
191 {
192
192
193 }
193 }
194
194
195 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
195 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
196 {
196 {
197
197
198 }
198 }
199
199
200 void bsp_GTerm_init()
200 void bsp_GTerm_init()
201 {
201 {
202 SDLCD_mkscreen(240,320,16,LCDILI9328);
202 SDLCD_mkscreen(240,320,16,LCDILI9328);
203
203
204 if(__opnfiles__[1]==NULL)
204 if(__opnfiles__[1]==NULL)
205 {
205 {
206 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
206 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
207 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_18,fd1);
207 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_18,fd1);
208 lcd0.paintFilRect(&lcd0,0,0,240,320,0,0,0x0f0f);
208 __opnfiles__[1] = fd1;
209 __opnfiles__[1] = fd1;
209 }
210 }
210 else
211 else
211 {
212 {
212
213
213 }
214 }
214 }
215 }
215
216
216
217
217
218
218
219
219
220
220
221
221
222
222 void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
223 void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
223 {
224 {
224 int bpp = surface->format->BytesPerPixel;
225 int bpp = surface->format->BytesPerPixel;
225 /* Here p is the address to the pixel we want to set */
226 /* Here p is the address to the pixel we want to set */
226 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
227 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
227 switch(bpp) {
228 switch(bpp) {
228 case 1:
229 case 1:
229 *p = pixel;
230 *p = pixel;
230 break;
231 break;
231 case 2:
232 case 2:
232 *(Uint16 *)p = pixel;
233 *(Uint16 *)p = pixel;
233 break;
234 break;
234 case 3:
235 case 3:
235 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
236 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
236 p[0] = (pixel >> 16) & 0xff;
237 p[0] = (pixel >> 16) & 0xff;
237 p[1] = (pixel >> 8) & 0xff;
238 p[1] = (pixel >> 8) & 0xff;
238 p[2] = pixel & 0xff;
239 p[2] = pixel & 0xff;
239 } else {
240 } else {
240 p[0] = pixel & 0xff;
241 p[0] = pixel & 0xff;
241 p[1] = (pixel >> 8) & 0xff;
242 p[1] = (pixel >> 8) & 0xff;
242 p[2] = (pixel >> 16) & 0xff;
243 p[2] = (pixel >> 16) & 0xff;
243 }
244 }
244 break;
245 break;
245 case 4:
246 case 4:
246 *(Uint32 *)p = pixel;
247 *(Uint32 *)p = pixel;
247 break;
248 break;
248 }
249 }
249 }
250 }
250
251
251 Uint32 getpixel(SDL_Surface *surface, int x, int y)
252 Uint32 getpixel(SDL_Surface *surface, int x, int y)
252 {
253 {
253 int bpp = surface->format->BytesPerPixel;
254 int bpp = surface->format->BytesPerPixel;
254 /* Here p is the address to the pixel we want to retrieve */
255 /* Here p is the address to the pixel we want to retrieve */
255 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
256 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
256 switch(bpp) {
257 switch(bpp) {
257 case 1:
258 case 1:
258 return *p;
259 return *p;
259 case 2:
260 case 2:
260 return *(Uint16 *)p;
261 return *(Uint16 *)p;
261 case 3:
262 case 3:
262 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
263 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
263 return p[0] << 16 | p[1] << 8 | p[2];
264 return p[0] << 16 | p[1] << 8 | p[2];
264 else
265 else
265 return p[0] | p[1] << 8 | p[2] << 16;
266 return p[0] | p[1] << 8 | p[2] << 16;
266 case 4:
267 case 4:
267 return *(Uint32 *)p;
268 return *(Uint32 *)p;
268 default:
269 default:
269 return 0;
270 return 0;
270 }
271 }
271 /* shouldn’t happen, but avoids warnings */
272 /* shouldn’t happen, but avoids warnings */
272 }
273 }
273
274
274
275
275
276
276
277
277
278
278
279
279
280
280
281
281
282
282
283
@@ -1,139 +1,139
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <gpio.h>
24 #include <gpio.h>
25 #include <spi.h>
25 #include <spi.h>
26 #include <ili9328.h>
26 #include <ili9328.h>
27 #include <genericLCD_Controler.h>
27 #include <genericLCD_Controler.h>
28 #include <sdcard-spi.h>
28 #include <sdcard-spi.h>
29 #include <terminal.h>
29 #include <terminal.h>
30 #include <sdcard.h>
30 #include <sdcard.h>
31 #include <mbr.h>
31 #include <mbr.h>
32 #include <VS10XX.h>
32 #include <VS10XX.h>
33 #include <fat32.h>
33 #include <fat32.h>
34 #include <SDL.h>
34 #include <SDL.h>
35 #include <stdint.h>
35 #include <stdint.h>
36 #include <SDLCD.h>
36 #include <SDLCD.h>
37
37
38
38
39 #define __MAX_OPENED_FILES__ 4
39 #define __MAX_OPENED_FILES__ 4
40 #define __FS_ROOT_SIZE__ 4
40 #define __FS_ROOT_SIZE__ 4
41
41
42
42
43 #define LED1 PC15
43 #define LED1 PC15
44 #define LED2 PC14
44 #define LED2 PC14
45
45
46 #define BP3 PA0
46 #define BP3 PA0
47
47
48 #define LCD_RESET PD10
48 #define LCD_RESET PD10
49 #define LCD_BACKL PE11
49 #define LCD_BACKL PE11
50
50
51 #define VS1053SPI spi1
51 #define VS1053SPI spi1
52 #define VS1053xCS PA3
52 #define VS1053xCS PA3
53 #define VS1053xRESET PA2
53 #define VS1053xRESET PA2
54 #define VS1053xDCS PA4
54 #define VS1053xDCS PA4
55 #define VS1053DREQ PA1
55 #define VS1053DREQ PA1
56 #define VS1053MISO PA6
56 #define VS1053MISO PA6
57 #define VS1053MOSI PA7
57 #define VS1053MOSI PA7
58 #define VS1053SCK PA5
58 #define VS1053SCK PA5
59
59
60
60
61
61
62 #define SDCARD2SPI spi3
62 #define SDCARD2SPI spi3
63 #define SDCARD2CS PB8
63 #define SDCARD2CS PB8
64 #define SDCARD2CD PB9
64 #define SDCARD2CD PB9
65 #define SDCARD2MISO PB4
65 #define SDCARD2MISO PB4
66 #define SDCARD2MOSI PB5
66 #define SDCARD2MOSI PB5
67 #define SDCARD2SCK PB3
67 #define SDCARD2SCK PB3
68
68
69 extern float VREF0;
69 extern float VREF0;
70
70
71 extern uint32_t currentCpuFreq;
71 extern uint32_t currentCpuFreq;
72 extern LCD_t lcd0;
72 extern LCD_t lcd0;
73
73
74 extern volatile vs10XXDev audioCodec0;
74 extern volatile vs10XXDev audioCodec0;
75
75
76 extern sdcardDev sdcard2;
76 extern sdcardDev sdcard2;
77 extern blkdevice sdcard2blkdev;
77 extern blkdevice sdcard2blkdev;
78 extern dikpartition sdcard2Part1;
78 extern dikpartition sdcard2Part1;
79 extern FAT32fs sdcard2FAT32part1;
79 extern FAT32fs sdcard2FAT32part1;
80 extern dikpartition sdcard2Part2;
80 extern dikpartition sdcard2Part2;
81 extern FAT32fs sdcard2FAT32part2;
81 extern FAT32fs sdcard2FAT32part2;
82 extern dikpartition sdcard2Part3;
82 extern dikpartition sdcard2Part3;
83 extern FAT32fs sdcard2FAT32part3;
83 extern FAT32fs sdcard2FAT32part3;
84 extern dikpartition sdcard2Part4;
84 extern dikpartition sdcard2Part4;
85 extern FAT32fs sdcard2FAT32part4;
85 extern FAT32fs sdcard2FAT32part4;
86
86
87 extern int bsp_init();
87 extern int bsp_init();
88
88
89 extern void bsp_GPIO_init();
89 extern void bsp_GPIO_init();
90 extern void bsp_uart_init();
90 extern void bsp_uart_init();
91 extern void bsp_iic_init();
91 extern void bsp_iic_init();
92 extern void bsp_spi_init();
92 extern void bsp_spi_init();
93 extern void bsp_SD_init();
93 extern void bsp_SD_init();
94 extern void bsp_Audio_init();
94 extern void bsp_Audio_init();
95 extern void bsp_GTerm_init();
95 extern void bsp_GTerm_init();
96 extern int bsp_FSMC_init();
96 extern int bsp_FSMC_init();
97
97
98 /* VS1053 */
98 /* VS1053 */
99 extern void vs1052setXCS(char val);
99 extern void vs1052setXCS(char val);
100 extern void vs1052setXDCS(char val);
100 extern void vs1052setXDCS(char val);
101 extern void vs1052setRST(char val);
101 extern void vs1052setRST(char val);
102 extern int vs10XXDREQ();
102 extern int vs10XXDREQ();
103
103
104 /* SD CARD */
104 /* SD CARD */
105 void bsppowersdcard(char onoff);
105 void bsppowersdcard(char onoff);
106 char bspsdcardpresent();
106 char bspsdcardpresent();
107 void bspsdcardselect(char YESNO);
107 void bspsdcardselect(char YESNO);
108 char bspsdcardwriteprotected();
108 char bspsdcardwriteprotected();
109
109
110
110
111 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
111 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
112 uint32_t bsp_lcd0_read_reg(uint32_t reg);
112 uint32_t bsp_lcd0_read_reg(uint32_t reg);
113 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
113 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
114 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
114 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
115
115
116
116
117 extern void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
117 extern void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
118 extern Uint32 getpixel(SDL_Surface *surface, int x, int y);
118 extern Uint32 getpixel(SDL_Surface *surface, int x, int y);
119
119
120 #endif
120 #endif
121
121
122
122
123
123
124
124
125
125
126
126
127
127
128
128
129
129
130
130
131
131
132
132
133
133
134
134
135
135
136
136
137
137
138
138
139
139
@@ -1,140 +1,140
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 #include <i2c.h>
28 #include <i2c.h>
29
29
30 uint32_t OSC0 =8000000;
30 uint32_t OSC0 =8000000;
31 uint32_t INTOSC =16000000;
31 uint32_t INTOSC =16000000;
32 uint32_t RTCOSC =32768;
32 uint32_t RTCOSC =32768;
33 uint32_t currentCpuFreq=0;
33 uint32_t currentCpuFreq=0;
34 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
34 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
35
35
36 float VREF0 =(float)3.3;
36 float VREF0 =(float)3.3;
37
37
38 int bsp_init()
38 int bsp_init()
39 {
39 {
40 int i=0;
40 int i=0;
41 for(i=0;i<32;i++)
41 for(i=0;i<32;i++)
42 {
42 {
43 __opnfiles__[i] = NULL;
43 __opnfiles__[i] = NULL;
44 }
44 }
45 bsp_GPIO_init();
45 bsp_GPIO_init();
46 bsp_uart_init();
46 bsp_uart_init();
47 bsp_iic_init();
47 bsp_iic_init();
48 printf("\r================================================================\n\r");
48 printf("\r================================================================\n\r");
49 printf("================================================================\n\r");
49 printf("================================================================\n\r");
50 printf(BSP);
50 printf(BSP);
51 printf(" initialised\n\r");
51 printf(" initialised\n\r");
52 printf("================================================================\n\r");
52 printf("================================================================\n\r");
53 return 1;
53 return 1;
54 }
54 }
55
55
56 void bsp_GPIO_init()
56 void bsp_GPIO_init()
57 {
57 {
58 gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
58 gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
59 gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2);
59 gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2);
60 gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2);
60 gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2);
61 gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2);
61 gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2);
62 gpio_t dacRst=gpioopen(PD4);
62 gpio_t dacRst=gpioopen(PD4);
63 gpiosetspeed(&gpio1,gpiohighspeed);
63 gpiosetspeed(&gpio1,gpiohighspeed);
64 gpiosetspeed(&gpio2,gpiohighspeed);
64 gpiosetspeed(&gpio2,gpiohighspeed);
65 gpiosetspeed(&gpio3,gpiohighspeed);
65 gpiosetspeed(&gpio3,gpiohighspeed);
66 gpiosetspeed(&gpio4,gpiohighspeed);
66 gpiosetspeed(&gpio4,gpiohighspeed);
67 gpiosetspeed(&dacRst,gpiohighspeed);
67 gpiosetspeed(&dacRst,gpiohighspeed);
68 gpiosetdir(&gpio1,gpiooutdir);
68 gpiosetdir(&gpio1,gpiooutdir);
69 gpiosetdir(&gpio3,gpiooutdir);
69 gpiosetdir(&gpio3,gpiooutdir);
70 gpiosetdir(&gpio2,gpiooutdir);
70 gpiosetdir(&gpio2,gpiooutdir);
71 gpiosetdir(&gpio4,gpiooutdir);
71 gpiosetdir(&gpio4,gpiooutdir);
72 gpiosetdir(&dacRst,gpiooutdir);
72 gpiosetdir(&dacRst,gpiooutdir);
73 gpioset(dacRst);
73 gpioset(dacRst);
74 }
74 }
75
75
76 void bsp_uart_init()
76 void bsp_uart_init()
77 {
77 {
78 if(__opnfiles__[1]==NULL)
78 if(__opnfiles__[1]==NULL)
79 {
79 {
80 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
80 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
81 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
81 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
82 uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
82 uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
83 uartmkstreamdev(uart,fd1);
83 uartmkstreamdev(uart,fd1);
84 __opnfiles__[1] = fd1;
84 __opnfiles__[1] = fd1;
85 }
85 }
86 else
86 else
87 {
87 {
88 uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
88 uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
89 }
89 }
90 }
90 }
91
91
92 void bsp_spi_init()
92 void bsp_spi_init()
93 {
93 {
94
94
95 }
95 }
96
96
97
97
98 void bsp_iic_init()
98 void bsp_iic_init()
99 {
99 {
100 i2copenandconfig(i2c1,0,400000,PB9,PB6);
100 i2copenandconfig(i2c1,0,400000,PB9,PB6);
101 i2copenandconfig(i2c3,0,400000,PC9,PA8);
101 i2copenandconfig(i2c3,0,400000,PC9,PA8);
102 }
102 }
103
103
104 void bsp_SD_init()
104 void bsp_SD_init()
105 {
105 {
106
106
107 }
107 }
108
108
109 void vs10XXclearXCS(){}
109 void vs10XXclearXCS(){}
110 void vs10XXsetXCS(){}
110 void vs10XXsetXCS(){}
111 int vs10XXDREQ()
111 int vs10XXDREQ()
112 {
112 {
113 return 1;
113 return 1;
114 }
114 }
115
115
116
116
117 void bsppowersdcard(char onoff) //always ON
117 void bsppowersdcard(char onoff) //always ON
118 {
118 {
119
119
120 }
120 }
121
121
122 char bspsdcardpresent()
122 char bspsdcardpresent()
123 {
123 {
124 return 0;
124 return 0;
125 }
125 }
126
126
127 char bspsdcardwriteprotected()
127 char bspsdcardwriteprotected()
128 {
128 {
129 return 0;
129 return 0;
130 }
130 }
131
131
132 void bspsdcardselect(char YESNO)
132 void bspsdcardselect(char YESNO)
133 {
133 {
134
134
135 }
135 }
136
136
137
137
138
138
139
139
140
140
@@ -1,87 +1,87
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_rcc.h>
27 #include <gpio.h>
27 #include <gpio.h>
28
28
29 #define __MAX_OPENED_FILES__ 32
29 #define __MAX_OPENED_FILES__ 32
30 #define __FS_ROOT_SIZE__ 32
30 #define __FS_ROOT_SIZE__ 32
31 /*
31 /*
32 #ifndef PD8
32 #ifndef PD8
33 #define PD8
33 #define PD8
34 #endif
34 #endif
35 #ifndef PD9
35 #ifndef PD9
36 #define PD9
36 #define PD9
37 #endif
37 #endif
38 */
38 */
39
39
40 #define LED1 PD12
40 #define LED1 PD12
41 #define LED2 PD13
41 #define LED2 PD13
42 #define LED3 PD14
42 #define LED3 PD14
43 #define LED4 PD15
43 #define LED4 PD15
44
44
45 extern float VREF0;
45 extern float VREF0;
46
46
47 extern uint32_t currentCpuFreq;
47 extern uint32_t currentCpuFreq;
48
48
49 extern int bsp_init();
49 extern int bsp_init();
50
50
51 extern void bsp_GPIO_init();
51 extern void bsp_GPIO_init();
52 extern void bsp_uart_init();
52 extern void bsp_uart_init();
53 extern void bsp_iic_init();
53 extern void bsp_iic_init();
54 extern void bsp_spi_init();
54 extern void bsp_spi_init();
55 extern void bsp_SD_init();
55 extern void bsp_SD_init();
56
56
57 /* VS1053 */
57 /* VS1053 */
58 extern void clearXCS();
58 extern void clearXCS();
59 extern void setXCS();
59 extern void setXCS();
60 extern int vs10XXDREQ();
60 extern int vs10XXDREQ();
61
61
62 /* SD CARD */
62 /* SD CARD */
63 void bsppowersdcard(char onoff);
63 void bsppowersdcard(char onoff);
64 char bspsdcardpresent();
64 char bspsdcardpresent();
65 void bspsdcardselect(char YESNO);
65 void bspsdcardselect(char YESNO);
66 char bspsdcardwriteprotected();
66 char bspsdcardwriteprotected();
67
67
68 #endif
68 #endif
69
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
@@ -1,311 +1,311
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 #include <stm32f4xx_gpio.h>
28 #include <stm32f4xx_gpio.h>
29 #include <stm32f4xx_fsmc.h>
29 #include <stm32f4xx_fsmc.h>
30 #include <stm32f4xx_gpio.h>
30 #include <stm32f4xx_gpio.h>
31 #include <stm32f4xx_rcc.h>
31 #include <stm32f4xx_rcc.h>
32 #include <core.h>
32 #include <core.h>
33
33
34 uint32_t OSC0 =8000000;
34 uint32_t OSC0 =8000000;
35 uint32_t INTOSC =16000000;
35 uint32_t INTOSC =16000000;
36 uint32_t RTCOSC =32768;
36 uint32_t RTCOSC =32768;
37 uint32_t currentCpuFreq=0;
37 uint32_t currentCpuFreq=0;
38 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
38 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
39
39
40 float VREF0 =(float)3.3;
40 float VREF0 =(float)3.3;
41
41
42 LCD_IF_t lcdIF0={
42 LCD_IF_t lcdIF0={
43 .init = &bsp_FSMC_init,
43 .init = &bsp_FSMC_init,
44 .writereg = &bsp_lcd0_write_reg,
44 .writereg = &bsp_lcd0_write_reg,
45 .readreg = &bsp_lcd0_read_reg,
45 .readreg = &bsp_lcd0_read_reg,
46 .writeGRAM = &bsp_lcd0_writeGRAM,
46 .writeGRAM = &bsp_lcd0_writeGRAM,
47 .readGRAM = &bsp_lcd0_readGRAM
47 .readGRAM = &bsp_lcd0_readGRAM
48 };
48 };
49
49
50 LCD_t lcd0={
50 LCD_t lcd0={
51 .interface = &lcdIF0,
51 .interface = &lcdIF0,
52 .init = &ssd2119init,
52 .init = &ssd2119init,
53 .paint = &ssd2119paint,
53 .paint = &ssd2119paint,
54 .paintText = &ssd2119paintText,
54 .paintText = &ssd2119paintText,
55 .paintFilRect = &ssd2119paintFilRect,
55 .paintFilRect = &ssd2119paintFilRect,
56 .refreshenable = &ssd2119refreshenable,
56 .refreshenable = &ssd2119refreshenable,
57 .width= 320,
57 .width= 320,
58 .height = 240
58 .height = 240
59 };
59 };
60
60
61
61
62 volatile int16_t* lcd0_CMD=(volatile int16_t*) 0x60000000;
62 volatile int16_t* lcd0_CMD=(volatile int16_t*) 0x60000000;
63 volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x60FFFFF0);
63 volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x60FFFFF0);
64
64
65 int bsp_init()
65 int bsp_init()
66 {
66 {
67 int i=0;
67 int i=0;
68 for(i=0;i<32;i++)
68 for(i=0;i<32;i++)
69 {
69 {
70 __opnfiles__[i] = NULL;
70 __opnfiles__[i] = NULL;
71 }
71 }
72 bsp_GPIO_init();
72 bsp_GPIO_init();
73 bsp_uart_init();
73 bsp_uart_init();
74 bsp_FSMC_init();
74 bsp_FSMC_init();
75 printf("\r================================================================\n\r");
75 printf("\r================================================================\n\r");
76 printf("================================================================\n\r");
76 printf("================================================================\n\r");
77 printf(BSP);
77 printf(BSP);
78 printf(" initialised\n\r");
78 printf(" initialised\n\r");
79 printf("================================================================\n\r");
79 printf("================================================================\n\r");
80 return 1;
80 return 1;
81 }
81 }
82
82
83 void bsp_GPIO_init()
83 void bsp_GPIO_init()
84 {
84 {
85 gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
85 gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
86 // gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2);
86 // gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2);
87 gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2);
87 gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2);
88 // gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2);
88 // gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2);
89 gpiosetspeed(&gpio1,gpiohighspeed);
89 gpiosetspeed(&gpio1,gpiohighspeed);
90 //gpiosetspeed(&gpio2,gpiohighspeed);
90 //gpiosetspeed(&gpio2,gpiohighspeed);
91 gpiosetspeed(&gpio3,gpiohighspeed);
91 gpiosetspeed(&gpio3,gpiohighspeed);
92 //gpiosetspeed(&gpio4,gpiohighspeed);
92 //gpiosetspeed(&gpio4,gpiohighspeed);
93 gpiosetdir(&gpio1,gpiooutdir);
93 gpiosetdir(&gpio1,gpiooutdir);
94 gpiosetdir(&gpio3,gpiooutdir);
94 gpiosetdir(&gpio3,gpiooutdir);
95 // gpiosetdir(&gpio2,gpiooutdir);
95 // gpiosetdir(&gpio2,gpiooutdir);
96 //gpiosetdir(&gpio4,gpiooutdir);
96 //gpiosetdir(&gpio4,gpiooutdir);
97 }
97 }
98
98
99 void bsp_uart_init()
99 void bsp_uart_init()
100 {
100 {
101 if(__opnfiles__[1]==NULL)
101 if(__opnfiles__[1]==NULL)
102 {
102 {
103 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
103 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
104 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
104 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
105 uart_t uart = uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1);
105 uart_t uart = uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1);
106 uartmkstreamdev(uart,fd1);
106 uartmkstreamdev(uart,fd1);
107 __opnfiles__[1] = fd1; //stdo
107 __opnfiles__[1] = fd1; //stdo
108 __opnfiles__[0] = fd1; //stdi
108 __opnfiles__[0] = fd1; //stdi
109 }
109 }
110 else
110 else
111 {
111 {
112 uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1);
112 uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1);
113 }
113 }
114 }
114 }
115
115
116
116
117 /*
117 /*
118 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
118 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
119 D5 PE8 D6 PE9 D7 PE10 D8 PE11 D9 PE12
119 D5 PE8 D6 PE9 D7 PE10 D8 PE11 D9 PE12
120 D10 PE13 D11 PE14 D12 PE15 D13 PD8 D14 PD9
120 D10 PE13 D11 PE14 D12 PE15 D13 PD8 D14 PD9
121 D15 PD10
121 D15 PD10
122 A0 PF0 = RS FSMC_NE3 PG10 CS FSMC_NWE PD5 W/S
122 A0 PF0 = RS FSMC_NE3 PG10 CS FSMC_NWE PD5 W/S
123 FSMC_NOE PD4 RD
123 FSMC_NOE PD4 RD
124 */
124 */
125 /*-- GPIOs Configuration -----------------------------------------------------*/
125 /*-- GPIOs Configuration -----------------------------------------------------*/
126 /*
126 /*
127 +-------------------+--------------------+------------------+------------------+
127 +-------------------+--------------------+------------------+------------------+
128 + SRAM pins assignment +
128 + SRAM pins assignment +
129 +-------------------+--------------------+------------------+------------------+
129 +-------------------+--------------------+------------------+------------------+
130 | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 |
130 | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 |
131 | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 |
131 | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 |
132 | PD4 <-> FSMC_NOE | PE3 <-> FSMC_A19 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 |
132 | PD4 <-> FSMC_NOE | PE3 <-> FSMC_A19 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 |
133 | PD5 <-> FSMC_NWE | PE4 <-> FSMC_A20 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 |
133 | PD5 <-> FSMC_NWE | PE4 <-> FSMC_A20 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 |
134 | PD8 <-> FSMC_D13 | PE7 <-> FSMC_D4 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 |
134 | PD8 <-> FSMC_D13 | PE7 <-> FSMC_D4 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 |
135 | PD9 <-> FSMC_D14 | PE8 <-> FSMC_D5 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 |
135 | PD9 <-> FSMC_D14 | PE8 <-> FSMC_D5 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 |
136 | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 |
136 | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 |
137 | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+
137 | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+
138 | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 |
138 | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 |
139 | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 |
139 | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 |
140 | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+
140 | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+
141 | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 |
141 | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 |
142 | | PE15 <-> FSMC_D12 |
142 | | PE15 <-> FSMC_D12 |
143 +-------------------+--------------------+
143 +-------------------+--------------------+
144 */
144 */
145 int bsp_FSMC_init()
145 int bsp_FSMC_init()
146 {
146 {
147 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
147 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
148 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
148 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
149
149
150 gpio_t gpio1 = gpioopen(LCD_RESET);
150 gpio_t gpio1 = gpioopen(LCD_RESET);
151 gpiosetspeed(&gpio1,gpiohighspeed);
151 gpiosetspeed(&gpio1,gpiohighspeed);
152 gpiosetdir(&gpio1,gpiooutdir);
152 gpiosetdir(&gpio1,gpiooutdir);
153 gpioclr(LCD_RESET);
153 gpioclr(LCD_RESET);
154 gpio1 = gpioopen(LCD_CS);
154 gpio1 = gpioopen(LCD_CS);
155 gpiosetspeed(&gpio1,gpiohighspeed);
155 gpiosetspeed(&gpio1,gpiohighspeed);
156 gpiosetdir(&gpio1,gpiooutdir);
156 gpiosetdir(&gpio1,gpiooutdir);
157 gpioset(LCD_CS);
157 gpioset(LCD_CS);
158 gpio_t LCD_DBxList[]={
158 gpio_t LCD_DBxList[]={
159 PD0 ,PD1 ,PD4 ,PD5 ,PD8 ,PD9 ,PD10,PD14,PD15,
159 PD0 ,PD1 ,PD4 ,PD5 ,PD8 ,PD9 ,PD10,PD14,PD15,
160 PE3 ,PE7 ,PE8 ,PE9 ,PE10,PE11,PE12,PE13,PE14,
160 PE3 ,PE7 ,PE8 ,PE9 ,PE10,PE11,PE12,PE13,PE14,
161 PE15 };
161 PE15 };
162
162
163 for(int i=0;i<19;i++)
163 for(int i=0;i<19;i++)
164 {
164 {
165 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
165 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
166 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
166 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
167 gpiosetconfig(&LCD_DBx);
167 gpiosetconfig(&LCD_DBx);
168 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
168 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
169 }
169 }
170
170
171 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
171 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
172 FSMC_NORSRAMTimingInitTypeDef p;
172 FSMC_NORSRAMTimingInitTypeDef p;
173
173
174 /* Enable FSMC clock */
174 /* Enable FSMC clock */
175 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
175 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
176
176
177 /*-- FSMC Configuration ------------------------------------------------------*/
177 /*-- FSMC Configuration ------------------------------------------------------*/
178 /*----------------------- SRAM Bank 3 ----------------------------------------*/
178 /*----------------------- SRAM Bank 3 ----------------------------------------*/
179 /* FSMC_Bank1_NORSRAM3 configuration */
179 /* FSMC_Bank1_NORSRAM3 configuration */
180 p.FSMC_AddressSetupTime = 1;
180 p.FSMC_AddressSetupTime = 1;
181 p.FSMC_AddressHoldTime = 0;
181 p.FSMC_AddressHoldTime = 0;
182 p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11;
182 p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11;
183 p.FSMC_BusTurnAroundDuration = 0;
183 p.FSMC_BusTurnAroundDuration = 0;
184 p.FSMC_CLKDivision = 0;
184 p.FSMC_CLKDivision = 0;
185 p.FSMC_DataLatency = 0;
185 p.FSMC_DataLatency = 0;
186 p.FSMC_AccessMode = FSMC_AccessMode_A;
186 p.FSMC_AccessMode = FSMC_AccessMode_A;
187 /* Color LCD configuration ------------------------------------
187 /* Color LCD configuration ------------------------------------
188 LCD configured as follow:
188 LCD configured as follow:
189 - Data/Address MUX = Disable
189 - Data/Address MUX = Disable
190 - Memory Type = SRAM
190 - Memory Type = SRAM
191 - Data Width = 16bit
191 - Data Width = 16bit
192 - Write Operation = Enable
192 - Write Operation = Enable
193 - Extended Mode = Enable
193 - Extended Mode = Enable
194 - Asynchronous Wait = Disable */
194 - Asynchronous Wait = Disable */
195
195
196 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
196 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
197 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
197 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
198 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
198 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
199 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
199 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
200 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
200 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
201 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
201 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
202 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
202 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
203 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
203 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
204 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
204 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
205 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
205 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
206 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
206 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
207 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
207 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
208 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
208 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
209 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
209 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
210 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
210 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
211
211
212 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
212 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
213
213
214 /* Enable FSMC NOR/SRAM Bank1 */
214 /* Enable FSMC NOR/SRAM Bank1 */
215 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE);
215 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE);
216 gpioset(LCD_RESET);
216 gpioset(LCD_RESET);
217 gpioclr(LCD_CS);
217 gpioclr(LCD_CS);
218 lcd0.init(&lcd0);
218 lcd0.init(&lcd0);
219 return 1;
219 return 1;
220 }
220 }
221
221
222 void bsp_spi_init()
222 void bsp_spi_init()
223 {
223 {
224
224
225 }
225 }
226
226
227
227
228 void bsp_iic_init()
228 void bsp_iic_init()
229 {
229 {
230
230
231 }
231 }
232
232
233 void bsp_SD_init()
233 void bsp_SD_init()
234 {
234 {
235
235
236 }
236 }
237
237
238
238
239 void vs10XXclearXCS(){}
239 void vs10XXclearXCS(){}
240 void vs10XXsetXCS(){}
240 void vs10XXsetXCS(){}
241 int vs10XXDREQ()
241 int vs10XXDREQ()
242 {
242 {
243 return 1;
243 return 1;
244 }
244 }
245
245
246
246
247 void bsppowersdcard(char onoff) //always ON
247 void bsppowersdcard(char onoff) //always ON
248 {
248 {
249
249
250 }
250 }
251
251
252 char bspsdcardpresent()
252 char bspsdcardpresent()
253 {
253 {
254 return 0;
254 return 0;
255 }
255 }
256
256
257 char bspsdcardwriteprotected()
257 char bspsdcardwriteprotected()
258 {
258 {
259 return 0;
259 return 0;
260 }
260 }
261
261
262 void bspsdcardselect(char YESNO)
262 void bspsdcardselect(char YESNO)
263 {
263 {
264
264
265 }
265 }
266
266
267
267
268
268
269 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
269 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
270 {
270 {
271 gpioclr(LCD_CS);
271 gpioclr(LCD_CS);
272 *lcd0_CMD=(uint16_t)reg;
272 *lcd0_CMD=(uint16_t)reg;
273 *lcd0_DATA=(uint16_t)data;
273 *lcd0_DATA=(uint16_t)data;
274 gpioset(LCD_CS);
274 gpioset(LCD_CS);
275 }
275 }
276
276
277 uint32_t bsp_lcd0_read_reg(uint32_t reg)
277 uint32_t bsp_lcd0_read_reg(uint32_t reg)
278 {
278 {
279 gpioclr(LCD_CS);
279 gpioclr(LCD_CS);
280 *lcd0_CMD=(uint16_t)reg;
280 *lcd0_CMD=(uint16_t)reg;
281 uint32_t data=(uint16_t)*lcd0_DATA;
281 uint32_t data=(uint16_t)*lcd0_DATA;
282 gpioset(LCD_CS);
282 gpioset(LCD_CS);
283 return data;
283 return data;
284 }
284 }
285
285
286 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
286 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
287 {
287 {
288 gpioclr(LCD_CS);
288 gpioclr(LCD_CS);
289 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
289 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
290 uint16_t* castedBuff=(uint16_t*)buffer;
290 uint16_t* castedBuff=(uint16_t*)buffer;
291 for(int i=0;i<(int)count;i++)
291 for(int i=0;i<(int)count;i++)
292 {
292 {
293 *lcd0_DATA=castedBuff[i];
293 *lcd0_DATA=castedBuff[i];
294 }
294 }
295 gpioset(LCD_CS);
295 gpioset(LCD_CS);
296 }
296 }
297
297
298 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
298 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
299 {
299 {
300 gpioclr(LCD_CS);
300 gpioclr(LCD_CS);
301 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
301 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
302 uint16_t* castedBuff=(uint16_t*)buffer;
302 uint16_t* castedBuff=(uint16_t*)buffer;
303 castedBuff[0]=*lcd0_DATA;
303 castedBuff[0]=*lcd0_DATA;
304 for(int i=0;i<(int)count;i++)
304 for(int i=0;i<(int)count;i++)
305 {
305 {
306 castedBuff[i]=*lcd0_DATA;
306 castedBuff[i]=*lcd0_DATA;
307 }
307 }
308 gpioset(LCD_CS);
308 gpioset(LCD_CS);
309 }
309 }
310
310
311
311
@@ -1,108 +1,108
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <ili9328.h>
26 #include <ili9328.h>
27 #include <ssd2119.h>
27 #include <ssd2119.h>
28 #include <genericLCD_Controler.h>
28 #include <genericLCD_Controler.h>
29 /*
29 /*
30 #ifndef PD12
30 #ifndef PD12
31 #define PD12
31 #define PD12
32 #endif
32 #endif
33 #ifndef PD13
33 #ifndef PD13
34 #define PD13
34 #define PD13
35 #endif
35 #endif
36 */
36 */
37 #define __MAX_OPENED_FILES__ 32
37 #define __MAX_OPENED_FILES__ 32
38 #define __FS_ROOT_SIZE__ 32
38 #define __FS_ROOT_SIZE__ 32
39
39
40 #define LED1 PD12
40 #define LED1 PD12
41 #define LED2 PD13
41 #define LED2 PD13
42 #define LCD_RESET PD3
42 #define LCD_RESET PD3
43 #define LCD_CS PD7
43 #define LCD_CS PD7
44 #define LCD_BACKL PD13
44 #define LCD_BACKL PD13
45
45
46 #define GREENLEDON (GPIOD->BSRRL = 1<<12)
46 #define GREENLEDON (GPIOD->BSRRL = 1<<12)
47 #define ORANGELEDON (GPIOD->BSRRL = 1<<13)
47 #define ORANGELEDON (GPIOD->BSRRL = 1<<13)
48 #define REDLEDON (GPIOD->BSRRL = 1<<14)
48 #define REDLEDON (GPIOD->BSRRL = 1<<14)
49 #define BLUELEDON (GPIOD->BSRRL = 1<<15)
49 #define BLUELEDON (GPIOD->BSRRL = 1<<15)
50
50
51 #define GREENLEDOFF (GPIOD->BSRRH = 1<<12)
51 #define GREENLEDOFF (GPIOD->BSRRH = 1<<12)
52 #define ORANGELEDOFF (GPIOD->BSRRH = 1<<13)
52 #define ORANGELEDOFF (GPIOD->BSRRH = 1<<13)
53 #define REDLEDOFF (GPIOD->BSRRH = 1<<14)
53 #define REDLEDOFF (GPIOD->BSRRH = 1<<14)
54 #define BLUELEDOFF (GPIOD->BSRRH = 1<<15)
54 #define BLUELEDOFF (GPIOD->BSRRH = 1<<15)
55
55
56 extern float VREF0;
56 extern float VREF0;
57
57
58 extern uint32_t OSC0;
58 extern uint32_t OSC0;
59 extern uint32_t currentCpuFreq;
59 extern uint32_t currentCpuFreq;
60
60
61
61
62
62
63 extern int bsp_init();
63 extern int bsp_init();
64
64
65 extern void bsp_GPIO_init();
65 extern void bsp_GPIO_init();
66 extern void bsp_uart_init();
66 extern void bsp_uart_init();
67 extern void bsp_iic_init();
67 extern void bsp_iic_init();
68 extern void bsp_spi_init();
68 extern void bsp_spi_init();
69 extern void bsp_SD_init();
69 extern void bsp_SD_init();
70 extern int bsp_FSMC_init();
70 extern int bsp_FSMC_init();
71
71
72 /* VS1053 */
72 /* VS1053 */
73 extern void clearXCS();
73 extern void clearXCS();
74 extern void setXCS();
74 extern void setXCS();
75 extern int vs10XXDREQ();
75 extern int vs10XXDREQ();
76
76
77 /* SD CARD */
77 /* SD CARD */
78 void bsppowersdcard(char onoff);
78 void bsppowersdcard(char onoff);
79 char bspsdcardpresent();
79 char bspsdcardpresent();
80 void bspsdcardselect(char YESNO);
80 void bspsdcardselect(char YESNO);
81 char bspsdcardwriteprotected();
81 char bspsdcardwriteprotected();
82
82
83
83
84 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
84 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
85 uint32_t bsp_lcd0_read_reg(uint32_t reg);
85 uint32_t bsp_lcd0_read_reg(uint32_t reg);
86 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
86 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
87 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
87 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
88
88
89 #endif
89 #endif
90
90
91
91
92
92
93
93
94
94
95
95
96
96
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
104
105
105
106
106
107
107
108
108
@@ -1,134 +1,134
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 uint32_t OSC0 =8000000;
28 uint32_t OSC0 =8000000;
29 uint32_t INTOSC =16000000;
29 uint32_t INTOSC =16000000;
30 uint32_t RTCOSC =32768;
30 uint32_t RTCOSC =32768;
31 uint32_t currentCpuFreq=0;
31 uint32_t currentCpuFreq=0;
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
33
33
34 float VREF0 =(float)3.3;
34 float VREF0 =(float)3.3;
35
35
36 int bsp_init()
36 int bsp_init()
37 {
37 {
38 int i=0;
38 int i=0;
39 for(i=0;i<32;i++)
39 for(i=0;i<32;i++)
40 {
40 {
41 __opnfiles__[i] = NULL;
41 __opnfiles__[i] = NULL;
42 }
42 }
43 bsp_GPIO_init();
43 bsp_GPIO_init();
44 bsp_uart_init();
44 bsp_uart_init();
45 printf("\r================================================================\n\r");
45 printf("\r================================================================\n\r");
46 printf("================================================================\n\r");
46 printf("================================================================\n\r");
47 printf(BSP);
47 printf(BSP);
48 printf(" initialised\n\r");
48 printf(" initialised\n\r");
49 printf("================================================================\n\r");
49 printf("================================================================\n\r");
50 return 1;
50 return 1;
51 }
51 }
52
52
53 void bsp_GPIO_init()
53 void bsp_GPIO_init()
54 {
54 {
55 gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
55 gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009
56 gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2);
56 gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2);
57 gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2);
57 gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2);
58 gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2);
58 gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2);
59 gpiosetspeed(&gpio1,gpiohighspeed);
59 gpiosetspeed(&gpio1,gpiohighspeed);
60 gpiosetspeed(&gpio2,gpiohighspeed);
60 gpiosetspeed(&gpio2,gpiohighspeed);
61 gpiosetspeed(&gpio3,gpiohighspeed);
61 gpiosetspeed(&gpio3,gpiohighspeed);
62 gpiosetspeed(&gpio4,gpiohighspeed);
62 gpiosetspeed(&gpio4,gpiohighspeed);
63 gpiosetdir(&gpio1,gpiooutdir);
63 gpiosetdir(&gpio1,gpiooutdir);
64 gpiosetdir(&gpio3,gpiooutdir);
64 gpiosetdir(&gpio3,gpiooutdir);
65 gpiosetdir(&gpio2,gpiooutdir);
65 gpiosetdir(&gpio2,gpiooutdir);
66 gpiosetdir(&gpio4,gpiooutdir);
66 gpiosetdir(&gpio4,gpiooutdir);
67 }
67 }
68
68
69 void bsp_uart_init()
69 void bsp_uart_init()
70 {
70 {
71 if(__opnfiles__[1]==NULL)
71 if(__opnfiles__[1]==NULL)
72 {
72 {
73 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
73 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
74 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
74 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
75 uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,19200,PB10,PB11,-1,-1);
75 uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,19200,PB10,PB11,-1,-1);
76 uartmkstreamdev(uart,fd1);
76 uartmkstreamdev(uart,fd1);
77 __opnfiles__[1] = fd1; //stdo
77 __opnfiles__[1] = fd1; //stdo
78 __opnfiles__[0] = fd1; //stdi
78 __opnfiles__[0] = fd1; //stdi
79 }
79 }
80 else
80 else
81 {
81 {
82 uartopenandconfig(2,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
82 uartopenandconfig(2,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
83 }
83 }
84 }
84 }
85
85
86 void bsp_spi_init()
86 void bsp_spi_init()
87 {
87 {
88
88
89 }
89 }
90
90
91
91
92 void bsp_iic_init()
92 void bsp_iic_init()
93 {
93 {
94
94
95 }
95 }
96
96
97 void bsp_SD_init()
97 void bsp_SD_init()
98 {
98 {
99
99
100 }
100 }
101
101
102
102
103 void vs10XXclearXCS(){}
103 void vs10XXclearXCS(){}
104 void vs10XXsetXCS(){}
104 void vs10XXsetXCS(){}
105 int vs10XXDREQ()
105 int vs10XXDREQ()
106 {
106 {
107 return 1;
107 return 1;
108 }
108 }
109
109
110
110
111 void bsppowersdcard(char onoff) //always ON
111 void bsppowersdcard(char onoff) //always ON
112 {
112 {
113
113
114 }
114 }
115
115
116 char bspsdcardpresent()
116 char bspsdcardpresent()
117 {
117 {
118 return 0;
118 return 0;
119 }
119 }
120
120
121 char bspsdcardwriteprotected()
121 char bspsdcardwriteprotected()
122 {
122 {
123 return 0;
123 return 0;
124 }
124 }
125
125
126 void bspsdcardselect(char YESNO)
126 void bspsdcardselect(char YESNO)
127 {
127 {
128
128
129 }
129 }
130
130
131
131
132
132
133
133
134
134
@@ -1,95 +1,95
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 /*
26 /*
27 #ifndef PD12
27 #ifndef PD12
28 #define PD12
28 #define PD12
29 #endif
29 #endif
30 #ifndef PD13
30 #ifndef PD13
31 #define PD13
31 #define PD13
32 #endif
32 #endif
33 */
33 */
34 #define __MAX_OPENED_FILES__ 32
34 #define __MAX_OPENED_FILES__ 32
35 #define __FS_ROOT_SIZE__ 32
35 #define __FS_ROOT_SIZE__ 32
36
36
37 #define LED1 PD12
37 #define LED1 PD12
38 #define LED2 PD13
38 #define LED2 PD13
39
39
40 #define GREENLEDON (GPIOD->BSRRL = 1<<12)
40 #define GREENLEDON (GPIOD->BSRRL = 1<<12)
41 #define ORANGELEDON (GPIOD->BSRRL = 1<<13)
41 #define ORANGELEDON (GPIOD->BSRRL = 1<<13)
42 #define REDLEDON (GPIOD->BSRRL = 1<<14)
42 #define REDLEDON (GPIOD->BSRRL = 1<<14)
43 #define BLUELEDON (GPIOD->BSRRL = 1<<15)
43 #define BLUELEDON (GPIOD->BSRRL = 1<<15)
44
44
45 #define GREENLEDOFF (GPIOD->BSRRH = 1<<12)
45 #define GREENLEDOFF (GPIOD->BSRRH = 1<<12)
46 #define ORANGELEDOFF (GPIOD->BSRRH = 1<<13)
46 #define ORANGELEDOFF (GPIOD->BSRRH = 1<<13)
47 #define REDLEDOFF (GPIOD->BSRRH = 1<<14)
47 #define REDLEDOFF (GPIOD->BSRRH = 1<<14)
48 #define BLUELEDOFF (GPIOD->BSRRH = 1<<15)
48 #define BLUELEDOFF (GPIOD->BSRRH = 1<<15)
49
49
50 extern float VREF0;
50 extern float VREF0;
51
51
52 extern uint32_t OSC0;
52 extern uint32_t OSC0;
53 extern uint32_t currentCpuFreq;
53 extern uint32_t currentCpuFreq;
54
54
55
55
56
56
57 extern int bsp_init();
57 extern int bsp_init();
58
58
59 extern void bsp_GPIO_init();
59 extern void bsp_GPIO_init();
60 extern void bsp_uart_init();
60 extern void bsp_uart_init();
61 extern void bsp_iic_init();
61 extern void bsp_iic_init();
62 extern void bsp_spi_init();
62 extern void bsp_spi_init();
63 extern void bsp_SD_init();
63 extern void bsp_SD_init();
64
64
65 /* VS1053 */
65 /* VS1053 */
66 extern void clearXCS();
66 extern void clearXCS();
67 extern void setXCS();
67 extern void setXCS();
68 extern int vs10XXDREQ();
68 extern int vs10XXDREQ();
69
69
70 /* SD CARD */
70 /* SD CARD */
71 void bsppowersdcard(char onoff);
71 void bsppowersdcard(char onoff);
72 char bspsdcardpresent();
72 char bspsdcardpresent();
73 void bspsdcardselect(char YESNO);
73 void bspsdcardselect(char YESNO);
74 char bspsdcardwriteprotected();
74 char bspsdcardwriteprotected();
75
75
76 #endif
76 #endif
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
88
88
89
89
90
90
91
91
92
92
93
93
94
94
95
95
@@ -1,345 +1,345
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <gpio.h>
25 #include <gpio.h>
26 #include <uart.h>
26 #include <uart.h>
27 #include <stdio.h>
27 #include <stdio.h>
28 #include <stm32f4xx_gpio.h>
28 #include <stm32f4xx_gpio.h>
29 #include <stm32f4xx_fsmc.h>
29 #include <stm32f4xx_fsmc.h>
30 #include <i2c.h>
30 #include <i2c.h>
31 #include <core.h>
31 #include <core.h>
32 #include <terminal.h>
32 #include <terminal.h>
33 uint32_t OSC0 =8000000;
33 uint32_t OSC0 =8000000;
34 uint32_t INTOSC =16000000;
34 uint32_t INTOSC =16000000;
35 uint32_t RTCOSC =32768;
35 uint32_t RTCOSC =32768;
36 uint32_t currentCpuFreq=0;
36 uint32_t currentCpuFreq=0;
37 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
37 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
38
38
39 LCD_IF_t lcdIF0={
39 LCD_IF_t lcdIF0={
40 .init = &bsp_FSMC_init,
40 .init = &bsp_FSMC_init,
41 .writereg = &bsp_lcd0_write_reg,
41 .writereg = &bsp_lcd0_write_reg,
42 .readreg = &bsp_lcd0_read_reg,
42 .readreg = &bsp_lcd0_read_reg,
43 .writeGRAM = &bsp_lcd0_writeGRAM,
43 .writeGRAM = &bsp_lcd0_writeGRAM,
44 .readGRAM = &bsp_lcd0_readGRAM
44 .readGRAM = &bsp_lcd0_readGRAM
45 };
45 };
46
46
47 LCD_t lcd0={
47 LCD_t lcd0={
48 .interface = &lcdIF0,
48 .interface = &lcdIF0,
49 .init = &ili9328init,
49 .init = &ili9328init,
50 .paint = &ili9328paint,
50 .paint = &ili9328paint,
51 .paintText = &ili9328paintText,
51 .paintText = &ili9328paintText,
52 .paintFilRect = &ili9328paintFilRect,
52 .paintFilRect = &ili9328paintFilRect,
53 .refreshenable = &ili9328refreshenable,
53 .refreshenable = &ili9328refreshenable,
54 .width= 240,
54 .width= 240,
55 .height = 320
55 .height = 320
56 };
56 };
57
57
58 terminal_t terminal0;
58 terminal_t terminal0;
59
59
60
60
61 volatile int16_t* lcd0_CMD=(volatile int16_t*) (0x60000000 | 0x08000000);
61 volatile int16_t* lcd0_CMD=(volatile int16_t*) (0x60000000 | 0x08000000);
62 volatile int16_t* lcd0_DATA=((volatile int16_t*)(0x60000000 | 0x08000002));
62 volatile int16_t* lcd0_DATA=((volatile int16_t*)(0x60000000 | 0x08000002));
63
63
64 float VREF0 =(float)3.3;
64 float VREF0 =(float)3.3;
65
65
66 int bsp_init()
66 int bsp_init()
67 {
67 {
68 int i=0;
68 int i=0;
69 for(i=0;i<32;i++)
69 for(i=0;i<32;i++)
70 {
70 {
71 __opnfiles__[i] = NULL;
71 __opnfiles__[i] = NULL;
72 }
72 }
73 bsp_GPIO_init();
73 bsp_GPIO_init();
74 bsp_uart_init();
74 bsp_uart_init();
75 bsp_iic_init();
75 bsp_iic_init();
76 bsp_FSMC_init();
76 bsp_FSMC_init();
77 bsp_GTerm_init();
77 bsp_GTerm_init();
78 printf("\r=====================\n\r");
78 printf("\r=====================\n\r");
79 printf( "=====================\n\r");
79 printf( "=====================\n\r");
80 printf(BSP);
80 printf(BSP);
81 printf(" initialised\n\r");
81 printf(" initialised\n\r");
82 printf( "=====================\n\r");
82 printf( "=====================\n\r");
83 return 1;
83 return 1;
84 }
84 }
85
85
86 void bsp_GPIO_init()
86 void bsp_GPIO_init()
87 {
87 {
88 gpio_t gpio1 = gpioopen(LED1);
88 gpio_t gpio1 = gpioopen(LED1);
89 gpio_t gpio2 = gpioopen(LED2);
89 gpio_t gpio2 = gpioopen(LED2);
90 gpio_t gpio3 = gpioopen(LED3);
90 gpio_t gpio3 = gpioopen(LED3);
91 gpiosetspeed(&gpio1,gpiohighspeed);
91 gpiosetspeed(&gpio1,gpiohighspeed);
92 gpiosetspeed(&gpio2,gpiohighspeed);
92 gpiosetspeed(&gpio2,gpiohighspeed);
93 gpiosetspeed(&gpio3,gpiohighspeed);
93 gpiosetspeed(&gpio3,gpiohighspeed);
94 gpiosetdir(&gpio1,gpiooutdir);
94 gpiosetdir(&gpio1,gpiooutdir);
95 gpiosetdir(&gpio2,gpiooutdir);
95 gpiosetdir(&gpio2,gpiooutdir);
96 gpiosetdir(&gpio3,gpiooutdir);
96 gpiosetdir(&gpio3,gpiooutdir);
97 }
97 }
98
98
99 void bsp_uart_init()
99 void bsp_uart_init()
100 {
100 {
101 //if(__opnfiles__[1]==NULL)
101 //if(__opnfiles__[1]==NULL)
102 //{
102 //{
103 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
103 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
104 // streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
104 // streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
105 // uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
105 // uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
106 //uartmkstreamdev(uart,fd1);
106 //uartmkstreamdev(uart,fd1);
107 //__opnfiles__[1] = fd1;
107 //__opnfiles__[1] = fd1;
108 //}
108 //}
109 //else
109 //else
110 //{
110 //{
111 uartopenandconfig(0,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
111 uartopenandconfig(0,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1);
112 //}
112 //}
113 }
113 }
114
114
115 /*
115 /*
116 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
116 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
117 D5 PE8 D6 PE9 D7 PE10 D8 PE11 D9 PE12
117 D5 PE8 D6 PE9 D7 PE10 D8 PE11 D9 PE12
118 D10 PE13 D11 PE14 D12 PE15 D13 PD8 D14 PD9
118 D10 PE13 D11 PE14 D12 PE15 D13 PD8 D14 PD9
119 D15 PD10
119 D15 PD10
120 A0 PF0 = RS FSMC_NE3 PG10 CS FSMC_NWE PD5 W/S
120 A0 PF0 = RS FSMC_NE3 PG10 CS FSMC_NWE PD5 W/S
121 FSMC_NOE PD4 RD
121 FSMC_NOE PD4 RD
122 */
122 */
123 /*-- GPIOs Configuration -----------------------------------------------------*/
123 /*-- GPIOs Configuration -----------------------------------------------------*/
124 /*
124 /*
125 +-------------------+--------------------+------------------+------------------+
125 +-------------------+--------------------+------------------+------------------+
126 + SRAM pins assignment +
126 + SRAM pins assignment +
127 +-------------------+--------------------+------------------+------------------+
127 +-------------------+--------------------+------------------+------------------+
128 | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 |
128 | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 |
129 | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 |
129 | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 |
130 | PD4 <-> FSMC_NOE | PE3 <-> FSMC_A19 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 |
130 | PD4 <-> FSMC_NOE | PE3 <-> FSMC_A19 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 |
131 | PD5 <-> FSMC_NWE | PE4 <-> FSMC_A20 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 |
131 | PD5 <-> FSMC_NWE | PE4 <-> FSMC_A20 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 |
132 | PD8 <-> FSMC_D13 | PE7 <-> FSMC_D4 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 |
132 | PD8 <-> FSMC_D13 | PE7 <-> FSMC_D4 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 |
133 | PD9 <-> FSMC_D14 | PE8 <-> FSMC_D5 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 |
133 | PD9 <-> FSMC_D14 | PE8 <-> FSMC_D5 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 |
134 | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 |
134 | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 |
135 | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+
135 | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+
136 | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 |
136 | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 |
137 | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 |
137 | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 |
138 | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+
138 | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+
139 | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 |
139 | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 |
140 | | PE15 <-> FSMC_D12 |
140 | | PE15 <-> FSMC_D12 |
141 +-------------------+--------------------+
141 +-------------------+--------------------+
142 */
142 */
143 int bsp_FSMC_init()
143 int bsp_FSMC_init()
144 {
144 {
145 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
145 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
146 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
146 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
147
147
148 gpio_t LCD_DBxList[]={
148 gpio_t LCD_DBxList[]={
149 PD0 ,PD1 ,PD4 ,PD5 ,PD8 ,PD9 ,PD10,PD11,PD12,PD13,PD14,PD15,
149 PD0 ,PD1 ,PD4 ,PD5 ,PD8 ,PD9 ,PD10,PD11,PD12,PD13,PD14,PD15,
150 PE0 ,PE1 ,PE3 ,PE4 ,PE7 ,PE8 ,PE9 ,PE10,PE11,PE12,PE13,PE14,
150 PE0 ,PE1 ,PE3 ,PE4 ,PE7 ,PE8 ,PE9 ,PE10,PE11,PE12,PE13,PE14,
151 PE15,PF0 ,PF1 ,PF2 ,PF3 ,PF4 ,PF5 ,PF12,PF13,PF14,PF15,PG0 ,
151 PE15,PF0 ,PF1 ,PF2 ,PF3 ,PF4 ,PF5 ,PF12,PF13,PF14,PF15,PG0 ,
152 PG1 ,PG2 ,PG3 ,PG4 ,PG5 ,PG9 ,PG10
152 PG1 ,PG2 ,PG3 ,PG4 ,PG5 ,PG9 ,PG10
153 };
153 };
154
154
155 for(int i=0;i<43;i++)
155 for(int i=0;i<43;i++)
156 {
156 {
157 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
157 gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]);
158 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
158 LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
159 gpiosetconfig(&LCD_DBx);
159 gpiosetconfig(&LCD_DBx);
160 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
160 GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC);
161 }
161 }
162
162
163 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
163 FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
164 FSMC_NORSRAMTimingInitTypeDef p;
164 FSMC_NORSRAMTimingInitTypeDef p;
165
165
166 /* Enable FSMC clock */
166 /* Enable FSMC clock */
167 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
167 RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
168
168
169 /*-- FSMC Configuration ------------------------------------------------------*/
169 /*-- FSMC Configuration ------------------------------------------------------*/
170 /*----------------------- SRAM Bank 3 ----------------------------------------*/
170 /*----------------------- SRAM Bank 3 ----------------------------------------*/
171 /* FSMC_Bank1_NORSRAM3 configuration */
171 /* FSMC_Bank1_NORSRAM3 configuration */
172 p.FSMC_AddressSetupTime = 1;
172 p.FSMC_AddressSetupTime = 1;
173 p.FSMC_AddressHoldTime = 0;
173 p.FSMC_AddressHoldTime = 0;
174 p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11;
174 p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11;
175 p.FSMC_BusTurnAroundDuration = 0;
175 p.FSMC_BusTurnAroundDuration = 0;
176 p.FSMC_CLKDivision = 0;
176 p.FSMC_CLKDivision = 0;
177 p.FSMC_DataLatency = 0;
177 p.FSMC_DataLatency = 0;
178 p.FSMC_AccessMode = FSMC_AccessMode_A;
178 p.FSMC_AccessMode = FSMC_AccessMode_A;
179 /* Color LCD configuration ------------------------------------
179 /* Color LCD configuration ------------------------------------
180 LCD configured as follow:
180 LCD configured as follow:
181 - Data/Address MUX = Disable
181 - Data/Address MUX = Disable
182 - Memory Type = SRAM
182 - Memory Type = SRAM
183 - Data Width = 16bit
183 - Data Width = 16bit
184 - Write Operation = Enable
184 - Write Operation = Enable
185 - Extended Mode = Enable
185 - Extended Mode = Enable
186 - Asynchronous Wait = Disable */
186 - Asynchronous Wait = Disable */
187
187
188 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
188 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
189 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
189 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
190 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
190 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
191 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
191 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
192 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
192 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
193 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
193 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
194 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
194 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
195 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
195 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
196 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
196 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
197 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
197 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
198 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
198 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
199 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
199 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
200 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
200 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
201 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
201 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
202 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
202 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
203
203
204 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
204 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
205
205
206 /* Enable FSMC NOR/SRAM Bank1 */
206 /* Enable FSMC NOR/SRAM Bank1 */
207 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE);
207 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE);
208
208
209
209
210 p.FSMC_AddressSetupTime = getCpuFreq()/50000000;
210 p.FSMC_AddressSetupTime = getCpuFreq()/50000000;
211 p.FSMC_AddressHoldTime = 0;
211 p.FSMC_AddressHoldTime = 0;
212 p.FSMC_DataSetupTime = getCpuFreq()/25000000;
212 p.FSMC_DataSetupTime = getCpuFreq()/25000000;
213 p.FSMC_BusTurnAroundDuration = 1;
213 p.FSMC_BusTurnAroundDuration = 1;
214 p.FSMC_CLKDivision = 0;
214 p.FSMC_CLKDivision = 0;
215 p.FSMC_DataLatency = 0;
215 p.FSMC_DataLatency = 0;
216 p.FSMC_AccessMode = FSMC_AccessMode_A;
216 p.FSMC_AccessMode = FSMC_AccessMode_A;
217
217
218 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
218 FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
219 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
219 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
220 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM;
220 FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM;
221 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
221 FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
222 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
222 FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
223 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
223 FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
224 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
224 FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
225 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
225 FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
226 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
226 FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
227 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
227 FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
228 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
228 FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
229 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
229 FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
230 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
230 FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
231 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
231 FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
232 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
232 FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
233
233
234 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
234 FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
235
235
236 /*!< Enable FSMC Bank1_SRAM2 Bank */
236 /*!< Enable FSMC Bank1_SRAM2 Bank */
237 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE);
237 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE);
238 lcd0.init(&lcd0);
238 lcd0.init(&lcd0);
239 return 1;
239 return 1;
240 }
240 }
241
241
242 void bsp_spi_init()
242 void bsp_spi_init()
243 {
243 {
244
244
245 }
245 }
246
246
247
247
248 void bsp_iic_init()
248 void bsp_iic_init()
249 {
249 {
250 i2copenandconfig(i2c1,0,10000,PB9,PB6);
250 i2copenandconfig(i2c1,0,10000,PB9,PB6);
251 }
251 }
252
252
253 void bsp_SD_init()
253 void bsp_SD_init()
254 {
254 {
255 gpio_t SDIO_DBxList[]={PC8 ,PC9 ,PC10 ,PC11 ,PC12,PD2};
255 gpio_t SDIO_DBxList[]={PC8 ,PC9 ,PC10 ,PC11 ,PC12,PD2};
256 for(int i=0;i<6;i++)
256 for(int i=0;i<6;i++)
257 {
257 {
258 gpio_t SDIO_DBx = gpioopen(SDIO_DBxList[i]);
258 gpio_t SDIO_DBx = gpioopen(SDIO_DBxList[i]);
259 SDIO_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
259 SDIO_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
260 gpiosetconfig(&SDIO_DBx);
260 gpiosetconfig(&SDIO_DBx);
261 GPIO_PinAFConfig(GPIOGETPORT(SDIO_DBx), (uint8_t)(SDIO_DBx & 0xF), GPIO_AF_SDIO);
261 GPIO_PinAFConfig(GPIOGETPORT(SDIO_DBx), (uint8_t)(SDIO_DBx & 0xF), GPIO_AF_SDIO);
262 }
262 }
263 }
263 }
264
264
265 void vs10XXclearXCS(){}
265 void vs10XXclearXCS(){}
266 void vs10XXsetXCS(){}
266 void vs10XXsetXCS(){}
267 int vs10XXDREQ()
267 int vs10XXDREQ()
268 {
268 {
269 return 1;
269 return 1;
270 }
270 }
271
271
272
272
273 void bsppowersdcard(char onoff) //always ON
273 void bsppowersdcard(char onoff) //always ON
274 {
274 {
275
275
276 }
276 }
277
277
278 char bspsdcardpresent()
278 char bspsdcardpresent()
279 {
279 {
280 return 0;
280 return 0;
281 }
281 }
282
282
283 char bspsdcardwriteprotected()
283 char bspsdcardwriteprotected()
284 {
284 {
285 return 0;
285 return 0;
286 }
286 }
287
287
288 void bspsdcardselect(char YESNO)
288 void bspsdcardselect(char YESNO)
289 {
289 {
290
290
291 }
291 }
292
292
293
293
294 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
294 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
295 {
295 {
296 *lcd0_CMD=(uint16_t)reg;
296 *lcd0_CMD=(uint16_t)reg;
297 *lcd0_DATA=(uint16_t)data;
297 *lcd0_DATA=(uint16_t)data;
298 }
298 }
299
299
300 uint32_t bsp_lcd0_read_reg(uint32_t reg)
300 uint32_t bsp_lcd0_read_reg(uint32_t reg)
301 {
301 {
302 *lcd0_CMD=(uint16_t)reg;
302 *lcd0_CMD=(uint16_t)reg;
303 return (uint16_t)*lcd0_DATA;
303 return (uint16_t)*lcd0_DATA;
304 }
304 }
305
305
306 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
306 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
307 {
307 {
308 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
308 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
309 uint16_t* castedBuff=(uint16_t*)buffer;
309 uint16_t* castedBuff=(uint16_t*)buffer;
310 for(int i=0;i<(int)count;i++)
310 for(int i=0;i<(int)count;i++)
311 {
311 {
312 *lcd0_DATA=castedBuff[i];
312 *lcd0_DATA=castedBuff[i];
313 }
313 }
314 }
314 }
315
315
316 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
316 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
317 {
317 {
318 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
318 *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM;
319 uint16_t* castedBuff=(uint16_t*)buffer;
319 uint16_t* castedBuff=(uint16_t*)buffer;
320 castedBuff[0]=*lcd0_DATA;
320 castedBuff[0]=*lcd0_DATA;
321 for(int i=0;i<(int)count;i++)
321 for(int i=0;i<(int)count;i++)
322 {
322 {
323 castedBuff[i]=*lcd0_DATA;
323 castedBuff[i]=*lcd0_DATA;
324 }
324 }
325 }
325 }
326
326
327 void bsp_GTerm_init()
327 void bsp_GTerm_init()
328 {
328 {
329 if(__opnfiles__[1]==NULL)
329 if(__opnfiles__[1]==NULL)
330 {
330 {
331 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
331 //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t));
332 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
332 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
333
333
334 ili9328paintFilRect(&lcd0,0,0,240,320,0x7FFF,5,0);
334 ili9328paintFilRect(&lcd0,0,0,240,320,0x7FFF,5,0);
335 terminal_init(&terminal0,&lcd0,&ComicSansMS_8,fd1);
335 terminal_init(&terminal0,&lcd0,&ComicSansMS_8,fd1);
336 __opnfiles__[1] = fd1;
336 __opnfiles__[1] = fd1;
337 }
337 }
338 else
338 else
339 {
339 {
340
340
341 }
341 }
342 }
342 }
343
343
344
344
345
345
@@ -1,94 +1,94
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef BSP_H
22 #ifndef BSP_H
23 #define BSP_H
23 #define BSP_H
24 #include <stm32f4xx.h>
24 #include <stm32f4xx.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_rcc.h>
27 #include <gpio.h>
27 #include <gpio.h>
28 #include <ili9328.h>
28 #include <ili9328.h>
29 #include <genericLCD_Controler.h>
29 #include <genericLCD_Controler.h>
30
30
31 #define __MAX_OPENED_FILES__ 4
31 #define __MAX_OPENED_FILES__ 4
32 #define __FS_ROOT_SIZE__ 4
32 #define __FS_ROOT_SIZE__ 4
33
33
34
34
35
35
36 #define LED1 PG6
36 #define LED1 PG6
37 #define LED2 PG8
37 #define LED2 PG8
38 #define LED3 PI9
38 #define LED3 PI9
39 #define LED4 PC7
39 #define LED4 PC7
40
40
41
41
42 extern float VREF0;
42 extern float VREF0;
43
43
44 extern uint32_t currentCpuFreq;
44 extern uint32_t currentCpuFreq;
45 extern LCD_t lcd0;
45 extern LCD_t lcd0;
46
46
47
47
48 extern int bsp_init();
48 extern int bsp_init();
49
49
50 extern void bsp_GPIO_init();
50 extern void bsp_GPIO_init();
51 extern void bsp_uart_init();
51 extern void bsp_uart_init();
52 extern void bsp_iic_init();
52 extern void bsp_iic_init();
53 extern void bsp_spi_init();
53 extern void bsp_spi_init();
54 extern void bsp_SD_init();
54 extern void bsp_SD_init();
55 extern void bsp_GTerm_init();
55 extern void bsp_GTerm_init();
56 extern int bsp_FSMC_init();
56 extern int bsp_FSMC_init();
57
57
58 /* VS1053 */
58 /* VS1053 */
59 extern void clearXCS();
59 extern void clearXCS();
60 extern void setXCS();
60 extern void setXCS();
61 extern int vs10XXDREQ();
61 extern int vs10XXDREQ();
62
62
63 /* SD CARD */
63 /* SD CARD */
64 void bsppowersdcard(char onoff);
64 void bsppowersdcard(char onoff);
65 char bspsdcardpresent();
65 char bspsdcardpresent();
66 void bspsdcardselect(char YESNO);
66 void bspsdcardselect(char YESNO);
67 char bspsdcardwriteprotected();
67 char bspsdcardwriteprotected();
68
68
69
69
70 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
70 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data);
71 uint32_t bsp_lcd0_read_reg(uint32_t reg);
71 uint32_t bsp_lcd0_read_reg(uint32_t reg);
72 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
72 void bsp_lcd0_writeGRAM(void *buffer, uint32_t count);
73 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
73 void bsp_lcd0_readGRAM(void *buffer, uint32_t count);
74
74
75 #endif
75 #endif
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
88
88
89
89
90
90
91
91
92
92
93
93
94
94
@@ -1,14 +1,14
1 TEMPLATE = app
1 TEMPLATE = app
2 CONFIG += cpu
2 CONFIG += cpu
3
3
4
4
5 UCMODEL=stm32f4
5 UCMODEL=stm32f4
6 BSP = OPLAYER
6 BSP = OPLAYER
7
7
8 DEFINES += CPUFREQ=180000000
8 DEFINES += CPUFREQ=10000000
9
9
10
10
11 SOURCES += \
11 SOURCES += \
12 main.c \
12 main.c \
13 test_lcd.c
13 test_lcd.c
14
14
@@ -1,206 +1,207
1 #include <stdio.h>
1 #include <stdio.h>
2 #include <fat32.h>
2 #include <fat32.h>
3 #include <gpio.h>
3 #include <gpio.h>
4 #include <uart.h>
4 #include <uart.h>
5 #include <stm32f4xx.h>
5 #include <stm32f4xx.h>
6 #include <bsp.h>
6 #include <bsp.h>
7 #include <core.h>
7 #include <core.h>
8 #include <VS10XX.h>
8 #include <VS10XX.h>
9 #include <bsp.h>
9 #include <bsp.h>
10 #include <spi.h>
10 #include <spi.h>
11 #include <sdcard.h>
11 #include <sdcard.h>
12 #include <sdcard-spi.h>
12 #include <sdcard-spi.h>
13 #include <fat32.h>
13 #include <fat32.h>
14 #include <ucdirent.h>
14 #include <ucdirent.h>
15 #include <string.h>
15 #include <string.h>
16 #include <terminal.h>
16 #include <terminal.h>
17 #include <ili9328.h>
17 #include <ili9328.h>
18
18
19
19
20 extern streamdevice* __opnfiles__[];
20 extern streamdevice* __opnfiles__[];
21 extern void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color);
21 extern void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color);
22 char buffer[512];
22 char buffer[512];
23
23
24 void randBoxesDemo()
24 void randBoxesDemo()
25 {
25 {
26 int16_t x,y,w,h,t,r;
26 int16_t x,y,w,h,t,r;
27 x=rand()%240;
27 x=rand()%240;
28 y=rand()%320;
28 y=rand()%320;
29 w=rand()%(240-x);
29 w=rand()%(240-x);
30 if(x>y)
30 if(x>y)
31 r=(rand()%(y))%(320-y);
31 r=(rand()%(y))%(320-y);
32 else
32 else
33 r=(rand()%(x))%(240-x);
33 r=(rand()%(x))%(240-x);
34 h=rand()%(320-y);
34 h=rand()%(320-y);
35 t=rand()%(10);
35 t=rand()%(10);
36 ili9328paintFilRect(&lcd0,x,y,w,h,rand(),t,rand());
36 ili9328paintFilRect(&lcd0,x,y,w,h,rand(),t,rand());
37 //ili9328paintFilCirc(&lcd0,x,y,r,rand(),t,rand());
37 //ili9328paintFilCirc(&lcd0,x,y,r,rand(),t,rand());
38 //delay_100us(10);
38 //delay_100us(10);
39 //for(volatile int i=0;i<(1024*2);i++);
39 //for(volatile int i=0;i<(1024*2);i++);
40 }
40 }
41
41
42 void randTextDemo()
42 void randTextDemo()
43 {
43 {
44 int16_t x,y,w,h,t,r;
44 int16_t x,y,w,h,t,r;
45 char buf[2];
45 char buf[2];
46 buf[1]='\0';
46 buf[1]='\0';
47 x=rand()%240;
47 x=rand()%240;
48 y=rand()%320;
48 y=rand()%320;
49 if(x>y)
49 if(x>y)
50 r=(rand()%(y))%(320-y);
50 r=(rand()%(y))%(320-y);
51 else
51 else
52 r=(rand()%(x))%(240-x);
52 r=(rand()%(x))%(240-x);
53 h=rand()%(320-y);
53 h=rand()%(320-y);
54 buf[0]=rand()%(255);
54 buf[0]=rand()%(255);
55 //ili9328paintFilRect(&lcd0,x,y,w,h,rand(),t,rand());
55 //ili9328paintFilRect(&lcd0,x,y,w,h,rand(),t,rand());
56 ili9328paintText(&lcd0,buf,x,y,&ComicSansMS_18,rand());
56 ili9328paintText(&lcd0,buf,x,y,&ComicSansMS_18,rand());
57 //ili9328paintFilCirc(&lcd0,x,y,r,rand(),t,rand());
57 //ili9328paintFilCirc(&lcd0,x,y,r,rand(),t,rand());
58 delay_100us(5000);
58 delay_100us(5000);
59 //for(volatile int i=0;i<(1024*2);i++);
59 //for(volatile int i=0;i<(1024*2);i++);
60 }
60 }
61
61
62 void tryToplay2()
62 void tryToplay2()
63 {
63 {
64
64
65 extern blkdevice sdcard2blkdev;
65 extern blkdevice sdcard2blkdev;
66 int i=0,l=0;
66 int i=0,l=0;
67
67
68 spisetspeed(audioCodec0.SPIdev,4000000);
68 spisetspeed(audioCodec0.SPIdev,4000000);
69 printf("Streaming File\n");
69 printf("Streaming File\n");
70
70
71 //printf("New LBA=0x%X\n",nextLba);
71 //printf("New LBA=0x%X\n",nextLba);
72
72
73 while(sdcard2blkdev.read(&sdcard2blkdev,buffer,l++,1)==RES_OK)
73 while(sdcard2blkdev.read(&sdcard2blkdev,buffer,l++,1)==RES_OK)
74 {
74 {
75
75
76 for(i=0;i<512;i+=32)
76 for(i=0;i<512;i+=32)
77 {
77 {
78 vs10XXstream32bytes(&audioCodec0,buffer+i);
78 vs10XXstream32bytes(&audioCodec0,buffer+i);
79 }
79 }
80 }
80 }
81 }
81 }
82
82
83 void playFile(ucdirent* file,FAT32fs* part)
83 void playFile(ucdirent* file,FAT32fs* part)
84 {
84 {
85 extern volatile vs10XXDev audioCodec0;
85 extern volatile vs10XXDev audioCodec0;
86 char direntName[]=" \n";
86 char direntName[]=" \n";
87 uint32_t fileLba,nextLba;
87 uint32_t fileLba,nextLba;
88 int i=0;
88 int i=0;
89 fat32getdirentname(file,direntName);
89 fat32getdirentname(file,direntName);
90 gpioset(LCD_BACKL);
90 gpioset(LCD_BACKL);
91 //printf("%s\n",direntName);
91 //printf("%s\n",direntName);
92 nextLba=fat32getdirentlba(file);
92 nextLba=fat32getdirentlba(file);
93 //printf("Streaming File\n");
93 //printf("Streaming File\n");
94 gpioclr(LCD_BACKL);
94 gpioclr(LCD_BACKL);
95 do
95 do
96 {
96 {
97 fileLba = nextLba;
97 fileLba = nextLba;
98 if(sdcard2FAT32part1.part->phy->read(part->part->phy,buffer,fileLba,1)==RES_OK)
98 if(sdcard2FAT32part1.part->phy->read(part->part->phy,buffer,fileLba,1)==RES_OK)
99 {
99 {
100 for(i=0;i<512;i+=32)
100 for(i=0;i<512;i+=32)
101 {
101 {
102 vs10XXstream32bytes(&audioCodec0,buffer+i);
102 vs10XXstream32bytes(&audioCodec0,buffer+i);
103 }
103 }
104 }
104 }
105 }while ((fat32nextsectorlba(part,fileLba,&nextLba)==DIRENT_noErr) && (!gpiogetval(BP3)));
105 }while ((fat32nextsectorlba(part,fileLba,&nextLba)==DIRENT_noErr) && (!gpiogetval(BP3)));
106 vs10XXsoftReset(&audioCodec0);
106 vs10XXsoftReset(&audioCodec0);
107 while (gpiogetval(BP3))delay_100us(1000);
107 while (gpiogetval(BP3))delay_100us(1000);
108 }
108 }
109
109
110 void playAllparts()
110 void playAllparts()
111 {
111 {
112 extern FAT32fs sdcard2FAT32part1,sdcard2FAT32part2,sdcard2FAT32part3,sdcard2FAT32part4;
112 extern FAT32fs sdcard2FAT32part1,sdcard2FAT32part2,sdcard2FAT32part3,sdcard2FAT32part4;
113 ucdirent root;
113 ucdirent root;
114 if(DIRENT_noErr==fat32mkdirent(&sdcard2FAT32part1,&root))
114 if(DIRENT_noErr==fat32mkdirent(&sdcard2FAT32part1,&root))
115 {
115 {
116 printf("Reading on SDCARD2 part1\n");
116 printf("Reading on SDCARD2 part1\n");
117 if(DIRENT_noErr==fat32getrootfirstent(&root))
117 if(DIRENT_noErr==fat32getrootfirstent(&root))
118 {
118 {
119 do{
119 do{
120 playFile(&root,&sdcard2FAT32part1);
120 playFile(&root,&sdcard2FAT32part1);
121 }while (DIRENT_noErr==fat32nextdirent(&root));
121 }while (DIRENT_noErr==fat32nextdirent(&root));
122 }
122 }
123 }
123 }
124 gpioset(LED2);
124 gpioset(LED2);
125 if(DIRENT_noErr==fat32mkdirent(&sdcard2FAT32part2,&root))
125 if(DIRENT_noErr==fat32mkdirent(&sdcard2FAT32part2,&root))
126 {
126 {
127 printf("Reading on SDCARD2 part2\n");
127 printf("Reading on SDCARD2 part2\n");
128 if(DIRENT_noErr==fat32getrootfirstent(&root))
128 if(DIRENT_noErr==fat32getrootfirstent(&root))
129 {
129 {
130 do{
130 do{
131 playFile(&root,&sdcard2FAT32part2);
131 playFile(&root,&sdcard2FAT32part2);
132 }while (DIRENT_noErr==fat32nextdirent(&root));
132 }while (DIRENT_noErr==fat32nextdirent(&root));
133 }
133 }
134 }
134 }
135 }
135 }
136
136
137 int main()
137 int main()
138 {
138 {
139 delay_100us(30000);
139 int i=0;
140 int i=0;
140 int color=0;
141 int color=0;
141 for(i=0;i<240;i++)
142 for(i=0;i<240;i++)
142 {
143 {
143 if(i>(240/3))
144 if(i>(240/3))
144 {
145 {
145 color= (i<<5) + 0x1F;
146 color= (i<<5) + 0x1F;
146 }
147 }
147 else
148 else
148 {
149 {
149 color = i;
150 color = i;
150 }
151 }
151 if(i>(2*240/3))
152 if(i>(2*240/3))
152 {
153 {
153 color= (i<<10) + 0x3FF;
154 color= (i<<10) + 0x3FF;
154 }
155 }
155 lcd0.paintFilRect(&lcd0,i,0,1,100,0,0,color);
156 lcd0.paintFilRect(&lcd0,i,0,1,100,0,0,color);
156 }
157 }
157 while(1)printf("test ");
158 while(1)printf("test ");
158 // for(i=0;i<240;i++)
159 // for(i=0;i<240;i++)
159 // {
160 // {
160 // if(i>(240/3))
161 // if(i>(240/3))
161 // {
162 // {
162 // color= (i<<5) + 0x1F;
163 // color= (i<<5) + 0x1F;
163 // }
164 // }
164 // else
165 // else
165 // {
166 // {
166 // color = i;
167 // color = i;
167 // }
168 // }
168 // if(i>(2*240/3))
169 // if(i>(2*240/3))
169 // {
170 // {
170 // color= (i<<10) + 0x3FF;
171 // color= (i<<10) + 0x3FF;
171 // }
172 // }
172 // lcd0.paintFilRect(&lcd0,i,220,1,100,0,0,color);
173 // lcd0.paintFilRect(&lcd0,i,220,1,100,0,0,color);
173 // }
174 // }
174 for(i=0;i<240;i++)
175 for(i=0;i<240;i++)
175 {
176 {
176 ili9328setFrame(&lcd0,i,0,1,100);
177 ili9328setFrame(&lcd0,i,0,1,100);
177 lcd0.interface->readGRAM(buffer,100);
178 lcd0.interface->readGRAM(buffer,100);
178 lcd0.paint(&lcd0,buffer,i,200,1,100);
179 lcd0.paint(&lcd0,buffer,i,200,1,100);
179 }
180 }
180 while(1);
181 while(1);
181 }
182 }
182
183
183 int main2()
184 int main2()
184 {
185 {
185 extern terminal_t terminal0;
186 extern terminal_t terminal0;
186 extern volatile vs10XXDev audioCodec0;
187 extern volatile vs10XXDev audioCodec0;
187 lcd0.paintText(&lcd0,"hello",20,50,&ComicSansMS_18 ,0xF0F0);
188 lcd0.paintText(&lcd0,"hello",20,50,&ComicSansMS_18 ,0xF0F0);
188 while (1)
189 while (1)
189 randTextDemo();
190 randTextDemo();
190 printf("Volume=0x%x\n",vs10XXcmdread(&audioCodec0,VSVOL));
191 printf("Volume=0x%x\n",vs10XXcmdread(&audioCodec0,VSVOL));
191 vs10XXcmdwrite(&audioCodec0,VSCLOCKF,0x2000);
192 vs10XXcmdwrite(&audioCodec0,VSCLOCKF,0x2000);
192 delay_100us(1000);
193 delay_100us(1000);
193 vs10XXcmdwrite(&audioCodec0,VSVOL,0x2020);
194 vs10XXcmdwrite(&audioCodec0,VSVOL,0x2020);
194 printf("VSCLOCKF=0x%x\n",vs10XXcmdread(&audioCodec0,VSCLOCKF));
195 printf("VSCLOCKF=0x%x\n",vs10XXcmdread(&audioCodec0,VSCLOCKF));
195 printf("VSMODE=0x%x\n",vs10XXcmdread(&audioCodec0,VSMODE));
196 printf("VSMODE=0x%x\n",vs10XXcmdread(&audioCodec0,VSMODE));
196 //terminal_clear(&terminal0);
197 //terminal_clear(&terminal0);
197 gpioclr(LCD_BACKL);
198 gpioclr(LCD_BACKL);
198 playAllparts();
199 playAllparts();
199 return 0;
200 return 0;
200 }
201 }
201
202
202
203
203
204
204
205
205
206
206
207
@@ -1,55 +1,56
1 #include <stdio.h>
1 #include <stdio.h>
2 #include <fat32.h>
2 #include <fat32.h>
3 #include <gpio.h>
3 #include <gpio.h>
4 #include <uart.h>
4 #include <uart.h>
5 #include <bsp.h>
5 #include <bsp.h>
6 #include <core.h>
6 #include <core.h>
7 #include <bsp.h>
7 #include <bsp.h>
8 #include <spi.h>
8 #include <spi.h>
9 #include <fat32.h>
9 #include <fat32.h>
10 #include <ucdirent.h>
10 #include <ucdirent.h>
11 #include <string.h>
11 #include <string.h>
12 #include <unistd.h>
12 #include <unistd.h>
13 #include <terminal.h>
13 #include <terminal.h>
14 #include <stdarg.h>
14 #include <stdarg.h>
15 #include <malloc.h>
15 #include <malloc.h>
16
16
17 extern streamdevice* __opnfiles__[];
17 extern streamdevice* __opnfiles__[];
18 extern void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color);
18 extern void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color);
19 char buffer[512];
19 char buffer[512];
20
20
21 void streamdevicePrint(streamdevice* dev, const char* format,...)
21 void streamdevicePrint(streamdevice* dev, const char* format,...)
22 {
22 {
23 char** str_buffer;
23 char** str_buffer;
24 int i;
24 int i;
25 va_list ap;
25 va_list ap;
26 va_start(ap,format);
26 va_start(ap,format);
27 vasprintf(str_buffer,format,ap);
27 vasprintf(str_buffer,format,ap);
28 va_end(ap);
28 va_end(ap);
29 i=strlen(*str_buffer);
29 i=strlen(*str_buffer);
30 dev->ops->write(dev,(void*)*str_buffer,1,i);
30 dev->ops->write(dev,(void*)*str_buffer,1,i);
31 free(*str_buffer);
31 free(*str_buffer);
32 }
32 }
33
33
34 void lcd_print()
34 void lcd_print()
35 {
35 {
36 lcd0.paintFilRect(&lcd0,10,10,100,100,0,0,0x0F0F);
36 lcd0.paintFilRect(&lcd0,10,10,100,100,0,0,0x0F0F);
37 // __opnfiles__[1]->ops->write(__opnfiles__[1],(void*)"hello",1,5);
37 // __opnfiles__[1]->ops->write(__opnfiles__[1],(void*)"hello",1,5);
38 }
38 }
39
39
40 int libuc2_main_task()
40 int libuc2_main_task()
41 {
41 {
42 char in[255];
42 char in[255];
43 lcd_print();
43 lcd_print();
44 printf("hello world\n");
44 printf("hello world\n");
45 streamdevicePrint(__opnfiles__[1],"test Hello %d %f \n ",1234567,8.96);
45 streamdevicePrint(__opnfiles__[1],"test Hello %d %f \n",1234567,8.96);
46 lcd0.paintText(&lcd0,"A",10,100,&ComicSansMS_18,0x0);
46 // while (scanf("%c",in))
47 // while (scanf("%c",in))
47 // {
48 // {
48 sleep(3);
49 sleep(5);
49 // }
50 // }
50 }
51 }
51
52
52
53
53
54
54
55
55
56
@@ -1,56 +1,56
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <CS43L22.h>
22 #include <CS43L22.h>
23 #include <stdio.h>
23 #include <stdio.h>
24 #include <stddef.h>
24 #include <stddef.h>
25 #include <spi.h>
25 #include <spi.h>
26
26
27 int cs43l22open(CS43L22_t* dev,i2c_t i2cdev, uint8_t A0)
27 int cs43l22open(CS43L22_t* dev,i2c_t i2cdev, uint8_t A0)
28 {
28 {
29 if(dev != NULL)
29 if(dev != NULL)
30 {
30 {
31 dev->i2cdev=i2cdev;
31 dev->i2cdev=i2cdev;
32 dev->devAddress = CS43L22_I2C_ADDRESS | (A0 & 1);
32 dev->devAddress = CS43L22_I2C_ADDRESS | (A0 & 1);
33 return 1;
33 return 1;
34 }
34 }
35 return -1;
35 return -1;
36 }
36 }
37
37
38 uint8_t cs43l22getID(CS43L22_t* dev)
38 uint8_t cs43l22getID(CS43L22_t* dev)
39 {
39 {
40 if(dev != NULL)
40 if(dev != NULL)
41 {
41 {
42 char DATA[]={CS43L22_MAP_ID};
42 char DATA[]={CS43L22_MAP_ID};
43 i2cwrite(dev->i2cdev,dev->devAddress,DATA,1);
43 i2cwrite(dev->i2cdev,dev->devAddress,DATA,1);
44 i2cread(dev->i2cdev,dev->devAddress,DATA,1);
44 i2cread(dev->i2cdev,dev->devAddress,DATA,1);
45 return DATA[0];
45 return DATA[0];
46 }
46 }
47 return -1;
47 return -1;
48 }
48 }
49
49
50
50
51
51
52
52
53
53
54
54
55
55
56
56
@@ -1,132 +1,132
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 #-- This file is a part of the libuc, microcontroler library
2 #-- This file is a part of the libuc, microcontroler library
3 #-- Copyright (C) 2011, Alexis Jeandet
3 #-- Copyright (C) 2011, Alexis Jeandet
4 #--
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
5 #-- This program is free software; you can redistribute it and/or modify
6 #-- it under the terms of the GNU General Public License as published by
6 #-- it under the terms of the GNU General Public License as published by
7 #-- the Free Software Foundation; either version 3 of the License, or
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
8 #-- (at your option) any later version.
9 #--
9 #--
10 #-- This program is distributed in the hope that it will be useful,
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
13 #-- GNU General Public License for more details.
14 #--
14 #--
15 #-- You should have received a copy of the GNU General Public License
15 #-- You should have received a copy of the GNU General Public License
16 #-- along with this program; if not, write to the Free Software
16 #-- along with this program; if not, write to the Free Software
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
19 #-- Author : Alexis Jeandet
19 #-- Author : Alexis Jeandet
20 #-- Mail : alexis.jeandet@gmail.com
20 #-- Mail : alexis.jeandet@member.fsf.org
21 #-------------------------------------------------------------------------------*/
21 #-------------------------------------------------------------------------------*/
22 #include <spi.h>
22 #include <spi.h>
23 #include <VS10XX.h>
23 #include <VS10XX.h>
24 #include <core.h>
24 #include <core.h>
25 #include <stdio.h>
25 #include <stdio.h>
26 //#include <bsp.h>
26 //#include <bsp.h>
27
27
28 void vs10XXopen(vs10XXDev *codec, spi_t dev, void (*setxCS)(char), void (*setxRST)(char), void (*setxDCS)(char), int (*getDREQ)())
28 void vs10XXopen(vs10XXDev *codec, spi_t dev, void (*setxCS)(char), void (*setxRST)(char), void (*setxDCS)(char), int (*getDREQ)())
29 {
29 {
30 codec->SPIdev = dev;
30 codec->SPIdev = dev;
31 codec->setxCS = setxCS;
31 codec->setxCS = setxCS;
32 codec->setxDCS = setxDCS;
32 codec->setxDCS = setxDCS;
33 codec->setxRST = setxRST;
33 codec->setxRST = setxRST;
34 codec->getDREQ = getDREQ;
34 codec->getDREQ = getDREQ;
35 codec->setxDCS(1);
35 codec->setxDCS(1);
36 codec->setxCS(1);
36 codec->setxCS(1);
37 codec->setxRST(0);
37 codec->setxRST(0);
38 delay_100us(2);
38 delay_100us(2);
39 codec->setxRST(1);
39 codec->setxRST(1);
40 int status;
40 int status;
41 do{
41 do{
42 status= vs10XXcmdread(codec,VSSTATUS);
42 status= vs10XXcmdread(codec,VSSTATUS);
43 }while (status==0xc);
43 }while (status==0xc);
44 printf("Status=0x%x\n",status);
44 printf("Status=0x%x\n",status);
45 status = (status>>4) & 0xF;
45 status = (status>>4) & 0xF;
46 switch (status) {
46 switch (status) {
47 case 0:
47 case 0:
48 codec->VERSION = VS1001;
48 codec->VERSION = VS1001;
49 break;
49 break;
50 case 1:
50 case 1:
51 codec->VERSION = VS1011;
51 codec->VERSION = VS1011;
52 break;
52 break;
53 case 2:
53 case 2:
54 codec->VERSION = VS1002;
54 codec->VERSION = VS1002;
55 break;
55 break;
56 case 3:
56 case 3:
57 codec->VERSION = VS1003;
57 codec->VERSION = VS1003;
58 break;
58 break;
59 case 4:
59 case 4:
60 codec->VERSION = VS1053;
60 codec->VERSION = VS1053;
61 break;
61 break;
62 case 5:
62 case 5:
63 codec->VERSION = VS1033;
63 codec->VERSION = VS1033;
64 break;
64 break;
65 case 7:
65 case 7:
66 codec->VERSION = VS1103;
66 codec->VERSION = VS1103;
67 break;
67 break;
68 default:
68 default:
69 codec->VERSION = UNKNOWN;
69 codec->VERSION = UNKNOWN;
70 break;
70 break;
71 }
71 }
72 }
72 }
73
73
74 void vs10XXsoftreset(vs10XXDev* dev)
74 void vs10XXsoftreset(vs10XXDev* dev)
75 {
75 {
76 vs10XXcmdwrite(dev,VSMODE,(1<<2));
76 vs10XXcmdwrite(dev,VSMODE,(1<<2));
77 }
77 }
78
78
79 void vs10XXsetCansel(vs10XXDev* dev)
79 void vs10XXsetCansel(vs10XXDev* dev)
80 {
80 {
81 int mode=vs10XXcmdread(dev,VSMODE);
81 int mode=vs10XXcmdread(dev,VSMODE);
82 vs10XXcmdwrite(dev,VSMODE,mode|8);
82 vs10XXcmdwrite(dev,VSMODE,mode|8);
83 }
83 }
84
84
85 void vs10XXsoftReset(vs10XXDev* dev)
85 void vs10XXsoftReset(vs10XXDev* dev)
86 {
86 {
87 int mode=vs10XXcmdread(dev,VSMODE);
87 int mode=vs10XXcmdread(dev,VSMODE);
88 vs10XXcmdwrite(dev,VSMODE,mode|4);
88 vs10XXcmdwrite(dev,VSMODE,mode|4);
89 }
89 }
90
90
91 int vs10XXcanselAccepted(vs10XXDev* dev)
91 int vs10XXcanselAccepted(vs10XXDev* dev)
92 {
92 {
93 int mode=vs10XXcmdread(dev,VSMODE);
93 int mode=vs10XXcmdread(dev,VSMODE);
94 return ((mode & 8)!=8);
94 return ((mode & 8)!=8);
95 }
95 }
96
96
97 int vs10XXcmdread(vs10XXDev* dev,char address)
97 int vs10XXcmdread(vs10XXDev* dev,char address)
98 {
98 {
99 int result;
99 int result;
100 while(!dev->getDREQ());
100 while(!dev->getDREQ());
101 dev->setxCS(0);
101 dev->setxCS(0);
102 spiputw(dev->SPIdev,3);
102 spiputw(dev->SPIdev,3);
103 spiputw(dev->SPIdev,address);
103 spiputw(dev->SPIdev,address);
104 result = (0xFF00 & (spigetw(dev->SPIdev)<<8)) + (0xFF & spigetw(dev->SPIdev));
104 result = (0xFF00 & (spigetw(dev->SPIdev)<<8)) + (0xFF & spigetw(dev->SPIdev));
105 dev->setxCS(1);
105 dev->setxCS(1);
106 return result;
106 return result;
107 }
107 }
108
108
109
109
110 void vs10XXcmdwrite(vs10XXDev* dev,char address,int value)
110 void vs10XXcmdwrite(vs10XXDev* dev,char address,int value)
111 {
111 {
112 while(!dev->getDREQ());
112 while(!dev->getDREQ());
113 dev->setxCS(0);
113 dev->setxCS(0);
114 spiputw(dev->SPIdev,2<<8);
114 spiputw(dev->SPIdev,2<<8);
115 spiputw(dev->SPIdev,address);
115 spiputw(dev->SPIdev,address);
116 spiputw(dev->SPIdev,value>>8);
116 spiputw(dev->SPIdev,value>>8);
117 spiputw(dev->SPIdev,value);
117 spiputw(dev->SPIdev,value);
118 dev->setxCS(1);
118 dev->setxCS(1);
119 }
119 }
120
120
121
121
122 void vs10XXstream32bytes(vs10XXDev* dev,char* buffer)
122 void vs10XXstream32bytes(vs10XXDev* dev,char* buffer)
123 {
123 {
124 while(!dev->getDREQ());
124 while(!dev->getDREQ());
125 dev->setxCS(1);
125 dev->setxCS(1);
126 dev->setxDCS(0);
126 dev->setxDCS(0);
127 spiputnc(dev->SPIdev,buffer,32);
127 spiputnc(dev->SPIdev,buffer,32);
128 dev->setxDCS(1);
128 dev->setxDCS(1);
129
129
130 }
130 }
131
131
132
132
@@ -1,103 +1,103
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <24LC0X.h>
22 #include <24LC0X.h>
23 #include <i2c.h>
23 #include <i2c.h>
24 #include <core.h>
24 #include <core.h>
25 /*
25 /*
26 struct 24LC0X_str
26 struct 24LC0X_str
27 {
27 {
28 i2cDev iicdev;
28 i2cDev iicdev;
29 unsigned char devAddress;
29 unsigned char devAddress;
30 unsigned char size;
30 unsigned char size;
31 };
31 };
32 */
32 */
33
33
34
34
35 void eeprom24lc0xopen(eeprom24lc0xDev* dev, i2c_t iicdev, unsigned char A0_A1_A2_val, unsigned int size)
35 void eeprom24lc0xopen(eeprom24lc0xDev* dev, i2c_t iicdev, unsigned char A0_A1_A2_val, unsigned int size)
36 {
36 {
37 dev->iicdev = iicdev;
37 dev->iicdev = iicdev;
38 dev->devAddress = 0x50 | (A0_A1_A2_val & 0x7);
38 dev->devAddress = 0x50 | (A0_A1_A2_val & 0x7);
39 if(size == 2048) dev->size = 2;
39 if(size == 2048) dev->size = 2;
40 if(size == 1024) dev->size = 1;
40 if(size == 1024) dev->size = 1;
41 }
41 }
42
42
43 void eeprom24lc0xpagewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page)
43 void eeprom24lc0xpagewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page)
44 {
44 {
45 int cmdcnt=1,datacnt=8;
45 int cmdcnt=1,datacnt=8;
46 //i2cwrite(dev.iicdev,address,page)
46 //i2cwrite(dev.iicdev,address,page)
47 //i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,page,&datacnt);
47 //i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,page,&datacnt);
48 }
48 }
49
49
50
50
51 void eeprom24lc0xpageread(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page)
51 void eeprom24lc0xpageread(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page)
52 {
52 {
53 int cmdcnt=1,datacnt=8;
53 int cmdcnt=1,datacnt=8;
54 /*i2cwrite(dev.iicdev,dev.devAddress,&address,&cmdcnt);
54 /*i2cwrite(dev.iicdev,dev.devAddress,&address,&cmdcnt);
55 i2cread(dev.iicdev,dev.devAddress,page,&datacnt);*/
55 i2cread(dev.iicdev,dev.devAddress,page,&datacnt);*/
56 }
56 }
57
57
58 void eeprom24lc0xbytewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char data)
58 void eeprom24lc0xbytewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char data)
59 {
59 {
60 int cmdcnt=1,datacnt=1;
60 int cmdcnt=1,datacnt=1;
61 //i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,&data,&datacnt);
61 //i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,&data,&datacnt);
62 }
62 }
63
63
64
64
65 unsigned char eeprom24lc0xbyteread(eeprom24lc0xDev* dev,unsigned char address)
65 unsigned char eeprom24lc0xbyteread(eeprom24lc0xDev* dev,unsigned char address)
66 {
66 {
67 int cmdcnt=1,datacnt=1;
67 int cmdcnt=1,datacnt=1;
68 unsigned char data = 0;
68 unsigned char data = 0;
69 /* i2cwrite(dev.iicdev,dev.devAddress,&address,&cmdcnt);
69 /* i2cwrite(dev.iicdev,dev.devAddress,&address,&cmdcnt);
70 i2cread(dev.iicdev,dev.devAddress,&data,&datacnt);*/
70 i2cread(dev.iicdev,dev.devAddress,&data,&datacnt);*/
71 return data;
71 return data;
72 }
72 }
73
73
74
74
75 void eeprom24lc0xreadn(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count)
75 void eeprom24lc0xreadn(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count)
76 {
76 {
77 int cmdcnt=1,datacnt=count;
77 int cmdcnt=1,datacnt=count;
78 /* i2cwrite(dev.iicdev,dev.devAddress,&address,&cmdcnt);
78 /* i2cwrite(dev.iicdev,dev.devAddress,&address,&cmdcnt);
79 i2cread(dev.iicdev,dev.devAddress,data,&datacnt);*/
79 i2cread(dev.iicdev,dev.devAddress,data,&datacnt);*/
80
80
81 }
81 }
82
82
83 void eeprom24lc0xwriten(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count)
83 void eeprom24lc0xwriten(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count)
84 {
84 {
85 int cmdcnt=1,datacnt=8;
85 int cmdcnt=1,datacnt=8;
86 while(count >8)
86 while(count >8)
87 {
87 {
88 cmdcnt=1;datacnt=8;
88 cmdcnt=1;datacnt=8;
89 // while(i2noerr!=i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,data,&datacnt)){cmdcnt=1;datacnt=8;}
89 // while(i2noerr!=i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,data,&datacnt)){cmdcnt=1;datacnt=8;}
90 count-=8;
90 count-=8;
91 address+=8;
91 address+=8;
92 data+=8;
92 data+=8;
93 }
93 }
94 cmdcnt=1;datacnt=count;
94 cmdcnt=1;datacnt=count;
95 // while(i2noerr!=i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,data,&datacnt)){cmdcnt=1;datacnt=count;}
95 // while(i2noerr!=i2cwrite2(dev.iicdev,dev.devAddress,&address,&cmdcnt,data,&datacnt)){cmdcnt=1;datacnt=count;}
96 }
96 }
97
97
98
98
99
99
100
100
101
101
102
102
103
103
@@ -1,136 +1,136
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <N25Q128.h>
22 #include <N25Q128.h>
23 #include <core.h>
23 #include <core.h>
24 #include <stdio.h>
24 #include <stdio.h>
25
25
26
26
27
27
28 void eepromN25Q128open(eepromN25Q128Dev *dev, spi_t spidev, void (*select)(int), void (*writeprotect)(int), void (*holdreset)(int))
28 void eepromN25Q128open(eepromN25Q128Dev *dev, spi_t spidev, void (*select)(int), void (*writeprotect)(int), void (*holdreset)(int))
29 {
29 {
30 dev->spidev = spidev;
30 dev->spidev = spidev;
31 dev->holdreset = holdreset;
31 dev->holdreset = holdreset;
32 dev->select = select;
32 dev->select = select;
33 dev->writeprotect = writeprotect;
33 dev->writeprotect = writeprotect;
34 }
34 }
35
35
36 void eepromN25Q128pagewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page)
36 void eepromN25Q128pagewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page)
37 {
37 {
38 int cmdcnt=1,datacnt=8;
38 int cmdcnt=1,datacnt=8;
39 }
39 }
40
40
41
41
42 void eepromN25Q128pageread(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page)
42 void eepromN25Q128pageread(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page)
43 {
43 {
44 int cmdcnt=1,datacnt=8;
44 int cmdcnt=1,datacnt=8;
45 }
45 }
46
46
47 void eepromN25Q128bytewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char data)
47 void eepromN25Q128bytewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char data)
48 {
48 {
49 int cmdcnt=1,datacnt=1;
49 int cmdcnt=1,datacnt=1;
50 }
50 }
51
51
52
52
53 unsigned char eepromN25Q128byteread(eepromN25Q128Dev* dev,uint32_t address)
53 unsigned char eepromN25Q128byteread(eepromN25Q128Dev* dev,uint32_t address)
54 {
54 {
55 int cmdcnt=1,datacnt=1;
55 int cmdcnt=1,datacnt=1;
56 unsigned char data = 0;
56 unsigned char data = 0;
57 return data;
57 return data;
58 }
58 }
59
59
60
60
61 void eepromN25Q128readn(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count)
61 void eepromN25Q128readn(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count)
62 {
62 {
63
63
64 char baddress[3];
64 char baddress[3];
65 baddress[0]=(char)0xFF&((address)>>16);
65 baddress[0]=(char)0xFF&((address)>>16);
66 baddress[1]=(char)0xFF&((address)>>8);
66 baddress[1]=(char)0xFF&((address)>>8);
67 baddress[2]=(char)0xFF&((address));
67 baddress[2]=(char)0xFF&((address));
68 printf("about to read %d bytes\n\r",count);
68 printf("about to read %d bytes\n\r",count);
69 if(dev->select!=NULL)dev->select(0);
69 if(dev->select!=NULL)dev->select(0);
70 spiputw(dev->spidev,N25Q128_READ);
70 spiputw(dev->spidev,N25Q128_READ);
71 spiputnc(dev->spidev,baddress,3);
71 spiputnc(dev->spidev,baddress,3);
72 spigetnc(dev->spidev,data,count);
72 spigetnc(dev->spidev,data,count);
73 if(dev->select!=NULL)dev->select(1);
73 if(dev->select!=NULL)dev->select(1);
74
74
75 }
75 }
76
76
77 void eepromN25Q128writen(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count)
77 void eepromN25Q128writen(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count)
78 {
78 {
79 char baddress[3];
79 char baddress[3];
80 if(dev->select!=NULL)dev->select(0);
80 if(dev->select!=NULL)dev->select(0);
81 for(int i=0;i<(count/N25Q128_PAGE_SZ);i++)
81 for(int i=0;i<(count/N25Q128_PAGE_SZ);i++)
82 {
82 {
83 printf("about to send %d bytes\n\r",N25Q128_PAGE_SZ);
83 printf("about to send %d bytes\n\r",N25Q128_PAGE_SZ);
84 int index =i*N25Q128_PAGE_SZ;
84 int index =i*N25Q128_PAGE_SZ;
85 baddress[0]=(char)0xFF&((address+index)>>16);
85 baddress[0]=(char)0xFF&((address+index)>>16);
86 baddress[1]=(char)0xFF&((address+index)>>8);
86 baddress[1]=(char)0xFF&((address+index)>>8);
87 baddress[2]=(char)0xFF&((address+index));
87 baddress[2]=(char)0xFF&((address+index));
88 if(dev->select!=NULL)dev->select(0);
88 if(dev->select!=NULL)dev->select(0);
89 spiputw(dev->spidev,N25Q128_PP);
89 spiputw(dev->spidev,N25Q128_PP);
90 spiputnc(dev->spidev,baddress,3);
90 spiputnc(dev->spidev,baddress,3);
91 spiputnc(dev->spidev,data+(index),count);
91 spiputnc(dev->spidev,data+(index),count);
92 if(dev->select!=NULL)
92 if(dev->select!=NULL)
93 {
93 {
94 dev->select(1);
94 dev->select(1);
95 }
95 }
96 else {
96 else {
97 while (!spitransactionfinished(dev->spidev));
97 while (!spitransactionfinished(dev->spidev));
98 }
98 }
99 }
99 }
100 int mod = count%N25Q128_PAGE_SZ;
100 int mod = count%N25Q128_PAGE_SZ;
101 if(mod)
101 if(mod)
102 {
102 {
103 baddress[0]=(char)0xFF&((address+(count-mod))>>16);
103 baddress[0]=(char)0xFF&((address+(count-mod))>>16);
104 baddress[1]=(char)0xFF&((address+(count-mod))>>8);
104 baddress[1]=(char)0xFF&((address+(count-mod))>>8);
105 baddress[2]=(char)0xFF&((address+(count-mod)));
105 baddress[2]=(char)0xFF&((address+(count-mod)));
106 printf("about to send %d bytes\n\r",mod);
106 printf("about to send %d bytes\n\r",mod);
107 if(dev->select!=NULL)dev->select(0);
107 if(dev->select!=NULL)dev->select(0);
108 spiputw(dev->spidev,N25Q128_PP);
108 spiputw(dev->spidev,N25Q128_PP);
109 spiputnc(dev->spidev,baddress,3);
109 spiputnc(dev->spidev,baddress,3);
110 spiputnc(dev->spidev,data+(count-mod),mod);
110 spiputnc(dev->spidev,data+(count-mod),mod);
111 if(dev->select!=NULL)
111 if(dev->select!=NULL)
112 {
112 {
113 dev->select(1);
113 dev->select(1);
114 }
114 }
115 else {
115 else {
116 while (!spitransactionfinished(dev->spidev));
116 while (!spitransactionfinished(dev->spidev));
117 }
117 }
118
118
119 }
119 }
120
120
121 }
121 }
122
122
123
123
124 void eepromN25Q128enablewrite(eepromN25Q128Dev *dev)
124 void eepromN25Q128enablewrite(eepromN25Q128Dev *dev)
125 {
125 {
126 if(dev->select!=NULL)dev->select(0);
126 if(dev->select!=NULL)dev->select(0);
127 spiputw(dev->spidev,N25Q128_WREN);
127 spiputw(dev->spidev,N25Q128_WREN);
128 if(dev->select!=NULL)dev->select(1);
128 if(dev->select!=NULL)dev->select(1);
129
129
130 }
130 }
131
131
132
132
133
133
134
134
135
135
136
136
@@ -1,383 +1,383
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #define FAT32_PRIVATE
22 #define FAT32_PRIVATE
23 #include <fat32.h>
23 #include <fat32.h>
24 #include <stdio.h>
24 #include <stdio.h>
25 #include <stdint.h>
25 #include <stdint.h>
26 #include <hexviewer.h>
26 #include <hexviewer.h>
27
27
28 char fat32buff[512]__attribute__ ((aligned (4)));
28 char fat32buff[512]__attribute__ ((aligned (4)));
29 uint32_t lastSecAddrs=-1;
29 uint32_t lastSecAddrs=-1;
30 FAT32fs* lastFATFS=0;
30 FAT32fs* lastFATFS=0;
31
31
32 int fat32open(FAT32fs* fs,dikpartition* part)
32 int fat32open(FAT32fs* fs,dikpartition* part)
33 {
33 {
34 fs->valide = 0;
34 fs->valide = 0;
35 if(part->valide==0)return FATBadpart;
35 if(part->valide==0)return FATBadpart;
36 char sector[512];
36 char sector[512];
37 fs->part = part;
37 fs->part = part;
38 if(!isFat32(fs->part->TypeCode))return FATBadpart;
38 if(!isFat32(fs->part->TypeCode))return FATBadpart;
39 if(fs->part->phy->read(fs->part->phy,sector,fs->part->LBABegin,1)!=RES_OK)return FATReadErr;
39 if(fs->part->phy->read(fs->part->phy,sector,fs->part->LBABegin,1)!=RES_OK)return FATReadErr;
40 fs->BPB_BytsPerSec = fat32Ui8_2_Ui16(sector,BPB_BytsPerSecoff);
40 fs->BPB_BytsPerSec = fat32Ui8_2_Ui16(sector,BPB_BytsPerSecoff);
41 fs->BPB_RsvdSecCnt = fat32Ui8_2_Ui16(sector,BPB_RsvdSecCntoff);
41 fs->BPB_RsvdSecCnt = fat32Ui8_2_Ui16(sector,BPB_RsvdSecCntoff);
42 fs->BPB_FATSz32 = fat32Ui8_2_Ui32(sector,BPB_FATSz32off);
42 fs->BPB_FATSz32 = fat32Ui8_2_Ui32(sector,BPB_FATSz32off);
43 fs->BPB_RootClus = fat32Ui8_2_Ui32(sector,BPB_RootClusoff);
43 fs->BPB_RootClus = fat32Ui8_2_Ui32(sector,BPB_RootClusoff);
44 fs->BPB_SecPerClus = sector[BPB_SecPerClusoff];
44 fs->BPB_SecPerClus = sector[BPB_SecPerClusoff];
45 fs->BPB_NumFATs = sector[BPB_NumFATsoff];
45 fs->BPB_NumFATs = sector[BPB_NumFATsoff];
46 fs->fat_begin_lba = (unsigned int)fs->part->LBABegin + (unsigned int)(unsigned short)fs->BPB_RsvdSecCnt;
46 fs->fat_begin_lba = (unsigned int)fs->part->LBABegin + (unsigned int)(unsigned short)fs->BPB_RsvdSecCnt;
47 fs->cluster_begin_lba = (unsigned int)fs->fat_begin_lba + ((unsigned int)fs->BPB_NumFATs * (unsigned int)fs->BPB_FATSz32 );
47 fs->cluster_begin_lba = (unsigned int)fs->fat_begin_lba + ((unsigned int)fs->BPB_NumFATs * (unsigned int)fs->BPB_FATSz32 );
48 fs->valide=1;
48 fs->valide=1;
49 return FATnoErr;
49 return FATnoErr;
50 }
50 }
51
51
52
52
53 int fat32mkdirent(FAT32fs* fs,ucdirent* dirent)
53 int fat32mkdirent(FAT32fs* fs,ucdirent* dirent)
54 {
54 {
55 if((fs==0) || (fs->valide==0)) return DIRENT_BabArg;
55 if((fs==0) || (fs->valide==0)) return DIRENT_BabArg;
56 if(dirent==0) return DIRENT_BabArg;
56 if(dirent==0) return DIRENT_BabArg;
57 dirent->fs = (UHANDLE)fs;
57 dirent->fs = (UHANDLE)fs;
58 dirent->getrootfirstent = &fat32getrootfirstent;
58 dirent->getrootfirstent = &fat32getrootfirstent;
59 dirent->nextdirent = &fat32nextdirent;
59 dirent->nextdirent = &fat32nextdirent;
60 return DIRENT_noErr;
60 return DIRENT_noErr;
61 }
61 }
62
62
63
63
64 int fat32getrootfirstent(ucdirent* entry)
64 int fat32getrootfirstent(ucdirent* entry)
65 {
65 {
66 if(entry==0) return DIRENT_BabArg;
66 if(entry==0) return DIRENT_BabArg;
67 entry->CurrentSec = ((FAT32fs*)entry->fs)->cluster_begin_lba;
67 entry->CurrentSec = ((FAT32fs*)entry->fs)->cluster_begin_lba;
68 entry->Currententry = 0;
68 entry->Currententry = 0;
69 return fat32nextdirent(entry);
69 return fat32nextdirent(entry);
70 }
70 }
71
71
72
72
73 int fat32getVolName(FAT32fs* fs,char* Name)
73 int fat32getVolName(FAT32fs* fs,char* Name)
74 {
74 {
75 if((fs==0) || (fs->valide==0)) return DIRENT_BabArg;
75 if((fs==0) || (fs->valide==0)) return DIRENT_BabArg;
76 if(Name==0) return DIRENT_BabArg;
76 if(Name==0) return DIRENT_BabArg;
77 int i=0;
77 int i=0;
78 ucdirent entry;
78 ucdirent entry;
79 if(DIRENT_noErr==fat32mkdirent(fs,&entry))
79 if(DIRENT_noErr==fat32mkdirent(fs,&entry))
80 {
80 {
81 entry.CurrentSec = ((FAT32fs*)entry.fs)->cluster_begin_lba;
81 entry.CurrentSec = ((FAT32fs*)entry.fs)->cluster_begin_lba;
82 entry.Currententry = -1;
82 entry.Currententry = -1;
83 if(DIRENT_noErr!=fat32nextdirent(&entry))return DIRENT_ReadErr;
83 if(DIRENT_noErr!=fat32nextdirent(&entry))return DIRENT_ReadErr;
84 for(i=0;i<16;i++)
84 for(i=0;i<16;i++)
85 {
85 {
86 Name[i] = entry.DIR_Name[i];
86 Name[i] = entry.DIR_Name[i];
87 }
87 }
88 return DIRENT_noErr;
88 return DIRENT_noErr;
89 }
89 }
90 return DIRENT_ReadErr;
90 return DIRENT_ReadErr;
91 }
91 }
92
92
93
93
94 int fat32enterdirent(ucdirent* currententry,ucdirent* firstentry)
94 int fat32enterdirent(ucdirent* currententry,ucdirent* firstentry)
95 {
95 {
96 if(firstentry==0) return DIRENT_BabArg;
96 if(firstentry==0) return DIRENT_BabArg;
97 if(currententry==0) return DIRENT_BabArg;
97 if(currententry==0) return DIRENT_BabArg;
98 fat32mkdirent(((FAT32fs*)currententry->fs),firstentry);
98 fat32mkdirent(((FAT32fs*)currententry->fs),firstentry);
99 firstentry->CurrentSec = fat32getdirentlba(currententry);
99 firstentry->CurrentSec = fat32getdirentlba(currententry);
100 firstentry->Currententry = -1;
100 firstentry->Currententry = -1;
101 return fat32nextdirent(firstentry);
101 return fat32nextdirent(firstentry);
102 }
102 }
103
103
104
104
105 int fat32nextdirent(ucdirent* entry)
105 int fat32nextdirent(ucdirent* entry)
106 {
106 {
107 uint32_t n=0,res=DIRENT_noErr,k,j;
107 uint32_t n=0,res=DIRENT_noErr,k,j;
108 k=(0xFF&((signed char)entry->Currententry)+1)*32; /*Restart at last dir entry*/
108 k=(0xFF&((signed char)entry->Currententry)+1)*32; /*Restart at last dir entry*/
109 j=entry->CurrentSec;// /*Restart at last sector*/
109 j=entry->CurrentSec;// /*Restart at last sector*/
110 do
110 do
111 {
111 {
112 //printf("reading new secotr\n",k);
112 //printf("reading new secotr\n",k);
113 fat32sectorreadout(((FAT32fs*)entry->fs),j);
113 fat32sectorreadout(((FAT32fs*)entry->fs),j);
114 //printf("done\n",k);
114 //printf("done\n",k);
115 /*512 Bytes per sector and 32 bytes per entry*/
115 /*512 Bytes per sector and 32 bytes per entry*/
116 for(k=k;k<(512);k+=32)
116 for(k=k;k<(512);k+=32)
117 {
117 {
118 if((fat32buff[DIR_Nameoff+k]!=(char)0xE5)) /*0xE5 = free entry*/
118 if((fat32buff[DIR_Nameoff+k]!=(char)0xE5)) /*0xE5 = free entry*/
119 {
119 {
120 //printf("Fount dir entry = %d, 0x%X\n",0xff & ((int)fat32buff[DIR_Nameoff+k]),0xff & ((int)fat32buff[DIR_Attroff+k]));
120 //printf("Fount dir entry = %d, 0x%X\n",0xff & ((int)fat32buff[DIR_Nameoff+k]),0xff & ((int)fat32buff[DIR_Attroff+k]));
121 if(fat32buff[DIR_Nameoff+k]==(char)0)
121 if(fat32buff[DIR_Nameoff+k]==(char)0)
122 {
122 {
123 //printf("end of directory reached\n",k);
123 //printf("end of directory reached\n",k);
124 return DIRENT_EndOfDir; /*0x00 = end of dir*/
124 return DIRENT_EndOfDir; /*0x00 = end of dir*/
125 }
125 }
126 else
126 else
127 {
127 {
128 uint8_t attribute=fat32buff[DIR_Attroff + k];
128 uint8_t attribute=fat32buff[DIR_Attroff + k];
129 if( (attribute==ATTR_DIRECTORY)
129 if( (attribute==ATTR_DIRECTORY)
130 ||(attribute==ATTR_ARCHIVE)
130 ||(attribute==ATTR_ARCHIVE)
131 ||(attribute==ATTR_READ_ONLY)
131 ||(attribute==ATTR_READ_ONLY)
132 ||(attribute==ATTR_READ_ONLY))
132 ||(attribute==ATTR_READ_ONLY))
133 {
133 {
134 for(n=0;n<16;n++)entry->DIR_Name[n] = '\0';
134 for(n=0;n<16;n++)entry->DIR_Name[n] = '\0';
135 for(n=0;n<11;n++)entry->DIR_Name[n] = fat32buff[n+DIR_Nameoff + k];
135 for(n=0;n<11;n++)entry->DIR_Name[n] = fat32buff[n+DIR_Nameoff + k];
136 entry->DIR_Attr = attribute;
136 entry->DIR_Attr = attribute;
137 entry->DIR_CrtTimeTenth = (uint8_t)fat32buff[DIR_CrtTimeTenthoff + k];
137 entry->DIR_CrtTimeTenth = (uint8_t)fat32buff[DIR_CrtTimeTenthoff + k];
138 entry->DIR_CrtTime = fat32extract16b(fat32buff,(DIR_CrtTimeoff + k));
138 entry->DIR_CrtTime = fat32extract16b(fat32buff,(DIR_CrtTimeoff + k));
139 entry->DIR_CrtDate = fat32extract16b(fat32buff,(DIR_CrtDateoff + k));
139 entry->DIR_CrtDate = fat32extract16b(fat32buff,(DIR_CrtDateoff + k));
140 entry->DIR_LstAccDate = fat32extract16b(fat32buff,(DIR_LstAccDateoff + k));
140 entry->DIR_LstAccDate = fat32extract16b(fat32buff,(DIR_LstAccDateoff + k));
141 entry->DIR_FstClusHI = fat32extract16b(fat32buff, (DIR_FstClusHIoff + k));
141 entry->DIR_FstClusHI = fat32extract16b(fat32buff, (DIR_FstClusHIoff + k));
142 entry->DIR_WrtTime = fat32extract16b(fat32buff,(DIR_WrtTimeoff + k));
142 entry->DIR_WrtTime = fat32extract16b(fat32buff,(DIR_WrtTimeoff + k));
143 entry->DIR_FstClustLO = fat32extract16b(fat32buff, (DIR_FstClusLOoff + k));
143 entry->DIR_FstClustLO = fat32extract16b(fat32buff, (DIR_FstClusLOoff + k));
144 entry->DIR_FileSize = fat32extract32b(fat32buff,(DIR_FileSizeoff + k));
144 entry->DIR_FileSize = fat32extract32b(fat32buff,(DIR_FileSizeoff + k));
145 entry->CurrentSec = j;
145 entry->CurrentSec = j;
146 entry->Currententry = (uint8_t)(0xFF&(k>>5));
146 entry->Currententry = (uint8_t)(0xFF&(k>>5));
147 return DIRENT_noErr;
147 return DIRENT_noErr;
148 }
148 }
149 }
149 }
150 }
150 }
151 }
151 }
152 //printf("asking for next sector\n");
152 //printf("asking for next sector\n");
153 //printf("current = 0x%X\n",j);
153 //printf("current = 0x%X\n",j);
154 j=fat32nextsectorlba(((FAT32fs*)entry->fs),j,&k);
154 j=fat32nextsectorlba(((FAT32fs*)entry->fs),j,&k);
155 //printf("got it 0x%x\n",k);
155 //printf("got it 0x%x\n",k);
156 if(j!=DIRENT_noErr)
156 if(j!=DIRENT_noErr)
157 {
157 {
158 if(j==DIRENT_LastSect) return DIRENT_EndOfDir; /*Not clean but can avoid some bugs*/
158 if(j==DIRENT_LastSect) return DIRENT_EndOfDir; /*Not clean but can avoid some bugs*/
159 return j;
159 return j;
160 }
160 }
161 j=k;
161 j=k;
162 k=0;
162 k=0;
163 }while(res==DIRENT_noErr);
163 }while(res==DIRENT_noErr);
164 return res;
164 return res;
165 }
165 }
166
166
167
167
168 int fat32getdirentname(ucdirent* entry,char* nameBuffer)
168 int fat32getdirentname(ucdirent* entry,char* nameBuffer)
169 {
169 {
170 uint32_t j;
170 uint32_t j;
171 int k,n,i;
171 int k,n,i;
172 int res=DIRENT_noErr;
172 int res=DIRENT_noErr;
173 char longName=0;
173 char longName=0;
174 k=(((signed char)entry->Currententry))*32;
174 k=(((signed char)entry->Currententry))*32;
175 j=entry->CurrentSec;
175 j=entry->CurrentSec;
176 fat32sectorreadout(((FAT32fs*)entry->fs),j);
176 fat32sectorreadout(((FAT32fs*)entry->fs),j);
177 longName |= fat32buff[DIR_Nameoff + 6 + k]=='~';
177 longName |= fat32buff[DIR_Nameoff + 6 + k]=='~';
178 if(k>=32)
178 if(k>=32)
179 {
179 {
180 longName |= ((fat32buff[DIR_Nameoff + k-32]&0x40)==0x40)&((fat32buff[DIR_Nameoff + k-32 +11])==ATTR_LONGNAME);
180 longName |= ((fat32buff[DIR_Nameoff + k-32]&0x40)==0x40)&((fat32buff[DIR_Nameoff + k-32 +11])==ATTR_LONGNAME);
181 }
181 }
182 else
182 else
183 {
183 {
184 uint32_t j_old=j;
184 uint32_t j_old=j;
185 if(fat32prevsectorlba((FAT32fs*)entry->fs, j,&j)!=DIRENT_noErr)return DIRENT_ReadErr;
185 if(fat32prevsectorlba((FAT32fs*)entry->fs, j,&j)!=DIRENT_noErr)return DIRENT_ReadErr;
186 fat32sectorreadout(((FAT32fs*)entry->fs),j);
186 fat32sectorreadout(((FAT32fs*)entry->fs),j);
187 k=512;
187 k=512;
188 longName |= ((fat32buff[DIR_Nameoff + k-32]&0x40)==0x40)&((fat32buff[DIR_Nameoff + k-32 +11])==ATTR_LONGNAME);
188 longName |= ((fat32buff[DIR_Nameoff + k-32]&0x40)==0x40)&((fat32buff[DIR_Nameoff + k-32 +11])==ATTR_LONGNAME);
189 if(!longName)
189 if(!longName)
190 {
190 {
191 k=0;
191 k=0;
192 j=j_old;
192 j=j_old;
193 fat32sectorreadout(((FAT32fs*)entry->fs),j);
193 fat32sectorreadout(((FAT32fs*)entry->fs),j);
194 k=0;
194 k=0;
195 }
195 }
196 }
196 }
197 if(longName) //long Name? or lower case name
197 if(longName) //long Name? or lower case name
198 {
198 {
199 i=0;
199 i=0;
200 do{
200 do{
201 if(k==0)
201 if(k==0)
202 {
202 {
203 //get previous sector
203 //get previous sector
204 if(fat32prevsectorlba2((FAT32fs*)entry->fs,entry, j,&j)!=DIRENT_noErr)return DIRENT_ReadErr;
204 if(fat32prevsectorlba2((FAT32fs*)entry->fs,entry, j,&j)!=DIRENT_noErr)return DIRENT_ReadErr;
205 fat32sectorreadout(((FAT32fs*)entry->fs),j);
205 fat32sectorreadout(((FAT32fs*)entry->fs),j);
206 k=512-32;
206 k=512-32;
207 for(n=0;n<5;n++)nameBuffer[i++] = fat32buff[((n<<1)|1) + k];
207 for(n=0;n<5;n++)nameBuffer[i++] = fat32buff[((n<<1)|1) + k];
208 for(n=14;n<26;n+=2)nameBuffer[i++] = fat32buff[n + k];
208 for(n=14;n<26;n+=2)nameBuffer[i++] = fat32buff[n + k];
209 for(n=28;n<32;n+=2)nameBuffer[i++] = fat32buff[n + k];
209 for(n=28;n<32;n+=2)nameBuffer[i++] = fat32buff[n + k];
210 }
210 }
211 else
211 else
212 {
212 {
213 k-=32;
213 k-=32;
214 for(n=0;n<5;n++)nameBuffer[i++] = fat32buff[((n<<1)|1) + k];
214 for(n=0;n<5;n++)nameBuffer[i++] = fat32buff[((n<<1)|1) + k];
215 for(n=14;n<26;n+=2)nameBuffer[i++] = fat32buff[n + k];
215 for(n=14;n<26;n+=2)nameBuffer[i++] = fat32buff[n + k];
216 for(n=28;n<32;n+=2)nameBuffer[i++] = fat32buff[n + k];
216 for(n=28;n<32;n+=2)nameBuffer[i++] = fat32buff[n + k];
217 }
217 }
218 }while((fat32buff[k]&0x40)!=0x40);
218 }while((fat32buff[k]&0x40)!=0x40);
219 nameBuffer[i]='\0';
219 nameBuffer[i]='\0';
220 }
220 }
221 else
221 else
222 {
222 {
223 i=0;
223 i=0;
224 for(n=0;n<8;n++)
224 for(n=0;n<8;n++)
225 {
225 {
226 nameBuffer[i] = 0x20 | fat32buff[n+DIR_Nameoff + k];
226 nameBuffer[i] = 0x20 | fat32buff[n+DIR_Nameoff + k];
227 if(nameBuffer[i]!=0x20)i++;
227 if(nameBuffer[i]!=0x20)i++;
228 }
228 }
229 if((((fat32buff[DIR_Nameoff + k +11])&ATTR_DIRECTORY)!=ATTR_DIRECTORY)&&(fat32buff[8+DIR_Nameoff + k]!=0x20))
229 if((((fat32buff[DIR_Nameoff + k +11])&ATTR_DIRECTORY)!=ATTR_DIRECTORY)&&(fat32buff[8+DIR_Nameoff + k]!=0x20))
230 nameBuffer[i++]='.';
230 nameBuffer[i++]='.';
231 for(n=8;n<11;n++)
231 for(n=8;n<11;n++)
232 {
232 {
233 nameBuffer[i] = 0x20 | fat32buff[n+DIR_Nameoff + k];
233 nameBuffer[i] = 0x20 | fat32buff[n+DIR_Nameoff + k];
234 if(nameBuffer[i]!=0x20)i++;
234 if(nameBuffer[i]!=0x20)i++;
235 }
235 }
236
236
237 nameBuffer[i]='\0';
237 nameBuffer[i]='\0';
238 }
238 }
239 return res;
239 return res;
240 }
240 }
241
241
242
242
243 uint32_t fat32getdirentlba(ucdirent* entry)
243 uint32_t fat32getdirentlba(ucdirent* entry)
244 {
244 {
245 uint32_t clusterNum = (uint32_t)((uint16_t)entry->DIR_FstClustLO) + ((uint32_t)((uint16_t)entry->DIR_FstClusHI) <<16);
245 uint32_t clusterNum = (uint32_t)((uint16_t)entry->DIR_FstClustLO) + ((uint32_t)((uint16_t)entry->DIR_FstClusHI) <<16);
246 uint32_t lba=clusterlba(((FAT32fs*)entry->fs),clusterNum);
246 uint32_t lba=clusterlba(((FAT32fs*)entry->fs),clusterNum);
247 return lba;
247 return lba;
248 }
248 }
249
249
250
250
251 int fat32nextsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t *nextsector_lba)
251 int fat32nextsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t *nextsector_lba)
252 {
252 {
253
253
254 if(((lastsector_lba + 1 - fs->cluster_begin_lba) & ((uint32_t)(fs->BPB_SecPerClus)-1))!=0) /*Is it the last sector of the cluster?*/
254 if(((lastsector_lba + 1 - fs->cluster_begin_lba) & ((uint32_t)(fs->BPB_SecPerClus)-1))!=0) /*Is it the last sector of the cluster?*/
255 {
255 {
256 *nextsector_lba = lastsector_lba+1; /*if not just increment lba*/
256 *nextsector_lba = lastsector_lba+1; /*if not just increment lba*/
257 return DIRENT_noErr;
257 return DIRENT_noErr;
258 }
258 }
259
259
260 uint32_t clusternum=fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
260 uint32_t clusternum=fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
261 uint32_t fatsec=fat32clusterinfatsect(fs,clusternum); /*Get FAT sector number*/
261 uint32_t fatsec=fat32clusterinfatsect(fs,clusternum); /*Get FAT sector number*/
262 fat32sectorreadout(fs,fatsec);
262 fat32sectorreadout(fs,fatsec);
263 int i= fat32clusterinfatoff(clusternum);
263 int i= fat32clusterinfatoff(clusternum);
264 *nextsector_lba=fat32Ui8_2_Ui32(fat32buff,i);
264 *nextsector_lba=fat32Ui8_2_Ui32(fat32buff,i);
265 if(*nextsector_lba==0xFFFFFFF7)
265 if(*nextsector_lba==0xFFFFFFF7)
266 {
266 {
267 return DIRENT_BadSect;
267 return DIRENT_BadSect;
268 }
268 }
269 if((uint32_t)(*nextsector_lba)>=(uint32_t)0xFFFFFFF6)
269 if((uint32_t)(*nextsector_lba)>=(uint32_t)0xFFFFFFF6)
270 {
270 {
271 return DIRENT_LastSect;
271 return DIRENT_LastSect;
272 }
272 }
273 *nextsector_lba = clusterlba(fs,*nextsector_lba);
273 *nextsector_lba = clusterlba(fs,*nextsector_lba);
274 return DIRENT_noErr;
274 return DIRENT_noErr;
275 }
275 }
276
276
277
277
278 int fat32prevsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t *nextsector_lba)
278 int fat32prevsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t *nextsector_lba)
279 {
279 {
280 uint32_t i=0,fatsec=0;
280 uint32_t i=0,fatsec=0;
281 if(((lastsector_lba - 1 - fs->cluster_begin_lba) & (fs->BPB_SecPerClus-1))!=0) /*Is it the first sector of the cluster?*/
281 if(((lastsector_lba - 1 - fs->cluster_begin_lba) & (fs->BPB_SecPerClus-1))!=0) /*Is it the first sector of the cluster?*/
282 {
282 {
283 *nextsector_lba = lastsector_lba-1; /*if not just decrement lba*/
283 *nextsector_lba = lastsector_lba-1; /*if not just decrement lba*/
284 return DIRENT_noErr;
284 return DIRENT_noErr;
285 }
285 }
286
286
287 uint32_t clusternum = fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
287 uint32_t clusternum = fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
288 fatsec=fat32clusterinfatsect(fs,clusternum); /*Get FAT sector number*/
288 fatsec=fat32clusterinfatsect(fs,clusternum); /*Get FAT sector number*/
289 while(fatsec>=fs->fat_begin_lba)
289 while(fatsec>=fs->fat_begin_lba)
290 {
290 {
291 fat32sectorreadout(fs,fatsec);
291 fat32sectorreadout(fs,fatsec);
292 fatsec--;
292 fatsec--;
293 for(i=508;i>2;i-=4)
293 for(i=508;i>2;i-=4)
294 {
294 {
295 *nextsector_lba = fat32Ui8_2_Ui32(fat32buff,i);
295 *nextsector_lba = fat32Ui8_2_Ui32(fat32buff,i);
296 if (*nextsector_lba ==clusternum)
296 if (*nextsector_lba ==clusternum)
297 {
297 {
298 *nextsector_lba = clusterlba(fs,*nextsector_lba);
298 *nextsector_lba = clusterlba(fs,*nextsector_lba);
299 return DIRENT_noErr;
299 return DIRENT_noErr;
300 }
300 }
301 }
301 }
302 }
302 }
303
303
304 clusternum=fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
304 clusternum=fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
305 fatsec=fat32clusterinfatsect(fs,clusternum); /*Get FAT sector number*/
305 fatsec=fat32clusterinfatsect(fs,clusternum); /*Get FAT sector number*/
306 do
306 do
307 {
307 {
308
308
309 fat32sectorreadout(fs,fatsec);
309 fat32sectorreadout(fs,fatsec);
310 fatsec++;
310 fatsec++;
311 for(i=0;i<512;i+=4)
311 for(i=0;i<512;i+=4)
312 {
312 {
313 *nextsector_lba = fat32Ui8_2_Ui32(fat32buff,i);
313 *nextsector_lba = fat32Ui8_2_Ui32(fat32buff,i);
314 if (*nextsector_lba ==clusternum)
314 if (*nextsector_lba ==clusternum)
315 {
315 {
316 *nextsector_lba = clusterlba(fs,*nextsector_lba);
316 *nextsector_lba = clusterlba(fs,*nextsector_lba);
317 return DIRENT_noErr;
317 return DIRENT_noErr;
318 }
318 }
319
319
320 }
320 }
321 }while(fatsec<=(fs->fat_begin_lba+fs->BPB_FATSz32));
321 }while(fatsec<=(fs->fat_begin_lba+fs->BPB_FATSz32));
322 return DIRENT_ReadErr;
322 return DIRENT_ReadErr;
323 }
323 }
324
324
325
325
326 int fat32prevsectorlba2(FAT32fs* fs,ucdirent* entry,uint32_t lastsector_lba,uint32_t *nextsector_lba)
326 int fat32prevsectorlba2(FAT32fs* fs,ucdirent* entry,uint32_t lastsector_lba,uint32_t *nextsector_lba)
327 {
327 {
328 uint32_t i=0,fatsec=0;
328 uint32_t i=0,fatsec=0;
329 if(((lastsector_lba - 1 - fs->cluster_begin_lba) & (fs->BPB_SecPerClus-1))!=0) /*Is it the first sector of the cluster?*/
329 if(((lastsector_lba - 1 - fs->cluster_begin_lba) & (fs->BPB_SecPerClus-1))!=0) /*Is it the first sector of the cluster?*/
330 {
330 {
331 *nextsector_lba = lastsector_lba-1; /*if not just decrement lba*/
331 *nextsector_lba = lastsector_lba-1; /*if not just decrement lba*/
332 return DIRENT_noErr;
332 return DIRENT_noErr;
333 }
333 }
334
334
335 uint32_t clusternum = fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
335 uint32_t clusternum = fat32sectorlbatoclusternum(fs,lastsector_lba); /*Get cluster Number from sector number*/
336 uint32_t currentClusternum = fat32sectorlbatoclusternum(fs,(fat32getdirentlba(entry)));
336 uint32_t currentClusternum = fat32sectorlbatoclusternum(fs,(fat32getdirentlba(entry)));
337 fatsec=fat32clusterinfatsect(fs,currentClusternum); /*Get FAT sector number*/
337 fatsec=fat32clusterinfatsect(fs,currentClusternum); /*Get FAT sector number*/
338 *nextsector_lba = fat32getdirentlba(entry);
338 *nextsector_lba = fat32getdirentlba(entry);
339 while(fatsec<=(fs->fat_begin_lba+fs->BPB_FATSz32))
339 while(fatsec<=(fs->fat_begin_lba+fs->BPB_FATSz32))
340 {
340 {
341 uint32_t currentClusternum = fat32sectorlbatoclusternum(fs,(*nextsector_lba));
341 uint32_t currentClusternum = fat32sectorlbatoclusternum(fs,(*nextsector_lba));
342 fatsec=fat32clusterinfatsect(fs,currentClusternum); /*Get FAT sector number*/
342 fatsec=fat32clusterinfatsect(fs,currentClusternum); /*Get FAT sector number*/
343 fat32sectorreadout(fs,fatsec);
343 fat32sectorreadout(fs,fatsec);
344 i= fat32clusterinfatoff(currentClusternum);
344 i= fat32clusterinfatoff(currentClusternum);
345 if(i==clusternum)
345 if(i==clusternum)
346 {
346 {
347 return DIRENT_noErr;
347 return DIRENT_noErr;
348 }
348 }
349 *nextsector_lba=fat32Ui8_2_Ui32(fat32buff,i);
349 *nextsector_lba=fat32Ui8_2_Ui32(fat32buff,i);
350 if(*nextsector_lba==0xFFFFFFF7)
350 if(*nextsector_lba==0xFFFFFFF7)
351 {
351 {
352 return DIRENT_BadSect;
352 return DIRENT_BadSect;
353 }
353 }
354 if((uint32_t)(*nextsector_lba)>=(uint32_t)0xFFFFFFF6)
354 if((uint32_t)(*nextsector_lba)>=(uint32_t)0xFFFFFFF6)
355 {
355 {
356 return DIRENT_LastSect;
356 return DIRENT_LastSect;
357 }
357 }
358 }
358 }
359 return DIRENT_ReadErr;
359 return DIRENT_ReadErr;
360 }
360 }
361
361
362
362
363
363
364
364
365
365
366
366
367
367
368
368
369
369
370
370
371
371
372
372
373
373
374
374
375
375
376
376
377
377
378
378
379
379
380
380
381
381
382
382
383
383
@@ -1,86 +1,86
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <mbr.h>
22 #include <mbr.h>
23 #include <stdio.h>
23 #include <stdio.h>
24
24
25
25
26 int mbropen(blkdevice* phy,dikpartition* part,char partNum)
26 int mbropen(blkdevice* phy,dikpartition* part,char partNum)
27 {
27 {
28 printf("enter MBR open function\n");
28 printf("enter MBR open function\n");
29 char mbr[512];
29 char mbr[512];
30 if((part==0) || (phy ==0) || (partNum>4) || (partNum==0) ) return MBRBabArg;
30 if((part==0) || (phy ==0) || (partNum>4) || (partNum==0) ) return MBRBabArg;
31 part->phy = phy;
31 part->phy = phy;
32 if(phy->read(phy,mbr,0,1)!=RES_OK)
32 if(phy->read(phy,mbr,0,1)!=RES_OK)
33 {
33 {
34 printf("can't read MBR!\n");
34 printf("can't read MBR!\n");
35 printf("%x %x %x %x %x %x %x %x\n",mbr[0],mbr[1],mbr[2],mbr[3],mbr[4],mbr[5],mbr[6],mbr[7]);
35 printf("%x %x %x %x %x %x %x %x\n",mbr[0],mbr[1],mbr[2],mbr[3],mbr[4],mbr[5],mbr[6],mbr[7]);
36 part->valide = 0;
36 part->valide = 0;
37 return MBRReadErr;
37 return MBRReadErr;
38 }
38 }
39 if(((mbr[510]) == (char)0x55) && ((mbr[511]) == (char)0xAA))
39 if(((mbr[510]) == (char)0x55) && ((mbr[511]) == (char)0xAA))
40 {
40 {
41 part->TypeCode = mbr[(512-82+TypeCodeoffset)+partNum*16];
41 part->TypeCode = mbr[(512-82+TypeCodeoffset)+partNum*16];
42 part->LBABegin = (unsigned int)mbr[(512-82+LBABeginoffset)+partNum*16] + ((unsigned int)mbr[(512-82+LBABeginoffset+1)+partNum*16]<<8)+ ((unsigned int)mbr[(512-82+LBABeginoffset+2)+partNum*16]<<16)+ ((unsigned int)mbr[(512-82+LBABeginoffset+3)+partNum*16]<<24);
42 part->LBABegin = (unsigned int)mbr[(512-82+LBABeginoffset)+partNum*16] + ((unsigned int)mbr[(512-82+LBABeginoffset+1)+partNum*16]<<8)+ ((unsigned int)mbr[(512-82+LBABeginoffset+2)+partNum*16]<<16)+ ((unsigned int)mbr[(512-82+LBABeginoffset+3)+partNum*16]<<24);
43 part->NumOfSec = (unsigned int)mbr[(512-82+NumOfSecoffset)+partNum*16] + ((unsigned int)mbr[(512-82+NumOfSecoffset+1)+partNum*16]<<8)+ ((unsigned int)mbr[(512-82+NumOfSecoffset+2)+partNum*16]<<16)+ ((unsigned int)mbr[(512-82+NumOfSecoffset+3)+partNum*16]<<24);
43 part->NumOfSec = (unsigned int)mbr[(512-82+NumOfSecoffset)+partNum*16] + ((unsigned int)mbr[(512-82+NumOfSecoffset+1)+partNum*16]<<8)+ ((unsigned int)mbr[(512-82+NumOfSecoffset+2)+partNum*16]<<16)+ ((unsigned int)mbr[(512-82+NumOfSecoffset+3)+partNum*16]<<24);
44 printf("MBR Ok\n");
44 printf("MBR Ok\n");
45 part->valide = 1;
45 part->valide = 1;
46 return MBRnoErr;
46 return MBRnoErr;
47 }
47 }
48 printf("Bad MBR MBR[510]=0x%.2X MBR[511]=0x%.2X!\n",0xff&mbr[510],0xff&mbr[511]);
48 printf("Bad MBR MBR[510]=0x%.2X MBR[511]=0x%.2X!\n",0xff&mbr[510],0xff&mbr[511]);
49 part->valide = 0;
49 part->valide = 0;
50 return MBRBadMbr;
50 return MBRBadMbr;
51
51
52 }
52 }
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
@@ -1,511 +1,511
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <sdcard.h>
22 #include <sdcard.h>
23 #include <sdcard-spi.h>
23 #include <sdcard-spi.h>
24 #include <stdio.h>
24 #include <stdio.h>
25 #include <core.h>
25 #include <core.h>
26
26
27 int sdcardselect (blkdeviceptr _this);
27 int sdcardselect (blkdeviceptr _this);
28 void sdcarddeselect (blkdeviceptr _this);
28 void sdcarddeselect (blkdeviceptr _this);
29 int sdcardwait_ready (sdcardDev* sdcard);
29 int sdcardwait_ready (sdcardDev* sdcard);
30 int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token);
30 int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token);
31 int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr);
31 int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr);
32 char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg);
32 char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg);
33
33
34 DSTATUS sdcarddisk_status (blkdeviceptr _this);
34 DSTATUS sdcarddisk_status (blkdeviceptr _this);
35 DSTATUS sdcarddisk_initialize (blkdeviceptr _this);
35 DSTATUS sdcarddisk_initialize (blkdeviceptr _this);
36 DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count);
36 DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count);
37 DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count);
37 DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count);
38 DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff);
38 DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff);
39
39
40 static volatile
40 static volatile
41 unsigned int Timer1, Timer2; /* 1kHz decrement timer stopped at zero (disk_timerproc()) */
41 unsigned int Timer1, Timer2; /* 1kHz decrement timer stopped at zero (disk_timerproc()) */
42
42
43 void sdcarddeselect (blkdeviceptr _this)
43 void sdcarddeselect (blkdeviceptr _this)
44 {
44 {
45 char d;
45 char d;
46 _this->select(0);
46 _this->select(0);
47 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1); /* Dummy clock (force DO hi-z for multiple slave SPI) */
47 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1); /* Dummy clock (force DO hi-z for multiple slave SPI) */
48 }
48 }
49
49
50 int sdcardselect (blkdeviceptr _this) /* 1:OK, 0:Timeout */
50 int sdcardselect (blkdeviceptr _this) /* 1:OK, 0:Timeout */
51 {
51 {
52 char d;
52 char d;
53 _this->select(1);
53 _this->select(1);
54 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1); /* Dummy clock (force DO enabled) */
54 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1); /* Dummy clock (force DO enabled) */
55
55
56 if (sdcardwait_ready(((sdcardDev*)_this->phy))) return 1; /* OK */
56 if (sdcardwait_ready(((sdcardDev*)_this->phy))) return 1; /* OK */
57 _this->select(0);
57 _this->select(0);
58 return 0; /* Timeout */
58 return 0; /* Timeout */
59 }
59 }
60
60
61 int sdcardwait_ready (sdcardDev* sdcard) /* 1:OK, 0:Timeout */
61 int sdcardwait_ready (sdcardDev* sdcard) /* 1:OK, 0:Timeout */
62 {
62 {
63 char d=0;
63 char d=0;
64 unsigned int tmr;
64 unsigned int tmr;
65 volatile unsigned int i=0;
65 volatile unsigned int i=0;
66
66
67 for (tmr = 500; tmr>0; tmr--) { /* Wait for ready in timeout of 500ms */
67 for (tmr = 500; tmr>0; tmr--) { /* Wait for ready in timeout of 500ms */
68 sdcard->rcvr_mmc(sdcard->phy,&d, 1);
68 sdcard->rcvr_mmc(sdcard->phy,&d, 1);
69 if (d == 0xFF) break;
69 if (d == 0xFF) break;
70 delay_100us(10);
70 delay_100us(10);
71 }
71 }
72
72
73 return tmr != 0;
73 return tmr != 0;
74 }
74 }
75
75
76 int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr)
76 int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr)
77 {
77 {
78 char d[2];
78 char d[2];
79 unsigned int tmr;
79 unsigned int tmr;
80 volatile unsigned int i=0;
80 volatile unsigned int i=0;
81 for (tmr = 100; tmr; tmr--) { /* Wait for data packet in timeout of 100ms */
81 for (tmr = 100; tmr; tmr--) { /* Wait for data packet in timeout of 100ms */
82 sdcard->rcvr_mmc(sdcard->phy,d, 1);
82 sdcard->rcvr_mmc(sdcard->phy,d, 1);
83 if (d[0] != 0xFF) break;
83 if (d[0] != 0xFF) break;
84 delay_100us(10);
84 delay_100us(10);
85 }
85 }
86 if (d[0] != 0xFE) return 0; /* If not valid data token, return with error */
86 if (d[0] != 0xFE) return 0; /* If not valid data token, return with error */
87
87
88 sdcard->rcvr_mmc(sdcard->phy,buff, btr); /* Receive the data block into buffer */
88 sdcard->rcvr_mmc(sdcard->phy,buff, btr); /* Receive the data block into buffer */
89 sdcard->rcvr_mmc(sdcard->phy,d, 2); /* Discard CRC */
89 sdcard->rcvr_mmc(sdcard->phy,d, 2); /* Discard CRC */
90
90
91 return 1; /* Return with success */
91 return 1; /* Return with success */
92 }
92 }
93
93
94
94
95 int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token)
95 int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token)
96 {
96 {
97 char d[2];
97 char d[2];
98
98
99
99
100 if (!sdcardwait_ready(sdcard)) return 0;
100 if (!sdcardwait_ready(sdcard)) return 0;
101
101
102 d[0] = token;
102 d[0] = token;
103 sdcard->xmit_mmc(sdcard->phy,d, 1); /* Xmit a token */
103 sdcard->xmit_mmc(sdcard->phy,d, 1); /* Xmit a token */
104 if (token != 0xFD) { /* Is it data token? */
104 if (token != 0xFD) { /* Is it data token? */
105 sdcard->xmit_mmc(sdcard->phy,buff, 512); /* Xmit the 512 byte data block to MMC */
105 sdcard->xmit_mmc(sdcard->phy,buff, 512); /* Xmit the 512 byte data block to MMC */
106 sdcard->rcvr_mmc(sdcard->phy,d, 2); /* Xmit dummy CRC (0xFF,0xFF) */
106 sdcard->rcvr_mmc(sdcard->phy,d, 2); /* Xmit dummy CRC (0xFF,0xFF) */
107 sdcard->rcvr_mmc(sdcard->phy,d, 1); /* Receive data response */
107 sdcard->rcvr_mmc(sdcard->phy,d, 1); /* Receive data response */
108 if ((d[0] & 0x1F) != 0x05) /* If not accepted, return with error */
108 if ((d[0] & 0x1F) != 0x05) /* If not accepted, return with error */
109 return 0;
109 return 0;
110 }
110 }
111
111
112 return 1;
112 return 1;
113 }
113 }
114
114
115
115
116 char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg)
116 char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg)
117 {
117 {
118 char n, d, buf[6];
118 char n, d, buf[6];
119
119
120
120
121 if (cmd & 0x80) { /* ACMD<n> is the command sequense of CMD55-CMD<n> */
121 if (cmd & 0x80) { /* ACMD<n> is the command sequense of CMD55-CMD<n> */
122 cmd &= 0x7F;
122 cmd &= 0x7F;
123 n = sdcardsend_cmd(_this,CMD55, 0);
123 n = sdcardsend_cmd(_this,CMD55, 0);
124 if (n > 1) return n;
124 if (n > 1) return n;
125 }
125 }
126 /* Select the card and wait for ready */
126 /* Select the card and wait for ready */
127 sdcarddeselect(_this);
127 sdcarddeselect(_this);
128 if (!sdcardselect(_this)) {printf("Can't select SDCARD\n");return 0xFF;}
128 if (!sdcardselect(_this)) {printf("Can't select SDCARD\n");return 0xFF;}
129 /* Send a command packet */
129 /* Send a command packet */
130 buf[0] = 0x40 | cmd; /* Start + Command index */
130 buf[0] = 0x40 | cmd; /* Start + Command index */
131 buf[1] = (char)(arg >> 24); /* Argument[31..24] */
131 buf[1] = (char)(arg >> 24); /* Argument[31..24] */
132 buf[2] = (char)(arg >> 16); /* Argument[23..16] */
132 buf[2] = (char)(arg >> 16); /* Argument[23..16] */
133 buf[3] = (char)(arg >> 8); /* Argument[15..8] */
133 buf[3] = (char)(arg >> 8); /* Argument[15..8] */
134 buf[4] = (char)arg; /* Argument[7..0] */
134 buf[4] = (char)arg; /* Argument[7..0] */
135 n = 0x01; /* Dummy CRC + Stop */
135 n = 0x01; /* Dummy CRC + Stop */
136 if (cmd == CMD0) n = 0x95; /* (valid CRC for CMD0(0)) */
136 if (cmd == CMD0) n = 0x95; /* (valid CRC for CMD0(0)) */
137 if (cmd == CMD8) n = 0x87; /* (valid CRC for CMD8(0x1AA)) */
137 if (cmd == CMD8) n = 0x87; /* (valid CRC for CMD8(0x1AA)) */
138 if (cmd == CMD55) n = 0x63;
138 if (cmd == CMD55) n = 0x63;
139 buf[5] = n;
139 buf[5] = n;
140 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,buf, 6);
140 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,buf, 6);
141 /* Receive command response */
141 /* Receive command response */
142 if (cmd == CMD12)
142 if (cmd == CMD12)
143 {
143 {
144 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1);
144 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1);
145 } /* Skip a stuff byte when stop reading */
145 } /* Skip a stuff byte when stop reading */
146 n = 100; /* Wait for a valid response in timeout of 100 attempts */
146 n = 100; /* Wait for a valid response in timeout of 100 attempts */
147 do
147 do
148 {
148 {
149 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1);
149 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,&d, 1);
150 delay_100us(10);
150 delay_100us(10);
151 //libucprintf("resp=%d\n\r",d);
151 //libucprintf("resp=%d\n\r",d);
152 }while ((d & 0x80) && --n);
152 }while ((d & 0x80) && --n);
153
153
154 return d; /* Return with the response value */
154 return d; /* Return with the response value */
155 }
155 }
156
156
157
157
158
158
159
159
160 DSTATUS sdcarddisk_status (blkdeviceptr _this)
160 DSTATUS sdcarddisk_status (blkdeviceptr _this)
161 {
161 {
162 DSTATUS s = ((sdcardDev*)_this->phy)->Stat;
162 DSTATUS s = ((sdcardDev*)_this->phy)->Stat;
163 char ocr[4];
163 char ocr[4];
164
164
165
165
166 if ((_this==0) || !_this->detect()) {
166 if ((_this==0) || !_this->detect()) {
167 s = STA_NODISK | STA_NOINIT;
167 s = STA_NODISK | STA_NOINIT;
168 } else {
168 } else {
169 s &= ~STA_NODISK;
169 s &= ~STA_NODISK;
170 if (_this->writeprotected()) /* Check card write protection */
170 if (_this->writeprotected()) /* Check card write protection */
171 s |= STA_PROTECT;
171 s |= STA_PROTECT;
172 else
172 else
173 s &= ~STA_PROTECT;
173 s &= ~STA_PROTECT;
174 if (!(s & STA_NOINIT)) {
174 if (!(s & STA_NOINIT)) {
175 if (sdcardsend_cmd(_this,CMD58, 0)) /* Check if the card is kept initialized */
175 if (sdcardsend_cmd(_this,CMD58, 0)) /* Check if the card is kept initialized */
176 s |= STA_NOINIT;
176 s |= STA_NOINIT;
177 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
177 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
178 _this->select(0);
178 _this->select(0);
179 }
179 }
180 }
180 }
181 ((sdcardDev*)_this->phy)->Stat = s;
181 ((sdcardDev*)_this->phy)->Stat = s;
182
182
183 return s;
183 return s;
184 }
184 }
185
185
186
186
187
187
188
188
189 DSTATUS sdcarddisk_initialize (blkdeviceptr _this)
189 DSTATUS sdcarddisk_initialize (blkdeviceptr _this)
190 {
190 {
191 char cmd, ty, ocr[4],ocr2[4];
191 char cmd, ty, ocr[4],ocr2[4];
192 int n;
192 int n;
193 const char dummy=0xff;
193 const char dummy=0xff;
194 uint32_t speed = 1000000;
194 uint32_t speed = 1000000;
195
195
196 ((sdcardDev*)_this->phy)->setspeed(((sdcardDev*)_this->phy)->phy,350000);
196 ((sdcardDev*)_this->phy)->setspeed(((sdcardDev*)_this->phy)->phy,350000);
197 if (_this==0) return STA_NOINIT; /* Supports only drive 0 */
197 if (_this==0) return STA_NOINIT; /* Supports only drive 0 */
198 /* Is card existing in the soket? */
198 /* Is card existing in the soket? */
199 if (((sdcardDev*)_this->phy)->Stat & STA_NODISK)
199 if (((sdcardDev*)_this->phy)->Stat & STA_NODISK)
200 {
200 {
201 printf("No SDCARD\n");
201 printf("No SDCARD\n");
202 return ((sdcardDev*)_this->phy)->Stat;
202 return ((sdcardDev*)_this->phy)->Stat;
203 }
203 }
204 printf("SDCARD Detected\n");
204 printf("SDCARD Detected\n");
205 for (n = 100; n; n--) ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1); /* Send 80 dummy clocks */
205 for (n = 100; n; n--) ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1); /* Send 80 dummy clocks */
206
206
207 ty = 0;
207 ty = 0;
208 if (sdcardsend_cmd(_this,CMD0, 0) == 1) { /* Put the card SPI/Idle state */
208 if (sdcardsend_cmd(_this,CMD0, 0) == 1) { /* Put the card SPI/Idle state */
209 printf("SDCARD in Idle mode\n");
209 printf("SDCARD in Idle mode\n");
210 Timer1 = 1000; /* Initialization timeout = 1 sec */
210 Timer1 = 1000; /* Initialization timeout = 1 sec */
211 if (sdcardsend_cmd(_this,CMD8, 0x1AA) == 1) { /* SDv2? */
211 if (sdcardsend_cmd(_this,CMD8, 0x1AA) == 1) { /* SDv2? */
212 printf("SDCARD V2\n");
212 printf("SDCARD V2\n");
213 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
213 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
214 //for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF); /* Get 32 bit return value of R7 resp */
214 //for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF); /* Get 32 bit return value of R7 resp */
215 if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* Is the card supports vcc of 2.7-3.6V? */
215 if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* Is the card supports vcc of 2.7-3.6V? */
216 printf("The card supports vcc of 2.7-3.6V\n");
216 printf("The card supports vcc of 2.7-3.6V\n");
217 while (Timer1 && sdcardsend_cmd(_this,ACMD41, 1UL << 30)) ; /* Wait for end of initialization with ACMD41(HCS) */
217 while (Timer1 && sdcardsend_cmd(_this,ACMD41, 1UL << 30)) ; /* Wait for end of initialization with ACMD41(HCS) */
218 if (Timer1 && sdcardsend_cmd(_this,CMD58, 0) == 0) { /* Check CCS bit in the OCR */
218 if (Timer1 && sdcardsend_cmd(_this,CMD58, 0) == 0) { /* Check CCS bit in the OCR */
219 //for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF);
219 //for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF);
220 printf("Check CCS bit in the OCR:\n");
220 printf("Check CCS bit in the OCR:\n");
221 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
221 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
222 printf("OCR[0]=0x%X\n",ocr[0]);
222 printf("OCR[0]=0x%X\n",ocr[0]);
223 ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; /* Card id SDv2 */
223 ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; /* Card id SDv2 */
224 }
224 }
225 }
225 }
226 } else { /* Not SDv2 card */
226 } else { /* Not SDv2 card */
227 if (sdcardsend_cmd(_this,ACMD41, 0) <= 1) { /* SDv1 or MMC? */
227 if (sdcardsend_cmd(_this,ACMD41, 0) <= 1) { /* SDv1 or MMC? */
228 ty = CT_SD1; cmd = ACMD41; /* SDv1 (ACMD41(0)) */
228 ty = CT_SD1; cmd = ACMD41; /* SDv1 (ACMD41(0)) */
229 } else {
229 } else {
230 ty = CT_MMC; cmd = CMD1; /* MMCv3 (CMD1(0)) */
230 ty = CT_MMC; cmd = CMD1; /* MMCv3 (CMD1(0)) */
231 }
231 }
232 while (Timer1 && sdcardsend_cmd(_this,cmd, 0)) ; /* Wait for end of initialization */
232 while (Timer1 && sdcardsend_cmd(_this,cmd, 0)) ; /* Wait for end of initialization */
233 if (!Timer1 || sdcardsend_cmd(_this,CMD16, 512) != 0) /* Set block length: 512 */
233 if (!Timer1 || sdcardsend_cmd(_this,CMD16, 512) != 0) /* Set block length: 512 */
234 ty = 0;
234 ty = 0;
235 }
235 }
236 }
236 }
237 ((sdcardDev*)_this->phy)->CardType = ty; /* Card type */
237 ((sdcardDev*)_this->phy)->CardType = ty; /* Card type */
238 printf("CardType=0x%X\n",ty);
238 printf("CardType=0x%X\n",ty);
239
239
240 if (ty) { /* OK */
240 if (ty) { /* OK */
241 ((sdcardDev*)_this->phy)->Stat &= ~STA_NOINIT; /* Clear STA_NOINIT flag */
241 ((sdcardDev*)_this->phy)->Stat &= ~STA_NOINIT; /* Clear STA_NOINIT flag */
242 sdcardsend_cmd(_this,CMD58, 0);
242 sdcardsend_cmd(_this,CMD58, 0);
243 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
243 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr, 4);
244 do
244 do
245 {
245 {
246 speed+=1000000;
246 speed+=1000000;
247 ((sdcardDev*)_this->phy)->setspeed(((sdcardDev*)_this->phy)->phy,speed);
247 ((sdcardDev*)_this->phy)->setspeed(((sdcardDev*)_this->phy)->phy,speed);
248 sdcardsend_cmd(_this,CMD58, 0);
248 sdcardsend_cmd(_this,CMD58, 0);
249 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr2, 4);
249 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ocr2, 4);
250 for(n=0;n<4;n++)
250 for(n=0;n<4;n++)
251 {
251 {
252 if(ocr[n]!=ocr2[n])
252 if(ocr[n]!=ocr2[n])
253 {
253 {
254 n=0;
254 n=0;
255 break;
255 break;
256 }
256 }
257 }
257 }
258 if((speed>(50*1000*1000)) || (speed >= getCpuFreq()))
258 if((speed>(50*1000*1000)) || (speed >= getCpuFreq()))
259 {
259 {
260 break;
260 break;
261 }
261 }
262 }while(n);
262 }while(n);
263 if(!n)
263 if(!n)
264 {
264 {
265 speed-=1000000;
265 speed-=1000000;
266 ((sdcardDev*)_this->phy)->setspeed(((sdcardDev*)_this->phy)->phy,speed);
266 ((sdcardDev*)_this->phy)->setspeed(((sdcardDev*)_this->phy)->phy,speed);
267 }
267 }
268 printf("SDCARD speed = %dMHz\n",speed/1000000);
268 printf("SDCARD speed = %dMHz\n",speed/1000000);
269
269
270 } else { /* Failed */
270 } else { /* Failed */
271 //power_off();
271 //power_off();
272 ((sdcardDev*)_this->phy)->Stat = STA_NOINIT;
272 ((sdcardDev*)_this->phy)->Stat = STA_NOINIT;
273 }
273 }
274 sdcarddeselect (_this);
274 sdcarddeselect (_this);
275 return ((sdcardDev*)_this->phy)->Stat;
275 return ((sdcardDev*)_this->phy)->Stat;
276 }
276 }
277
277
278
278
279
279
280
280
281
281
282
282
283
283
284
284
285
285
286
286
287 DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count)
287 DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count)
288 {
288 {
289 DSTATUS s;
289 DSTATUS s;
290
290
291
291
292 s = sdcarddisk_status(_this);
292 s = sdcarddisk_status(_this);
293 if (s & STA_NOINIT) return RES_NOTRDY;
293 if (s & STA_NOINIT) return RES_NOTRDY;
294 if (!count) return RES_PARERR;
294 if (!count) return RES_PARERR;
295 if (!(((sdcardDev*)_this->phy)->CardType & CT_BLOCK)) sector *= 512; /* Convert LBA to byte address if needed */
295 if (!(((sdcardDev*)_this->phy)->CardType & CT_BLOCK)) sector *= 512; /* Convert LBA to byte address if needed */
296
296
297 if (count == 1) { /* Single block read */
297 if (count == 1) { /* Single block read */
298 if ((sdcardsend_cmd(_this,CMD17, sector) == 0) && sdcardrcvr_datablock((sdcardDev*)(_this->phy),buff, 512))
298 if ((sdcardsend_cmd(_this,CMD17, sector) == 0) && sdcardrcvr_datablock((sdcardDev*)(_this->phy),buff, 512))
299 count = 0;
299 count = 0;
300 }
300 }
301 else { /* Multiple block read */
301 else { /* Multiple block read */
302 if (sdcardsend_cmd(_this,CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
302 if (sdcardsend_cmd(_this,CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
303 do {
303 do {
304 if (!sdcardrcvr_datablock (((sdcardDev*)_this->phy),buff, 512)) break;
304 if (!sdcardrcvr_datablock (((sdcardDev*)_this->phy),buff, 512)) break;
305 buff += 512;
305 buff += 512;
306 } while (--count);
306 } while (--count);
307 sdcardsend_cmd(_this,CMD12, 0); /* STOP_TRANSMISSION */
307 sdcardsend_cmd(_this,CMD12, 0); /* STOP_TRANSMISSION */
308 }
308 }
309 }
309 }
310 sdcarddeselect (_this);
310 sdcarddeselect (_this);
311
311
312 return count ? RES_ERROR : RES_OK;
312 return count ? RES_ERROR : RES_OK;
313 }
313 }
314
314
315
315
316
316
317
317
318
318
319 DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count)
319 DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count)
320 {
320 {
321 DSTATUS s;
321 DSTATUS s;
322
322
323
323
324 s = sdcarddisk_status(_this);
324 s = sdcarddisk_status(_this);
325 if (s & STA_NOINIT) return RES_NOTRDY;
325 if (s & STA_NOINIT) return RES_NOTRDY;
326 if (s & STA_PROTECT) return RES_WRPRT;
326 if (s & STA_PROTECT) return RES_WRPRT;
327 if (!count) return RES_PARERR;
327 if (!count) return RES_PARERR;
328 if (!(((sdcardDev*)_this->phy)->CardType & CT_BLOCK)) sector *= 512; /* Convert LBA to byte address if needed */
328 if (!(((sdcardDev*)_this->phy)->CardType & CT_BLOCK)) sector *= 512; /* Convert LBA to byte address if needed */
329
329
330 if (count == 1) { /* Single block write */
330 if (count == 1) { /* Single block write */
331 if ((sdcardsend_cmd(_this,CMD24, sector) == 0) /* WRITE_BLOCK */
331 if ((sdcardsend_cmd(_this,CMD24, sector) == 0) /* WRITE_BLOCK */
332 && sdcardxmit_datablock (((sdcardDev*)_this->phy),buff, 0xFE))
332 && sdcardxmit_datablock (((sdcardDev*)_this->phy),buff, 0xFE))
333 count = 0;
333 count = 0;
334 }
334 }
335 else { /* Multiple block write */
335 else { /* Multiple block write */
336 if (((sdcardDev*)_this->phy)->CardType & CT_SDC) sdcardsend_cmd(_this,ACMD23, count);
336 if (((sdcardDev*)_this->phy)->CardType & CT_SDC) sdcardsend_cmd(_this,ACMD23, count);
337 if (sdcardsend_cmd(_this,CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */
337 if (sdcardsend_cmd(_this,CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */
338 do {
338 do {
339 if (!sdcardxmit_datablock (((sdcardDev*)_this->phy),buff, 0xFC)) break;
339 if (!sdcardxmit_datablock (((sdcardDev*)_this->phy),buff, 0xFC)) break;
340 buff += 512;
340 buff += 512;
341 } while (--count);
341 } while (--count);
342 if (!sdcardxmit_datablock (((sdcardDev*)_this->phy),0, 0xFD)) /* STOP_TRAN token */
342 if (!sdcardxmit_datablock (((sdcardDev*)_this->phy),0, 0xFD)) /* STOP_TRAN token */
343 count = 1;
343 count = 1;
344 }
344 }
345 }
345 }
346 sdcarddeselect (_this);
346 sdcarddeselect (_this);
347
347
348 return count ? RES_ERROR : RES_OK;
348 return count ? RES_ERROR : RES_OK;
349 }
349 }
350
350
351
351
352 DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff)
352 DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff)
353 {
353 {
354 DRESULT res;
354 DRESULT res;
355 const char dummy=0xff;
355 const char dummy=0xff;
356 char n, csd[16], *ptr = buff;
356 char n, csd[16], *ptr = buff;
357 uint16_t csize;
357 uint16_t csize;
358 uint32_t *dp, st, ed;
358 uint32_t *dp, st, ed;
359
359
360
360
361 if (_this==0) return RES_PARERR; /* Check parameter */
361 if (_this==0) return RES_PARERR; /* Check parameter */
362 if (((sdcardDev*)_this->phy)->Stat & STA_NOINIT) return RES_NOTRDY; /* Check if drive is ready */
362 if (((sdcardDev*)_this->phy)->Stat & STA_NOINIT) return RES_NOTRDY; /* Check if drive is ready */
363
363
364 res = RES_ERROR;
364 res = RES_ERROR;
365
365
366 switch (ctrl) {
366 switch (ctrl) {
367 case CTRL_SYNC : /* Wait for end of internal write process of the drive */
367 case CTRL_SYNC : /* Wait for end of internal write process of the drive */
368 if (sdcardselect (_this)) {
368 if (sdcardselect (_this)) {
369 sdcarddeselect (_this);
369 sdcarddeselect (_this);
370 res = RES_OK;
370 res = RES_OK;
371 }
371 }
372 break;
372 break;
373
373
374 case GET_SECTOR_COUNT : /* Get drive capacity in unit of sector (DWORD) */
374 case GET_SECTOR_COUNT : /* Get drive capacity in unit of sector (DWORD) */
375 if ((sdcardsend_cmd(_this,CMD9, 0) == 0) && sdcardrcvr_datablock (((sdcardDev*)_this->phy),csd, 16)) {
375 if ((sdcardsend_cmd(_this,CMD9, 0) == 0) && sdcardrcvr_datablock (((sdcardDev*)_this->phy),csd, 16)) {
376 if ((csd[0] >> 6) == 1) { /* SDC ver 2.00 */
376 if ((csd[0] >> 6) == 1) { /* SDC ver 2.00 */
377 csize = csd[9] + ((uint16_t)csd[8] << 8) + 1;
377 csize = csd[9] + ((uint16_t)csd[8] << 8) + 1;
378 *(uint32_t*)buff = (uint32_t)csize << 10;
378 *(uint32_t*)buff = (uint32_t)csize << 10;
379 } else { /* SDC ver 1.XX or MMC ver 3 */
379 } else { /* SDC ver 1.XX or MMC ver 3 */
380 n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2;
380 n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2;
381 csize = (csd[8] >> 6) + ((uint16_t)csd[7] << 2) + ((uint16_t)(csd[6] & 3) << 10) + 1;
381 csize = (csd[8] >> 6) + ((uint16_t)csd[7] << 2) + ((uint16_t)(csd[6] & 3) << 10) + 1;
382 *(uint32_t*)buff = (uint32_t)csize << (n - 9);
382 *(uint32_t*)buff = (uint32_t)csize << (n - 9);
383 }
383 }
384 res = RES_OK;
384 res = RES_OK;
385 }
385 }
386 break;
386 break;
387
387
388 case GET_SECTOR_SIZE : /* Get sector size in unit of byte (WORD) */
388 case GET_SECTOR_SIZE : /* Get sector size in unit of byte (WORD) */
389 *(uint16_t*)buff = 512;
389 *(uint16_t*)buff = 512;
390 res = RES_OK;
390 res = RES_OK;
391 break;
391 break;
392
392
393 case GET_BLOCK_SIZE : /* Get erase block size in unit of sector (DWORD) */
393 case GET_BLOCK_SIZE : /* Get erase block size in unit of sector (DWORD) */
394 if (((sdcardDev*)_this->phy)->CardType & CT_SD2) { /* SDC ver 2.00 */
394 if (((sdcardDev*)_this->phy)->CardType & CT_SD2) { /* SDC ver 2.00 */
395 if (sdcardsend_cmd(_this,ACMD13, 0) == 0) { /* Read SD status */
395 if (sdcardsend_cmd(_this,ACMD13, 0) == 0) { /* Read SD status */
396 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1);
396 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1);
397 if (sdcardrcvr_datablock (((sdcardDev*)_this->phy),csd, 16)) { /* Read partial block */
397 if (sdcardrcvr_datablock (((sdcardDev*)_this->phy),csd, 16)) { /* Read partial block */
398 for (n = 64 - 16; n; n--) ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1); /* Purge trailing data */
398 for (n = 64 - 16; n; n--) ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1); /* Purge trailing data */
399 *(uint32_t*)buff = 16UL << (csd[10] >> 4);
399 *(uint32_t*)buff = 16UL << (csd[10] >> 4);
400 res = RES_OK;
400 res = RES_OK;
401 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1);
401 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1);
402 }
402 }
403 }
403 }
404 } else { /* SDC ver 1.XX or MMC */
404 } else { /* SDC ver 1.XX or MMC */
405 if ((sdcardsend_cmd(_this,CMD9, 0) == 0) && sdcardrcvr_datablock (((sdcardDev*)_this->phy),csd, 16)) { /* Read CSD */
405 if ((sdcardsend_cmd(_this,CMD9, 0) == 0) && sdcardrcvr_datablock (((sdcardDev*)_this->phy),csd, 16)) { /* Read CSD */
406 if (((sdcardDev*)_this->phy)->CardType & CT_SD1) { /* SDC ver 1.XX */
406 if (((sdcardDev*)_this->phy)->CardType & CT_SD1) { /* SDC ver 1.XX */
407 *(uint32_t*)buff = (((csd[10] & 63) << 1) + ((uint16_t)(csd[11] & 128) >> 7) + 1) << ((csd[13] >> 6) - 1);
407 *(uint32_t*)buff = (((csd[10] & 63) << 1) + ((uint16_t)(csd[11] & 128) >> 7) + 1) << ((csd[13] >> 6) - 1);
408 } else { /* MMC */
408 } else { /* MMC */
409 *(uint32_t*)buff = ((uint16_t)((csd[10] & 124) >> 2) + 1) * (((csd[11] & 3) << 3) + ((csd[11] & 224) >> 5) + 1);
409 *(uint32_t*)buff = ((uint16_t)((csd[10] & 124) >> 2) + 1) * (((csd[11] & 3) << 3) + ((csd[11] & 224) >> 5) + 1);
410 }
410 }
411 res = RES_OK;
411 res = RES_OK;
412 }
412 }
413 }
413 }
414 break;
414 break;
415
415
416 case CTRL_ERASE_SECTOR : /* Erase a block of sectors (used when _USE_ERASE == 1) */
416 case CTRL_ERASE_SECTOR : /* Erase a block of sectors (used when _USE_ERASE == 1) */
417 if (!(((sdcardDev*)_this->phy)->CardType & CT_SDC)) break; /* Check if the card is SDC */
417 if (!(((sdcardDev*)_this->phy)->CardType & CT_SDC)) break; /* Check if the card is SDC */
418 if (sdcarddisk_ioctl(_this, MMC_GET_CSD, csd)) break; /* Get CSD */
418 if (sdcarddisk_ioctl(_this, MMC_GET_CSD, csd)) break; /* Get CSD */
419 if (!(csd[0] >> 6) && !(csd[10] & 0x40)) break; /* Check if sector erase can be applied to the card */
419 if (!(csd[0] >> 6) && !(csd[10] & 0x40)) break; /* Check if sector erase can be applied to the card */
420 dp = buff; st = dp[0]; ed = dp[1]; /* Load sector block */
420 dp = buff; st = dp[0]; ed = dp[1]; /* Load sector block */
421 if (!(((sdcardDev*)_this->phy)->CardType & CT_BLOCK)) {
421 if (!(((sdcardDev*)_this->phy)->CardType & CT_BLOCK)) {
422 st *= 512; ed *= 512;
422 st *= 512; ed *= 512;
423 }
423 }
424 if (sdcardsend_cmd(_this,CMD32, st) == 0 && sdcardsend_cmd(_this,CMD33, ed) == 0 && sdcardsend_cmd(_this,CMD38, 0) == 0 && sdcardwait_ready(((sdcardDev*)_this->phy))) /* Erase sector block */
424 if (sdcardsend_cmd(_this,CMD32, st) == 0 && sdcardsend_cmd(_this,CMD33, ed) == 0 && sdcardsend_cmd(_this,CMD38, 0) == 0 && sdcardwait_ready(((sdcardDev*)_this->phy))) /* Erase sector block */
425 res = RES_OK; /* FatFs does not check result of this command */
425 res = RES_OK; /* FatFs does not check result of this command */
426 break;
426 break;
427
427
428 /* Following command are not used by FatFs module */
428 /* Following command are not used by FatFs module */
429
429
430 case MMC_GET_TYPE : /* Get MMC/SDC type (BYTE) */
430 case MMC_GET_TYPE : /* Get MMC/SDC type (BYTE) */
431 *ptr = ((sdcardDev*)_this->phy)->CardType;
431 *ptr = ((sdcardDev*)_this->phy)->CardType;
432 res = RES_OK;
432 res = RES_OK;
433 break;
433 break;
434
434
435 case MMC_GET_CSD : /* Read CSD (16 bytes) */
435 case MMC_GET_CSD : /* Read CSD (16 bytes) */
436 if (sdcardsend_cmd(_this,CMD9, 0) == 0 /* READ_CSD */
436 if (sdcardsend_cmd(_this,CMD9, 0) == 0 /* READ_CSD */
437 && sdcardrcvr_datablock (((sdcardDev*)_this->phy),ptr, 16))
437 && sdcardrcvr_datablock (((sdcardDev*)_this->phy),ptr, 16))
438 res = RES_OK;
438 res = RES_OK;
439 break;
439 break;
440
440
441 case MMC_GET_CID : /* Read CID (16 bytes) */
441 case MMC_GET_CID : /* Read CID (16 bytes) */
442 if (sdcardsend_cmd(_this,CMD10, 0) == 0 /* READ_CID */
442 if (sdcardsend_cmd(_this,CMD10, 0) == 0 /* READ_CID */
443 && sdcardrcvr_datablock (((sdcardDev*)_this->phy),ptr, 16))
443 && sdcardrcvr_datablock (((sdcardDev*)_this->phy),ptr, 16))
444 res = RES_OK;
444 res = RES_OK;
445 break;
445 break;
446
446
447 case MMC_GET_OCR : /* Read OCR (4 bytes) */
447 case MMC_GET_OCR : /* Read OCR (4 bytes) */
448 if (sdcardsend_cmd(_this,CMD58, 0) == 0) { /* READ_OCR */
448 if (sdcardsend_cmd(_this,CMD58, 0) == 0) { /* READ_OCR */
449 //for (n = 4; n; n--) *ptr++ =
449 //for (n = 4; n; n--) *ptr++ =
450 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ptr, 4);
450 ((sdcardDev*)_this->phy)->rcvr_mmc(((sdcardDev*)_this->phy)->phy,ptr, 4);
451 res = RES_OK;
451 res = RES_OK;
452 }
452 }
453 break;
453 break;
454
454
455 case MMC_GET_SDSTAT : /* Read SD status (64 bytes) */
455 case MMC_GET_SDSTAT : /* Read SD status (64 bytes) */
456 if (sdcardsend_cmd(_this,ACMD13, 0) == 0) { /* SD_STATUS */
456 if (sdcardsend_cmd(_this,ACMD13, 0) == 0) { /* SD_STATUS */
457 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1);
457 ((sdcardDev*)_this->phy)->xmit_mmc(((sdcardDev*)_this->phy)->phy,&dummy, 1);
458 if (sdcardrcvr_datablock (((sdcardDev*)_this->phy),ptr, 64))
458 if (sdcardrcvr_datablock (((sdcardDev*)_this->phy),ptr, 64))
459 res = RES_OK;
459 res = RES_OK;
460 }
460 }
461 break;
461 break;
462
462
463 default:
463 default:
464 res = RES_PARERR;
464 res = RES_PARERR;
465 }
465 }
466
466
467 sdcarddeselect (_this);
467 sdcarddeselect (_this);
468
468
469 return res;
469 return res;
470 }
470 }
471
471
472
472
473
473
474 void sdcardspimake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy))
474 void sdcardspimake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy))
475 {
475 {
476 sdcard->phy = phy;
476 sdcard->phy = phy;
477 sdcard->rcvr_mmc = rcvr_mmc;
477 sdcard->rcvr_mmc = rcvr_mmc;
478 sdcard->xmit_mmc = xmit_mmc;
478 sdcard->xmit_mmc = xmit_mmc;
479 sdcard->setspeed = setspeed;
479 sdcard->setspeed = setspeed;
480 sdcard->getspeed = getspeed;
480 sdcard->getspeed = getspeed;
481 }
481 }
482
482
483 void sdcardspimakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected)
483 void sdcardspimakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected)
484 {
484 {
485 dev->phy=sdcard;
485 dev->phy=sdcard;
486 dev->select=select;
486 dev->select=select;
487 dev->power = power;
487 dev->power = power;
488 dev->detect = detect;
488 dev->detect = detect;
489 dev->writeprotected = writeprotected;
489 dev->writeprotected = writeprotected;
490 dev->write = sdcarddisk_write;
490 dev->write = sdcarddisk_write;
491 dev->read = sdcarddisk_read;
491 dev->read = sdcarddisk_read;
492 dev->ioctl = sdcarddisk_ioctl;
492 dev->ioctl = sdcarddisk_ioctl;
493 dev->initialize = sdcarddisk_initialize;
493 dev->initialize = sdcarddisk_initialize;
494 dev->status = sdcarddisk_status;
494 dev->status = sdcarddisk_status;
495 }
495 }
496
496
497
497
498
498
499
499
500
500
501
501
502
502
503
503
504
504
505
505
506
506
507
507
508
508
509
509
510
510
511
511
@@ -1,422 +1,422
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <ili9328.h>
22 #include <ili9328.h>
23 #include <stdio.h>
23 #include <stdio.h>
24 #include <stddef.h>
24 #include <stddef.h>
25 #include <core.h>
25 #include <core.h>
26 #include <math.h>
26 #include <math.h>
27
27
28 #ifdef __OPTIMIZED_MATH
28 #ifdef __OPTIMIZED_MATH
29 #include <optimised_math.h>
29 #include <optimised_math.h>
30 #endif
30 #endif
31
31
32
32
33 #define ilipaintLine(LCD,X,Y,W,buffer,buffsize) \
33 #define ilipaintLine(LCD,X,Y,W,buffer,buffsize) \
34 for(int l=0;l<1;l++)\
34 for(int l=0;l<1;l++)\
35 {\
35 {\
36 ili9328setFrame(LCD,X,Y,W,1);\
36 ili9328setFrame(LCD,X,Y,W,1);\
37 int rem=(W)%buffsize;\
37 int rem=(W)%buffsize;\
38 if(rem)LCD->interface->writeGRAM(buffer,rem);\
38 if(rem)LCD->interface->writeGRAM(buffer,rem);\
39 for(int i=rem;i<(W);i+=buffsize)\
39 for(int i=rem;i<(W);i+=buffsize)\
40 {\
40 {\
41 LCD->interface->writeGRAM(buffer,buffsize);\
41 LCD->interface->writeGRAM(buffer,buffsize);\
42 }\
42 }\
43 }
43 }
44
44
45 #define ilipaintHLineWithCont(LCD,X,Y,W,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
45 #define ilipaintHLineWithCont(LCD,X,Y,W,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
46 for(int l=0;l<1;l++)\
46 for(int l=0;l<1;l++)\
47 {\
47 {\
48 ili9328setFrame(LCD,X,Y,W,1);\
48 ili9328setFrame(LCD,X,Y,W,1);\
49 int rem=(ContSz)%buffContsize;\
49 int rem=(ContSz)%buffContsize;\
50 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
50 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
51 for(int i=rem;i<(ContSz);i+=buffContsize)\
51 for(int i=rem;i<(ContSz);i+=buffContsize)\
52 {\
52 {\
53 LCD->interface->writeGRAM(bufferCont,buffContsize);\
53 LCD->interface->writeGRAM(bufferCont,buffContsize);\
54 }\
54 }\
55 if((2*ContSz)<W) \
55 if((2*ContSz)<W) \
56 {\
56 {\
57 rem=(W-(2*ContSz))%buffIntsize;\
57 rem=(W-(2*ContSz))%buffIntsize;\
58 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
58 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
59 for(int i=rem;i<(W-(2*ContSz));i+=buffIntsize)\
59 for(int i=rem;i<(W-(2*ContSz));i+=buffIntsize)\
60 {\
60 {\
61 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
61 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
62 }\
62 }\
63 }\
63 }\
64 rem=(ContSz)%buffContsize;\
64 rem=(ContSz)%buffContsize;\
65 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
65 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
66 for(int i=rem;i<(ContSz);i+=buffContsize)\
66 for(int i=rem;i<(ContSz);i+=buffContsize)\
67 {\
67 {\
68 LCD->interface->writeGRAM(bufferCont,buffContsize);\
68 LCD->interface->writeGRAM(bufferCont,buffContsize);\
69 }\
69 }\
70 }\
70 }\
71
71
72
72
73 #define ilipaintVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
73 #define ilipaintVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
74 for(int l=0;l<1;l++)\
74 for(int l=0;l<1;l++)\
75 {\
75 {\
76 ili9328setFrame(LCD,X,Y,1,H);\
76 ili9328setFrame(LCD,X,Y,1,H);\
77 int rem=(ContSz)%buffContsize;\
77 int rem=(ContSz)%buffContsize;\
78 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
78 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
79 for(int i=rem;i<(ContSz);i+=buffContsize)\
79 for(int i=rem;i<(ContSz);i+=buffContsize)\
80 {\
80 {\
81 LCD->interface->writeGRAM(bufferCont,buffContsize);\
81 LCD->interface->writeGRAM(bufferCont,buffContsize);\
82 }\
82 }\
83 if((2*ContSz)<H) \
83 if((2*ContSz)<H) \
84 {\
84 {\
85 rem=(H-(2*ContSz))%buffIntsize;\
85 rem=(H-(2*ContSz))%buffIntsize;\
86 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
86 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
87 for(int i=rem;i<(H-(2*ContSz));i+=buffIntsize)\
87 for(int i=rem;i<(H-(2*ContSz));i+=buffIntsize)\
88 {\
88 {\
89 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
89 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
90 }\
90 }\
91 }\
91 }\
92 rem=(ContSz)%buffContsize;\
92 rem=(ContSz)%buffContsize;\
93 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
93 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
94 for(int i=rem;i<(ContSz);i+=buffContsize)\
94 for(int i=rem;i<(ContSz);i+=buffContsize)\
95 {\
95 {\
96 LCD->interface->writeGRAM(bufferCont,buffContsize);\
96 LCD->interface->writeGRAM(bufferCont,buffContsize);\
97 }\
97 }\
98 }\
98 }\
99
99
100
100
101 #define ilipaintHalfTopVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
101 #define ilipaintHalfTopVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
102 for(int l=0;l<1;l++)\
102 for(int l=0;l<1;l++)\
103 {\
103 {\
104 ili9328setFrame(LCD,X,Y,1,H);\
104 ili9328setFrame(LCD,X,Y,1,H);\
105 int rem=(ContSz)%buffContsize;\
105 int rem=(ContSz)%buffContsize;\
106 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
106 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
107 for(int i=rem;i<(ContSz);i+=buffContsize)\
107 for(int i=rem;i<(ContSz);i+=buffContsize)\
108 {\
108 {\
109 LCD->interface->writeGRAM(bufferCont,buffContsize);\
109 LCD->interface->writeGRAM(bufferCont,buffContsize);\
110 }\
110 }\
111 if(ContSz<H) \
111 if(ContSz<H) \
112 {\
112 {\
113 rem=(H-ContSz)%buffIntsize;\
113 rem=(H-ContSz)%buffIntsize;\
114 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
114 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
115 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
115 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
116 {\
116 {\
117 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
117 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
118 }\
118 }\
119 }\
119 }\
120 }\
120 }\
121
121
122
122
123 #define ilipaintHalfBottomVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
123 #define ilipaintHalfBottomVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
124 for(int l=0;l<1;l++)\
124 for(int l=0;l<1;l++)\
125 {\
125 {\
126 ili9328setFrame(LCD,X,Y,1,H);\
126 ili9328setFrame(LCD,X,Y,1,H);\
127 int rem;\
127 int rem;\
128 if(ContSz<H) \
128 if(ContSz<H) \
129 {\
129 {\
130 rem=(H-ContSz)%buffIntsize;\
130 rem=(H-ContSz)%buffIntsize;\
131 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
131 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
132 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
132 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
133 {\
133 {\
134 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
134 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
135 }\
135 }\
136 }\
136 }\
137 rem=(ContSz)%buffContsize;\
137 rem=(ContSz)%buffContsize;\
138 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
138 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
139 for(int i=rem;i<(ContSz);i+=buffContsize)\
139 for(int i=rem;i<(ContSz);i+=buffContsize)\
140 {\
140 {\
141 LCD->interface->writeGRAM(bufferCont,buffContsize);\
141 LCD->interface->writeGRAM(bufferCont,buffContsize);\
142 }\
142 }\
143 }\
143 }\
144
144
145
145
146 void ili9328setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress)
146 void ili9328setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress)
147 {
147 {
148 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,Haddress);
148 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,Haddress);
149 LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,Vaddress);
149 LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,Vaddress);
150 }
150 }
151
151
152 void ili9328refreshenable(struct LCD_t* LCD,int enable)
152 void ili9328refreshenable(struct LCD_t* LCD,int enable)
153 {
153 {
154 if(enable)
154 if(enable)
155 {
155 {
156 //LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE,0x1018);
156 //LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE,0x1018);
157 }
157 }
158 else
158 else
159 {
159 {
160 //LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE,0x1008);
160 //LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE,0x1008);
161
161
162 }
162 }
163 }
163 }
164
164
165 void ili9328setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H)
165 void ili9328setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H)
166 {
166 {
167 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,(uint32_t)X);
167 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,(uint32_t)X);
168 LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,(uint32_t)Y);
168 LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,(uint32_t)Y);
169 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION,(uint32_t)X);
169 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION,(uint32_t)X);
170 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION,(uint32_t)(W+X-1));
170 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION,(uint32_t)(W+X-1));
171 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION,(uint32_t)Y);
171 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION,(uint32_t)Y);
172 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSENDPOSITION,(uint32_t)(Y+H-1));
172 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSENDPOSITION,(uint32_t)(Y+H-1));
173 }
173 }
174
174
175 void ili9328paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height)
175 void ili9328paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height)
176 {
176 {
177 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height)))
177 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height)))
178 {
178 {
179 ili9328setFrame(LCD,Xpos,Ypos,Width,Height);
179 ili9328setFrame(LCD,Xpos,Ypos,Width,Height);
180 LCD->interface->writeGRAM(buffer,Width*Height);
180 LCD->interface->writeGRAM(buffer,Width*Height);
181 }
181 }
182 }
182 }
183
183
184 void ili9328paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
184 void ili9328paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
185 {
185 {
186 //Based on the mid point circle algorithm from Wikipedia
186 //Based on the mid point circle algorithm from Wikipedia
187 //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
187 //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
188 uint16_t innerbuffer[16];
188 uint16_t innerbuffer[16];
189 uint16_t outterbuffer[16];
189 uint16_t outterbuffer[16];
190 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
190 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
191 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
191 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
192 if(contSz<r)
192 if(contSz<r)
193 {
193 {
194 int error = -r,error_int = -r+contSz;
194 int error = -r,error_int = -r+contSz;
195 int x = r,x_int=r-contSz;
195 int x = r,x_int=r-contSz;
196 int y = 0,y_int=0;
196 int y = 0,y_int=0;
197 while (x >= y)
197 while (x >= y)
198 {
198 {
199 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos+y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
199 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos+y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
200 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos-y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
200 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos-y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
201 ilipaintHalfTopVLineWithCont(LCD,(Xpos+y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
201 ilipaintHalfTopVLineWithCont(LCD,(Xpos+y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
202 ilipaintHalfTopVLineWithCont(LCD,(Xpos-y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
202 ilipaintHalfTopVLineWithCont(LCD,(Xpos-y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
203 ilipaintHalfBottomVLineWithCont(LCD,(Xpos-y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
203 ilipaintHalfBottomVLineWithCont(LCD,(Xpos-y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
204 ilipaintHalfBottomVLineWithCont(LCD,(Xpos+y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
204 ilipaintHalfBottomVLineWithCont(LCD,(Xpos+y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
205 error += y;
205 error += y;
206 ++y;
206 ++y;
207 error += y;
207 error += y;
208 error_int += y_int;
208 error_int += y_int;
209 ++y_int;
209 ++y_int;
210 error_int += y_int;
210 error_int += y_int;
211 if(error >= 0)
211 if(error >= 0)
212 {
212 {
213 error -= x;
213 error -= x;
214 --x;
214 --x;
215 error -= x;
215 error -= x;
216 }
216 }
217 if(error_int >= 0)
217 if(error_int >= 0)
218 {
218 {
219 error_int -= x_int;
219 error_int -= x_int;
220 --x_int;
220 --x_int;
221 error_int -= x_int;
221 error_int -= x_int;
222 }
222 }
223 }
223 }
224
224
225
225
226
226
227 }
227 }
228
228
229 }
229 }
230
230
231 void ili9328paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
231 void ili9328paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
232 {
232 {
233 if(contSz<r)
233 if(contSz<r)
234 {
234 {
235 uint16_t innerbuffer[16];
235 uint16_t innerbuffer[16];
236 uint16_t outterbuffer[16];
236 uint16_t outterbuffer[16];
237 int32_t rr=(r*r),rr2=((r-contSz)*(r-contSz)),contSz2,Val1,Val2,X1,W,rem;
237 int32_t rr=(r*r),rr2=((r-contSz)*(r-contSz)),contSz2,Val1,Val2,X1,W,rem;
238 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
238 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
239 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
239 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
240 /* Y = b +/- sqrt[r^2 - (x - a)^2] */
240 /* Y = b +/- sqrt[r^2 - (x - a)^2] */
241 for(int32_t line=-r;line<r;line++)
241 for(int32_t line=-r;line<r;line++)
242 {
242 {
243 #ifdef __OPTIMIZED_MATH
243 #ifdef __OPTIMIZED_MATH
244 Val1 = (uint32_t)optimised_sqrt((float32_t)(rr - (line*line)) );
244 Val1 = (uint32_t)optimised_sqrt((float32_t)(rr - (line*line)) );
245 Val2 = (uint32_t)optimised_sqrt((float32_t)(rr2 - (line*line)) );
245 Val2 = (uint32_t)optimised_sqrt((float32_t)(rr2 - (line*line)) );
246 #else
246 #else
247 Val1 = sqrt( (double)(rr - ((line)*(line))) );
247 Val1 = sqrt( (double)(rr - ((line)*(line))) );
248 Val2 = sqrt( (double)(rr2 - ((line)*(line))) );
248 Val2 = sqrt( (double)(rr2 - ((line)*(line))) );
249 #endif
249 #endif
250 X1=Xpos - Val1;
250 X1=Xpos - Val1;
251 contSz2= Val1-Val2;
251 contSz2= Val1-Val2;
252 ili9328setFrame(LCD,X1,line+Ypos,2*Val1,1);
252 ili9328setFrame(LCD,X1,line+Ypos,2*Val1,1);
253 rem=(contSz2)%16;
253 rem=(contSz2)%16;
254 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
254 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
255 for(int i=rem;i<(contSz2);i+=16)
255 for(int i=rem;i<(contSz2);i+=16)
256 {
256 {
257 LCD->interface->writeGRAM(outterbuffer,16);
257 LCD->interface->writeGRAM(outterbuffer,16);
258 }
258 }
259
259
260 W=2*Val1;
260 W=2*Val1;
261 if(W>(2*contSz2))
261 if(W>(2*contSz2))
262 {
262 {
263 W-=2*contSz2;
263 W-=2*contSz2;
264 rem=(W)%16;
264 rem=(W)%16;
265 if(rem)LCD->interface->writeGRAM(innerbuffer,rem);
265 if(rem)LCD->interface->writeGRAM(innerbuffer,rem);
266 for(int i=rem;i<(W);i+=16)
266 for(int i=rem;i<(W);i+=16)
267 {
267 {
268 LCD->interface->writeGRAM(innerbuffer,16);
268 LCD->interface->writeGRAM(innerbuffer,16);
269 }
269 }
270 }
270 }
271
271
272 rem=(contSz2)%16;
272 rem=(contSz2)%16;
273 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
273 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
274 for(int i=rem;i<(contSz2);i+=16)
274 for(int i=rem;i<(contSz2);i+=16)
275 {
275 {
276 LCD->interface->writeGRAM(outterbuffer,16);
276 LCD->interface->writeGRAM(outterbuffer,16);
277 }
277 }
278 }
278 }
279 }
279 }
280 }
280 }
281
281
282
282
283
283
284
284
285 void ili9328paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
285 void ili9328paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
286 {
286 {
287 ili9328setFrame(LCD,Xpos,Ypos,w,h);
287 ili9328setFrame(LCD,Xpos,Ypos,w,h);
288 uint16_t tmp[32];
288 uint16_t tmp[32];
289 for(int i=0;i<32;i++)tmp[i]=fillColor;
289 for(int i=0;i<32;i++)tmp[i]=fillColor;
290 for(int i=0;i<(h*w);i+=32)
290 for(int i=0;i<(h*w);i+=32)
291 {
291 {
292 LCD->interface->writeGRAM(tmp,32);
292 LCD->interface->writeGRAM(tmp,32);
293 }
293 }
294 int rem=(w*h)%32;
294 int rem=(w*h)%32;
295 if(rem)LCD->interface->writeGRAM(tmp,rem);
295 if(rem)LCD->interface->writeGRAM(tmp,rem);
296 if(contSz)
296 if(contSz)
297 {
297 {
298 ili9328setFrame(LCD,Xpos,Ypos,w,contSz);
298 ili9328setFrame(LCD,Xpos,Ypos,w,contSz);
299 for(int i=0;i<32;i++)tmp[i]=contColor;
299 for(int i=0;i<32;i++)tmp[i]=contColor;
300 rem=(w*contSz)%32;
300 rem=(w*contSz)%32;
301 if(rem)LCD->interface->writeGRAM(tmp,rem);
301 if(rem)LCD->interface->writeGRAM(tmp,rem);
302 for(int i=rem;i<(w*contSz);i+=32)
302 for(int i=rem;i<(w*contSz);i+=32)
303 {
303 {
304 LCD->interface->writeGRAM(tmp,32);
304 LCD->interface->writeGRAM(tmp,32);
305 }
305 }
306
306
307 ili9328setFrame(LCD,Xpos,Ypos+h-contSz,w,contSz);
307 ili9328setFrame(LCD,Xpos,Ypos+h-contSz,w,contSz);
308 rem=(w*contSz)%32;
308 rem=(w*contSz)%32;
309 if(rem)LCD->interface->writeGRAM(tmp,rem);
309 if(rem)LCD->interface->writeGRAM(tmp,rem);
310 for(int i=rem;i<(w*contSz);i+=32)
310 for(int i=rem;i<(w*contSz);i+=32)
311 {
311 {
312 LCD->interface->writeGRAM(tmp,32);
312 LCD->interface->writeGRAM(tmp,32);
313 }
313 }
314
314
315 ili9328setFrame(LCD,Xpos,Ypos,contSz,h);
315 ili9328setFrame(LCD,Xpos,Ypos,contSz,h);
316 rem=(h*contSz)%32;
316 rem=(h*contSz)%32;
317 if(rem)LCD->interface->writeGRAM(tmp,rem);
317 if(rem)LCD->interface->writeGRAM(tmp,rem);
318 for(int i=rem;i<(h*contSz);i+=32)
318 for(int i=rem;i<(h*contSz);i+=32)
319 {
319 {
320 LCD->interface->writeGRAM(tmp,32);
320 LCD->interface->writeGRAM(tmp,32);
321 }
321 }
322
322
323 ili9328setFrame(LCD,Xpos+w-contSz,Ypos,contSz,h);
323 ili9328setFrame(LCD,Xpos+w-contSz,Ypos,contSz,h);
324 rem=(h*contSz)%32;
324 rem=(h*contSz)%32;
325 if(rem)LCD->interface->writeGRAM(tmp,rem);
325 if(rem)LCD->interface->writeGRAM(tmp,rem);
326 for(int i=rem;i<(h*contSz);i+=32)
326 for(int i=rem;i<(h*contSz);i+=32)
327 {
327 {
328 LCD->interface->writeGRAM(tmp,32);
328 LCD->interface->writeGRAM(tmp,32);
329 }
329 }
330 }
330 }
331 }
331 }
332
332
333 void ili9328paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color)
333 void ili9328paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color)
334 {
334 {
335 int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0;
335 int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0;
336 uint16_t tmp[w];
336 uint16_t tmp[w];
337 uint16_t linenum=0,charnum=0;
337 uint16_t linenum=0,charnum=0;
338 uint8_t line=0;
338 uint8_t line=0;
339 while(*buffer!='\0')
339 while(*buffer!='\0')
340 {
340 {
341 if(*buffer<32)*buffer=32;
341 if(*buffer<32)*buffer=32;
342 if(*buffer>127)*buffer=32;
342 if(*buffer>127)*buffer=32;
343 ili9328setFrame(LCD,Xpos+(charnum*w),Ypos-h,w,1);
343 ili9328setFrame(LCD,Xpos+(charnum*w),Ypos-h,w,1);
344 LCD->interface->readGRAM(tmp,w);
344 LCD->interface->readGRAM(tmp,w);
345 for(int i=0;i<(h*w);i++)
345 for(int i=0;i<(h*w);i++)
346 {
346 {
347 if( ((i%w)==0) ) //read current line to apply text pixmap
347 if( ((i%w)==0) ) //read current line to apply text pixmap
348 {
348 {
349 if(linenum++>0)
349 if(linenum++>0)
350 {
350 {
351 ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum -h,w,1);
351 ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum -h,w,1);
352 LCD->interface->writeGRAM(tmp,w);
352 LCD->interface->writeGRAM(tmp,w);
353 ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum + 1-h,w,1);
353 ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum + 1-h,w,1);
354 LCD->interface->readGRAM(tmp,w);
354 LCD->interface->readGRAM(tmp,w);
355 pix=0;
355 pix=0;
356 }
356 }
357 }
357 }
358 if((pix%8) == 0)
358 if((pix%8) == 0)
359 {
359 {
360 line=font->table[(((*buffer)-32)*h*bpl)+tableoffset++];
360 line=font->table[(((*buffer)-32)*h*bpl)+tableoffset++];
361 }
361 }
362 tmp[pix]=0;
362 tmp[pix]=0;
363 if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color;
363 if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color;
364 pix++;
364 pix++;
365 line>>=1;
365 line>>=1;
366 }
366 }
367 linenum=0;
367 linenum=0;
368 tableoffset=0;
368 tableoffset=0;
369 charnum++;
369 charnum++;
370 buffer++;
370 buffer++;
371 }
371 }
372 }
372 }
373
373
374 int ili9328init(struct LCD_t* LCD)
374 int ili9328init(struct LCD_t* LCD)
375 {
375 {
376 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL))
376 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL))
377 {
377 {
378 LCD->interface->writereg(ILI9328_REGISTER_DRIVEROUTPUTCONTROL1, 0x0100); // Driver Output Control Register (R01h)
378 LCD->interface->writereg(ILI9328_REGISTER_DRIVEROUTPUTCONTROL1, 0x0100); // Driver Output Control Register (R01h)
379 LCD->interface->writereg(ILI9328_REGISTER_LCDDRIVINGCONTROL, 0x0700); // LCD Driving Waveform Control (R02h)
379 LCD->interface->writereg(ILI9328_REGISTER_LCDDRIVINGCONTROL, 0x0700); // LCD Driving Waveform Control (R02h)
380 LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE, 0x1030); // Entry Mode (R03h)
380 LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE, 0x1030); // Entry Mode (R03h)
381 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL2, 0x0302);
381 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL2, 0x0302);
382 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL3, 0x0000);
382 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL3, 0x0000);
383 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL4, 0x0000); // Fmark On
383 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL4, 0x0000); // Fmark On
384 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL1, 0x0000); // Power Control 1 (R10h)
384 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL1, 0x0000); // Power Control 1 (R10h)
385 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL2, 0x0007); // Power Control 2 (R11h)
385 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL2, 0x0007); // Power Control 2 (R11h)
386 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL3, 0x0000); // Power Control 3 (R12h)
386 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL3, 0x0000); // Power Control 3 (R12h)
387 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL4, 0x0000); // Power Control 4 (R13h)
387 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL4, 0x0000); // Power Control 4 (R13h)
388 delay_100us(1000);
388 delay_100us(1000);
389 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL1, 0x14B0); // Power Control 1 (R10h)
389 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL1, 0x14B0); // Power Control 1 (R10h)
390 delay_100us(500);
390 delay_100us(500);
391 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL2, 0x0007); // Power Control 2 (R11h)
391 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL2, 0x0007); // Power Control 2 (R11h)
392 delay_100us(500);
392 delay_100us(500);
393 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL3, 0x008E); // Power Control 3 (R12h)
393 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL3, 0x008E); // Power Control 3 (R12h)
394 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL4, 0x0C00); // Power Control 4 (R13h)
394 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL4, 0x0C00); // Power Control 4 (R13h)
395 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL7, 0x0015); // NVM read data 2 (R29h)
395 LCD->interface->writereg(ILI9328_REGISTER_POWERCONTROL7, 0x0015); // NVM read data 2 (R29h)
396 delay_100us(500);
396 delay_100us(500);
397 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL1, 0x0000); // Gamma Control 1
397 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL1, 0x0000); // Gamma Control 1
398 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL2, 0x0107); // Gamma Control 2
398 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL2, 0x0107); // Gamma Control 2
399 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL3, 0x0000); // Gamma Control 3
399 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL3, 0x0000); // Gamma Control 3
400 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL4, 0x0203); // Gamma Control 4
400 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL4, 0x0203); // Gamma Control 4
401 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL5, 0x0402); // Gamma Control 5
401 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL5, 0x0402); // Gamma Control 5
402 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL6, 0x0000); // Gamma Control 6
402 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL6, 0x0000); // Gamma Control 6
403 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL7, 0x0207); // Gamma Control 7
403 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL7, 0x0207); // Gamma Control 7
404 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL8, 0x0000); // Gamma Control 8
404 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL8, 0x0000); // Gamma Control 8
405 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL9, 0x0203); // Gamma Control 9
405 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL9, 0x0203); // Gamma Control 9
406 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL10, 0x0403); // Gamma Control 10
406 LCD->interface->writereg(ILI9328_REGISTER_GAMMACONTROL10, 0x0403); // Gamma Control 10
407 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION, 0x0000); // Window Horizontal RAM Address Start (R50h)
407 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION, 0x0000); // Window Horizontal RAM Address Start (R50h)
408 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION, LCD->width - 1); // Window Horizontal RAM Address End (R51h)
408 LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION, LCD->width - 1); // Window Horizontal RAM Address End (R51h)
409 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION, 0X0000); // Window Vertical RAM Address Start (R52h)
409 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION, 0X0000); // Window Vertical RAM Address Start (R52h)
410 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSENDPOSITION, LCD->height - 1); // Window Vertical RAM Address End (R53h)
410 LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSENDPOSITION, LCD->height - 1); // Window Vertical RAM Address End (R53h)
411 LCD->interface->writereg(ILI9328_REGISTER_DRIVEROUTPUTCONTROL2, 0xa700); // Driver Output Control (R60h)
411 LCD->interface->writereg(ILI9328_REGISTER_DRIVEROUTPUTCONTROL2, 0xa700); // Driver Output Control (R60h)
412 LCD->interface->writereg(ILI9328_REGISTER_BASEIMAGEDISPLAYCONTROL, 0x0003); // Driver Output Control (R61h) - enable VLE
412 LCD->interface->writereg(ILI9328_REGISTER_BASEIMAGEDISPLAYCONTROL, 0x0003); // Driver Output Control (R61h) - enable VLE
413 LCD->interface->writereg(ILI9328_REGISTER_PANELINTERFACECONTROL1, 0X0010); // Panel Interface Control 1 (R90h)
413 LCD->interface->writereg(ILI9328_REGISTER_PANELINTERFACECONTROL1, 0X0010); // Panel Interface Control 1 (R90h)
414 // Display On
414 // Display On
415 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL1, 0x0133); // Display Control (R07h)
415 LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL1, 0x0133); // Display Control (R07h)
416 delay_100us(500);
416 delay_100us(500);
417 LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xFFFF);
417 LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xFFFF);
418 }
418 }
419 return 0;
419 return 0;
420 }
420 }
421
421
422
422
@@ -1,416 +1,416
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <ssd2119.h>
22 #include <ssd2119.h>
23 #include <stdio.h>
23 #include <stdio.h>
24 #include <stddef.h>
24 #include <stddef.h>
25 #include <core.h>
25 #include <core.h>
26 #include <math.h>
26 #include <math.h>
27
27
28 #ifdef __OPTIMIZED_MATH
28 #ifdef __OPTIMIZED_MATH
29 #include <optimised_math.h>
29 #include <optimised_math.h>
30 #endif
30 #endif
31
31
32 #define _delay_(del) for(volatile int _d_e_l_=0;_d_e_l_<(del);_d_e_l_++);
32 #define _delay_(del) for(volatile int _d_e_l_=0;_d_e_l_<(del);_d_e_l_++);
33
33
34 #define ilipaintLine(LCD,X,Y,W,buffer,buffsize) \
34 #define ilipaintLine(LCD,X,Y,W,buffer,buffsize) \
35 for(int l=0;l<1;l++)\
35 for(int l=0;l<1;l++)\
36 {\
36 {\
37 ssd2119setFrame(LCD,X,Y,W,1);\
37 ssd2119setFrame(LCD,X,Y,W,1);\
38 int rem=(W)%buffsize;\
38 int rem=(W)%buffsize;\
39 if(rem)LCD->interface->writeGRAM(buffer,rem);\
39 if(rem)LCD->interface->writeGRAM(buffer,rem);\
40 for(int i=rem;i<(W);i+=buffsize)\
40 for(int i=rem;i<(W);i+=buffsize)\
41 {\
41 {\
42 LCD->interface->writeGRAM(buffer,buffsize);\
42 LCD->interface->writeGRAM(buffer,buffsize);\
43 }\
43 }\
44 }
44 }
45
45
46 #define ilipaintHLineWithCont(LCD,X,Y,W,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
46 #define ilipaintHLineWithCont(LCD,X,Y,W,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
47 for(int l=0;l<1;l++)\
47 for(int l=0;l<1;l++)\
48 {\
48 {\
49 ssd2119setFrame(LCD,X,Y,W,1);\
49 ssd2119setFrame(LCD,X,Y,W,1);\
50 int rem=(ContSz)%buffContsize;\
50 int rem=(ContSz)%buffContsize;\
51 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
51 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
52 for(int i=rem;i<(ContSz);i+=buffContsize)\
52 for(int i=rem;i<(ContSz);i+=buffContsize)\
53 {\
53 {\
54 LCD->interface->writeGRAM(bufferCont,buffContsize);\
54 LCD->interface->writeGRAM(bufferCont,buffContsize);\
55 }\
55 }\
56 if((2*ContSz)<W) \
56 if((2*ContSz)<W) \
57 {\
57 {\
58 rem=(W-(2*ContSz))%buffIntsize;\
58 rem=(W-(2*ContSz))%buffIntsize;\
59 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
59 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
60 for(int i=rem;i<(W-(2*ContSz));i+=buffIntsize)\
60 for(int i=rem;i<(W-(2*ContSz));i+=buffIntsize)\
61 {\
61 {\
62 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
62 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
63 }\
63 }\
64 }\
64 }\
65 rem=(ContSz)%buffContsize;\
65 rem=(ContSz)%buffContsize;\
66 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
66 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
67 for(int i=rem;i<(ContSz);i+=buffContsize)\
67 for(int i=rem;i<(ContSz);i+=buffContsize)\
68 {\
68 {\
69 LCD->interface->writeGRAM(bufferCont,buffContsize);\
69 LCD->interface->writeGRAM(bufferCont,buffContsize);\
70 }\
70 }\
71 }\
71 }\
72
72
73
73
74 #define ilipaintVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
74 #define ilipaintVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
75 for(int l=0;l<1;l++)\
75 for(int l=0;l<1;l++)\
76 {\
76 {\
77 ssd2119setFrame(LCD,X,Y,1,H);\
77 ssd2119setFrame(LCD,X,Y,1,H);\
78 int rem=(ContSz)%buffContsize;\
78 int rem=(ContSz)%buffContsize;\
79 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
79 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
80 for(int i=rem;i<(ContSz);i+=buffContsize)\
80 for(int i=rem;i<(ContSz);i+=buffContsize)\
81 {\
81 {\
82 LCD->interface->writeGRAM(bufferCont,buffContsize);\
82 LCD->interface->writeGRAM(bufferCont,buffContsize);\
83 }\
83 }\
84 if((2*ContSz)<H) \
84 if((2*ContSz)<H) \
85 {\
85 {\
86 rem=(H-(2*ContSz))%buffIntsize;\
86 rem=(H-(2*ContSz))%buffIntsize;\
87 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
87 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
88 for(int i=rem;i<(H-(2*ContSz));i+=buffIntsize)\
88 for(int i=rem;i<(H-(2*ContSz));i+=buffIntsize)\
89 {\
89 {\
90 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
90 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
91 }\
91 }\
92 }\
92 }\
93 rem=(ContSz)%buffContsize;\
93 rem=(ContSz)%buffContsize;\
94 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
94 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
95 for(int i=rem;i<(ContSz);i+=buffContsize)\
95 for(int i=rem;i<(ContSz);i+=buffContsize)\
96 {\
96 {\
97 LCD->interface->writeGRAM(bufferCont,buffContsize);\
97 LCD->interface->writeGRAM(bufferCont,buffContsize);\
98 }\
98 }\
99 }\
99 }\
100
100
101
101
102 #define ilipaintHalfTopVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
102 #define ilipaintHalfTopVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
103 for(int l=0;l<1;l++)\
103 for(int l=0;l<1;l++)\
104 {\
104 {\
105 ssd2119setFrame(LCD,X,Y,1,H);\
105 ssd2119setFrame(LCD,X,Y,1,H);\
106 int rem=(ContSz)%buffContsize;\
106 int rem=(ContSz)%buffContsize;\
107 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
107 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
108 for(int i=rem;i<(ContSz);i+=buffContsize)\
108 for(int i=rem;i<(ContSz);i+=buffContsize)\
109 {\
109 {\
110 LCD->interface->writeGRAM(bufferCont,buffContsize);\
110 LCD->interface->writeGRAM(bufferCont,buffContsize);\
111 }\
111 }\
112 if(ContSz<H) \
112 if(ContSz<H) \
113 {\
113 {\
114 rem=(H-ContSz)%buffIntsize;\
114 rem=(H-ContSz)%buffIntsize;\
115 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
115 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
116 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
116 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
117 {\
117 {\
118 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
118 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
119 }\
119 }\
120 }\
120 }\
121 }\
121 }\
122
122
123
123
124 #define ilipaintHalfBottomVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
124 #define ilipaintHalfBottomVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \
125 for(int l=0;l<1;l++)\
125 for(int l=0;l<1;l++)\
126 {\
126 {\
127 ssd2119setFrame(LCD,X,Y,1,H);\
127 ssd2119setFrame(LCD,X,Y,1,H);\
128 int rem;\
128 int rem;\
129 if(ContSz<H) \
129 if(ContSz<H) \
130 {\
130 {\
131 rem=(H-ContSz)%buffIntsize;\
131 rem=(H-ContSz)%buffIntsize;\
132 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
132 if(rem)LCD->interface->writeGRAM(bufferInt,rem);\
133 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
133 for(int i=rem;i<(H-ContSz);i+=buffIntsize)\
134 {\
134 {\
135 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
135 LCD->interface->writeGRAM(bufferInt,buffIntsize);\
136 }\
136 }\
137 }\
137 }\
138 rem=(ContSz)%buffContsize;\
138 rem=(ContSz)%buffContsize;\
139 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
139 if(rem)LCD->interface->writeGRAM(bufferCont,rem);\
140 for(int i=rem;i<(ContSz);i+=buffContsize)\
140 for(int i=rem;i<(ContSz);i+=buffContsize)\
141 {\
141 {\
142 LCD->interface->writeGRAM(bufferCont,buffContsize);\
142 LCD->interface->writeGRAM(bufferCont,buffContsize);\
143 }\
143 }\
144 }\
144 }\
145
145
146
146
147 void ssd2119setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress)
147 void ssd2119setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress)
148 {
148 {
149 LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,Haddress);
149 LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,Haddress);
150 LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,Vaddress);
150 LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,Vaddress);
151 }
151 }
152
152
153 void ssd2119refreshenable(struct LCD_t* LCD,int enable)
153 void ssd2119refreshenable(struct LCD_t* LCD,int enable)
154 {
154 {
155 if(enable)
155 if(enable)
156 {
156 {
157 //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1018);
157 //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1018);
158 }
158 }
159 else
159 else
160 {
160 {
161 //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1008);
161 //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1008);
162
162
163 }
163 }
164 }
164 }
165
165
166 void ssd2119setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H)
166 void ssd2119setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H)
167 {
167 {
168 LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,(uint32_t)X);
168 LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,(uint32_t)X);
169 LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,(uint32_t)Y);
169 LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,(uint32_t)Y);
170 LCD->interface->writereg(SSD2119_REGISTER_H_RAM_START,(uint32_t)X);
170 LCD->interface->writereg(SSD2119_REGISTER_H_RAM_START,(uint32_t)X);
171 LCD->interface->writereg(SSD2119_REGISTER_H_RAM_END,(uint32_t)(W+X-1));
171 LCD->interface->writereg(SSD2119_REGISTER_H_RAM_END,(uint32_t)(W+X-1));
172 LCD->interface->writereg(SSD2119_REGISTER_V_RAM_POS,(((uint32_t)(Y+H-1))<<8) + (uint32_t)Y);
172 LCD->interface->writereg(SSD2119_REGISTER_V_RAM_POS,(((uint32_t)(Y+H-1))<<8) + (uint32_t)Y);
173 }
173 }
174
174
175 void ssd2119paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height)
175 void ssd2119paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height)
176 {
176 {
177 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height)))
177 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height)))
178 {
178 {
179 ssd2119setFrame(LCD,Xpos,Ypos,Width,Height);
179 ssd2119setFrame(LCD,Xpos,Ypos,Width,Height);
180 LCD->interface->writeGRAM(buffer,Width*Height);
180 LCD->interface->writeGRAM(buffer,Width*Height);
181 }
181 }
182 }
182 }
183
183
184 void ssd2119paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
184 void ssd2119paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
185 {
185 {
186 //Based on the mid point circle algorithm from Wikipedia
186 //Based on the mid point circle algorithm from Wikipedia
187 //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
187 //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
188 uint16_t innerbuffer[16];
188 uint16_t innerbuffer[16];
189 uint16_t outterbuffer[16];
189 uint16_t outterbuffer[16];
190 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
190 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
191 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
191 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
192 if(contSz<r)
192 if(contSz<r)
193 {
193 {
194 int error = -r,error_int = -r+contSz;
194 int error = -r,error_int = -r+contSz;
195 int x = r,x_int=r-contSz;
195 int x = r,x_int=r-contSz;
196 int y = 0,y_int=0;
196 int y = 0,y_int=0;
197 while (x >= y)
197 while (x >= y)
198 {
198 {
199 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos+y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
199 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos+y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
200 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos-y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
200 ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos-y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16);
201 ilipaintHalfTopVLineWithCont(LCD,(Xpos+y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
201 ilipaintHalfTopVLineWithCont(LCD,(Xpos+y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
202 ilipaintHalfTopVLineWithCont(LCD,(Xpos-y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
202 ilipaintHalfTopVLineWithCont(LCD,(Xpos-y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
203 ilipaintHalfBottomVLineWithCont(LCD,(Xpos-y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
203 ilipaintHalfBottomVLineWithCont(LCD,(Xpos-y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
204 ilipaintHalfBottomVLineWithCont(LCD,(Xpos+y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
204 ilipaintHalfBottomVLineWithCont(LCD,(Xpos+y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16);
205 error += y;
205 error += y;
206 ++y;
206 ++y;
207 error += y;
207 error += y;
208 error_int += y_int;
208 error_int += y_int;
209 ++y_int;
209 ++y_int;
210 error_int += y_int;
210 error_int += y_int;
211 if(error >= 0)
211 if(error >= 0)
212 {
212 {
213 error -= x;
213 error -= x;
214 --x;
214 --x;
215 error -= x;
215 error -= x;
216 }
216 }
217 if(error_int >= 0)
217 if(error_int >= 0)
218 {
218 {
219 error_int -= x_int;
219 error_int -= x_int;
220 --x_int;
220 --x_int;
221 error_int -= x_int;
221 error_int -= x_int;
222 }
222 }
223 }
223 }
224
224
225
225
226
226
227 }
227 }
228
228
229 }
229 }
230
230
231 void ssd2119paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
231 void ssd2119paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
232 {
232 {
233 if(contSz<r)
233 if(contSz<r)
234 {
234 {
235 uint16_t innerbuffer[16];
235 uint16_t innerbuffer[16];
236 uint16_t outterbuffer[16];
236 uint16_t outterbuffer[16];
237 int32_t rr=(r*r),rr2=((r-contSz)*(r-contSz)),contSz2,Val1,Val2,X1,W,rem;
237 int32_t rr=(r*r),rr2=((r-contSz)*(r-contSz)),contSz2,Val1,Val2,X1,W,rem;
238 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
238 for(int i=0;i<16;i++)innerbuffer[i]=fillColor;
239 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
239 for(int i=0;i<16;i++)outterbuffer[i]=contColor;
240 /* Y = b +/- sqrt[r^2 - (x - a)^2] */
240 /* Y = b +/- sqrt[r^2 - (x - a)^2] */
241 for(int32_t line=-r;line<r;line++)
241 for(int32_t line=-r;line<r;line++)
242 {
242 {
243 #ifdef __OPTIMIZED_MATH
243 #ifdef __OPTIMIZED_MATH
244 Val1 = (uint32_t)optimised_sqrt((float32_t)(rr - (line*line)) );
244 Val1 = (uint32_t)optimised_sqrt((float32_t)(rr - (line*line)) );
245 Val2 = (uint32_t)optimised_sqrt((float32_t)(rr2 - (line*line)) );
245 Val2 = (uint32_t)optimised_sqrt((float32_t)(rr2 - (line*line)) );
246 #else
246 #else
247 Val1 = sqrt( (double)(rr - ((line)*(line))) );
247 Val1 = sqrt( (double)(rr - ((line)*(line))) );
248 Val2 = sqrt( (double)(rr2 - ((line)*(line))) );
248 Val2 = sqrt( (double)(rr2 - ((line)*(line))) );
249 #endif
249 #endif
250 X1=Xpos - Val1;
250 X1=Xpos - Val1;
251 contSz2= Val1-Val2;
251 contSz2= Val1-Val2;
252 ssd2119setFrame(LCD,X1,line+Ypos,2*Val1,1);
252 ssd2119setFrame(LCD,X1,line+Ypos,2*Val1,1);
253 rem=(contSz2)%16;
253 rem=(contSz2)%16;
254 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
254 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
255 for(int i=rem;i<(contSz2);i+=16)
255 for(int i=rem;i<(contSz2);i+=16)
256 {
256 {
257 LCD->interface->writeGRAM(outterbuffer,16);
257 LCD->interface->writeGRAM(outterbuffer,16);
258 }
258 }
259
259
260 W=2*Val1;
260 W=2*Val1;
261 if(W>(2*contSz2))
261 if(W>(2*contSz2))
262 {
262 {
263 W-=2*contSz2;
263 W-=2*contSz2;
264 rem=(W)%16;
264 rem=(W)%16;
265 if(rem)LCD->interface->writeGRAM(innerbuffer,rem);
265 if(rem)LCD->interface->writeGRAM(innerbuffer,rem);
266 for(int i=rem;i<(W);i+=16)
266 for(int i=rem;i<(W);i+=16)
267 {
267 {
268 LCD->interface->writeGRAM(innerbuffer,16);
268 LCD->interface->writeGRAM(innerbuffer,16);
269 }
269 }
270 }
270 }
271
271
272 rem=(contSz2)%16;
272 rem=(contSz2)%16;
273 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
273 if(rem)LCD->interface->writeGRAM(outterbuffer,rem);
274 for(int i=rem;i<(contSz2);i+=16)
274 for(int i=rem;i<(contSz2);i+=16)
275 {
275 {
276 LCD->interface->writeGRAM(outterbuffer,16);
276 LCD->interface->writeGRAM(outterbuffer,16);
277 }
277 }
278 }
278 }
279 }
279 }
280 }
280 }
281
281
282
282
283
283
284
284
285 void ssd2119paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
285 void ssd2119paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor)
286 {
286 {
287 ssd2119setFrame(LCD,Xpos,Ypos,w,h);
287 ssd2119setFrame(LCD,Xpos,Ypos,w,h);
288 uint16_t tmp[32];
288 uint16_t tmp[32];
289 for(int i=0;i<32;i++)tmp[i]=fillColor;
289 for(int i=0;i<32;i++)tmp[i]=fillColor;
290 for(int i=0;i<(h*w);i+=32)
290 for(int i=0;i<(h*w);i+=32)
291 {
291 {
292 LCD->interface->writeGRAM(tmp,32);
292 LCD->interface->writeGRAM(tmp,32);
293 }
293 }
294 int rem=(w*h)%32;
294 int rem=(w*h)%32;
295 if(rem)LCD->interface->writeGRAM(tmp,rem);
295 if(rem)LCD->interface->writeGRAM(tmp,rem);
296 if(contSz)
296 if(contSz)
297 {
297 {
298 ssd2119setFrame(LCD,Xpos,Ypos,w,contSz);
298 ssd2119setFrame(LCD,Xpos,Ypos,w,contSz);
299 for(int i=0;i<32;i++)tmp[i]=contColor;
299 for(int i=0;i<32;i++)tmp[i]=contColor;
300 rem=(w*contSz)%32;
300 rem=(w*contSz)%32;
301 if(rem)LCD->interface->writeGRAM(tmp,rem);
301 if(rem)LCD->interface->writeGRAM(tmp,rem);
302 for(int i=rem;i<(w*contSz);i+=32)
302 for(int i=rem;i<(w*contSz);i+=32)
303 {
303 {
304 LCD->interface->writeGRAM(tmp,32);
304 LCD->interface->writeGRAM(tmp,32);
305 }
305 }
306
306
307 ssd2119setFrame(LCD,Xpos,Ypos+h-contSz,w,contSz);
307 ssd2119setFrame(LCD,Xpos,Ypos+h-contSz,w,contSz);
308 rem=(w*contSz)%32;
308 rem=(w*contSz)%32;
309 if(rem)LCD->interface->writeGRAM(tmp,rem);
309 if(rem)LCD->interface->writeGRAM(tmp,rem);
310 for(int i=rem;i<(w*contSz);i+=32)
310 for(int i=rem;i<(w*contSz);i+=32)
311 {
311 {
312 LCD->interface->writeGRAM(tmp,32);
312 LCD->interface->writeGRAM(tmp,32);
313 }
313 }
314
314
315 ssd2119setFrame(LCD,Xpos,Ypos,contSz,h);
315 ssd2119setFrame(LCD,Xpos,Ypos,contSz,h);
316 rem=(h*contSz)%32;
316 rem=(h*contSz)%32;
317 if(rem)LCD->interface->writeGRAM(tmp,rem);
317 if(rem)LCD->interface->writeGRAM(tmp,rem);
318 for(int i=rem;i<(h*contSz);i+=32)
318 for(int i=rem;i<(h*contSz);i+=32)
319 {
319 {
320 LCD->interface->writeGRAM(tmp,32);
320 LCD->interface->writeGRAM(tmp,32);
321 }
321 }
322
322
323 ssd2119setFrame(LCD,Xpos+w-contSz,Ypos,contSz,h);
323 ssd2119setFrame(LCD,Xpos+w-contSz,Ypos,contSz,h);
324 rem=(h*contSz)%32;
324 rem=(h*contSz)%32;
325 if(rem)LCD->interface->writeGRAM(tmp,rem);
325 if(rem)LCD->interface->writeGRAM(tmp,rem);
326 for(int i=rem;i<(h*contSz);i+=32)
326 for(int i=rem;i<(h*contSz);i+=32)
327 {
327 {
328 LCD->interface->writeGRAM(tmp,32);
328 LCD->interface->writeGRAM(tmp,32);
329 }
329 }
330 }
330 }
331 }
331 }
332
332
333 void ssd2119paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color)
333 void ssd2119paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color)
334 {
334 {
335 int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0;
335 int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0;
336 uint16_t tmp[w];
336 uint16_t tmp[w];
337 uint16_t linenum=0,charnum=0;
337 uint16_t linenum=0,charnum=0;
338 uint8_t line=0;
338 uint8_t line=0;
339 while(*buffer!='\0')
339 while(*buffer!='\0')
340 {
340 {
341 ssd2119setFrame(LCD,Xpos+(charnum*w),Ypos-h,w,1);
341 ssd2119setFrame(LCD,Xpos+(charnum*w),Ypos-h,w,1);
342 LCD->interface->readGRAM(tmp,w);
342 LCD->interface->readGRAM(tmp,w);
343 for(int i=0;i<(h*w);i++)
343 for(int i=0;i<(h*w);i++)
344 {
344 {
345 if( ((i%w)==0) ) //read current line to apply text pixmap
345 if( ((i%w)==0) ) //read current line to apply text pixmap
346 {
346 {
347 if(linenum++>0)
347 if(linenum++>0)
348 {
348 {
349 ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum -h,w,1); // TODO remove -10 and generate good fonts!
349 ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum -h,w,1); // TODO remove -10 and generate good fonts!
350 LCD->interface->writeGRAM(tmp,w);
350 LCD->interface->writeGRAM(tmp,w);
351 ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum + 1-h,w,1);
351 ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum + 1-h,w,1);
352 LCD->interface->readGRAM(tmp,w);
352 LCD->interface->readGRAM(tmp,w);
353 pix=0;
353 pix=0;
354 }
354 }
355 }
355 }
356 if((pix%8) == 0)
356 if((pix%8) == 0)
357 {
357 {
358 line=font->table[(((*buffer)-32)*h*bpl)+tableoffset++];
358 line=font->table[(((*buffer)-32)*h*bpl)+tableoffset++];
359 }
359 }
360 if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color;
360 if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color;
361 pix++;
361 pix++;
362 line>>=1;
362 line>>=1;
363 }
363 }
364 linenum=0;
364 linenum=0;
365 tableoffset=0;
365 tableoffset=0;
366 charnum++;
366 charnum++;
367 buffer++;
367 buffer++;
368 }
368 }
369 }
369 }
370
370
371
371
372 int ssd2119init(struct LCD_t* LCD)
372 int ssd2119init(struct LCD_t* LCD)
373 {
373 {
374 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL))
374 if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL))
375 {
375 {
376 LCD->interface->writereg(0x28,0x0006); // VCOM OTP - Page 55-56 of SSD2119 datasheet
376 LCD->interface->writereg(0x28,0x0006); // VCOM OTP - Page 55-56 of SSD2119 datasheet
377 LCD->interface->writereg(0x00,0x0001); // start Oscillator - Page 36 of SSD2119 datasheet
377 LCD->interface->writereg(0x00,0x0001); // start Oscillator - Page 36 of SSD2119 datasheet
378 LCD->interface->writereg(0x10,0x0000); // Sleep mode - Page 49 of SSD2119 datasheet
378 LCD->interface->writereg(0x10,0x0000); // Sleep mode - Page 49 of SSD2119 datasheet
379 LCD->interface->writereg(0x01,0x72ef); // Driver Output Control - Page 36-39 of SSD2119 datasheet
379 LCD->interface->writereg(0x01,0x72ef); // Driver Output Control - Page 36-39 of SSD2119 datasheet
380 LCD->interface->writereg(0x02,0x0600); // LCD Driving Waveform Control - Page 40-42 of SSD2119 datasheet
380 LCD->interface->writereg(0x02,0x0600); // LCD Driving Waveform Control - Page 40-42 of SSD2119 datasheet
381 LCD->interface->writereg(0x03,0x6a38); // Power Control 1 - Page 43-44 of SSD2119 datasheet
381 LCD->interface->writereg(0x03,0x6a38); // Power Control 1 - Page 43-44 of SSD2119 datasheet
382 LCD->interface->writereg(0x11,0x6870); // Entry Mode - Page 50-52 of SSD2119 datasheet
382 LCD->interface->writereg(0x11,0x6870); // Entry Mode - Page 50-52 of SSD2119 datasheet
383
383
384 // RAM WRITE DATA MASK
384 // RAM WRITE DATA MASK
385 LCD->interface->writereg(0x0f,0x0000); // Gate Scan Position - Page 49 of SSD2119 datasheet
385 LCD->interface->writereg(0x0f,0x0000); // Gate Scan Position - Page 49 of SSD2119 datasheet
386 // RAM WRITE DATA MASK
386 // RAM WRITE DATA MASK
387 LCD->interface->writereg(0x0b,0x5308); // Frame Cycle Control - Page 45 of SSD2119 datasheet
387 LCD->interface->writereg(0x0b,0x5308); // Frame Cycle Control - Page 45 of SSD2119 datasheet
388 LCD->interface->writereg(0x0c,0x0003); // Power Control 2 - Page 47 of SSD2119 datasheet
388 LCD->interface->writereg(0x0c,0x0003); // Power Control 2 - Page 47 of SSD2119 datasheet
389 LCD->interface->writereg(0x0d,0x000a); // Power Control 3 - Page 48 of SSD2119 datasheet
389 LCD->interface->writereg(0x0d,0x000a); // Power Control 3 - Page 48 of SSD2119 datasheet
390 LCD->interface->writereg(0x0e,0x2e00); // Power Control 4 - Page 48 of SSD2119 datasheet
390 LCD->interface->writereg(0x0e,0x2e00); // Power Control 4 - Page 48 of SSD2119 datasheet
391 LCD->interface->writereg(0x1e,0x00be); // Power Control 5 - Page 53 of SSD2119 datasheet
391 LCD->interface->writereg(0x1e,0x00be); // Power Control 5 - Page 53 of SSD2119 datasheet
392 LCD->interface->writereg(0x25,0x8000); // Frame Frequency Control - Page 53 of SSD2119 datasheet
392 LCD->interface->writereg(0x25,0x8000); // Frame Frequency Control - Page 53 of SSD2119 datasheet
393 LCD->interface->writereg(0x26,0x7800); // Analog setting - Page 54 of SSD2119 datasheet
393 LCD->interface->writereg(0x26,0x7800); // Analog setting - Page 54 of SSD2119 datasheet
394 LCD->interface->writereg(0x4e,0x0000); // Ram Address Set - Page 58 of SSD2119 datasheet
394 LCD->interface->writereg(0x4e,0x0000); // Ram Address Set - Page 58 of SSD2119 datasheet
395 LCD->interface->writereg(0x4f,0x0000); // Ram Address Set - Page 58 of SSD2119 datasheet
395 LCD->interface->writereg(0x4f,0x0000); // Ram Address Set - Page 58 of SSD2119 datasheet
396 LCD->interface->writereg(0x12,0x08d9); // Sleep mode - Page 49 of SSD2119 datasheet
396 LCD->interface->writereg(0x12,0x08d9); // Sleep mode - Page 49 of SSD2119 datasheet
397
397
398 // -----------------Adjust the Gamma Curve----//
398 // -----------------Adjust the Gamma Curve----//
399 LCD->interface->writereg(0x30,0x0000); //0007
399 LCD->interface->writereg(0x30,0x0000); //0007
400 LCD->interface->writereg(0x31,0x0104); //0203
400 LCD->interface->writereg(0x31,0x0104); //0203
401 LCD->interface->writereg(0x32,0x0100); //0001
401 LCD->interface->writereg(0x32,0x0100); //0001
402 LCD->interface->writereg(0x33,0x0305); //0007
402 LCD->interface->writereg(0x33,0x0305); //0007
403 LCD->interface->writereg(0x34,0x0505); //0007
403 LCD->interface->writereg(0x34,0x0505); //0007
404 LCD->interface->writereg(0x35,0x0305); //0407
404 LCD->interface->writereg(0x35,0x0305); //0407
405 LCD->interface->writereg(0x36,0x0707); //0407
405 LCD->interface->writereg(0x36,0x0707); //0407
406 LCD->interface->writereg(0x37,0x0300); //0607
406 LCD->interface->writereg(0x37,0x0300); //0607
407 LCD->interface->writereg(0x3a,0x1200); //0106
407 LCD->interface->writereg(0x3a,0x1200); //0106
408 LCD->interface->writereg(0x3b,0x0800);
408 LCD->interface->writereg(0x3b,0x0800);
409 LCD->interface->writereg(0x07,0x0033); // Display Control - Page 45 of SSD2119 datasheet
409 LCD->interface->writereg(0x07,0x0033); // Display Control - Page 45 of SSD2119 datasheet
410 }
410 }
411 return 0;
411 return 0;
412 }
412 }
413
413
414
414
415
415
416
416
@@ -1,1977 +1,1977
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <fonts.h>
22 #include <fonts.h>
23
23
24 const uint8_t ComicSansMS_18_TBL[] = {
24 const uint8_t ComicSansMS_18_TBL[] = {
25 /* Character Data - Index: 32 */
25 /* Character Data - Index: 32 */
26 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
26 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
27
27
28 /* Character Data - Index: 33 */
28 /* Character Data - Index: 33 */
29 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
29 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
30
30
31 /* Character Data - Index: 34 */
31 /* Character Data - Index: 34 */
32 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
32 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
33
33
34 /* Character Data - Index: 35 */
34 /* Character Data - Index: 35 */
35 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x02,0x20,0x02,0x20,0x02,0xFC,0x07,0x10,0x01,0x08,0x01,0xFE,0x03,0x88,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
35 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x02,0x20,0x02,0x20,0x02,0xFC,0x07,0x10,0x01,0x08,0x01,0xFE,0x03,0x88,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
36
36
37 /* Character Data - Index: 36 */
37 /* Character Data - Index: 36 */
38 0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0xF8,0x00,0x14,0x00,0x14,0x00,0x14,0x00,0x38,0x00,0x50,0x00,0x90,0x00,0x90,0x00,0x50,0x00,0x3C,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
38 0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0xF8,0x00,0x14,0x00,0x14,0x00,0x14,0x00,0x38,0x00,0x50,0x00,0x90,0x00,0x90,0x00,0x50,0x00,0x3C,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
39
39
40 /* Character Data - Index: 37 */
40 /* Character Data - Index: 37 */
41 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x01,0xA4,0x00,0xA4,0x00,0xD8,0x00,0x40,0x00,0x40,0x00,0x20,0x03,0xA0,0x04,0x90,0x04,0x10,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
41 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x01,0xA4,0x00,0xA4,0x00,0xD8,0x00,0x40,0x00,0x40,0x00,0x20,0x03,0xA0,0x04,0x90,0x04,0x10,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
42
42
43 /* Character Data - Index: 38 */
43 /* Character Data - Index: 38 */
44 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0xA0,0x00,0xA0,0x00,0x60,0x00,0x70,0x00,0x48,0x01,0x44,0x01,0x84,0x00,0xC4,0x01,0x78,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
44 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0xA0,0x00,0xA0,0x00,0x60,0x00,0x70,0x00,0x48,0x01,0x44,0x01,0x84,0x00,0xC4,0x01,0x78,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
45
45
46 /* Character Data - Index: 39 */
46 /* Character Data - Index: 39 */
47 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
47 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48
48
49 /* Character Data - Index: 40 */
49 /* Character Data - Index: 40 */
50 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x00,0x00,
50 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x00,0x00,
51
51
52 /* Character Data - Index: 41 */
52 /* Character Data - Index: 41 */
53 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x00,0x00,
53 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x00,0x00,
54
54
55 /* Character Data - Index: 42 */
55 /* Character Data - Index: 42 */
56 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x7E,0x00,0x18,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
56 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x7E,0x00,0x18,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57
57
58 /* Character Data - Index: 43 */
58 /* Character Data - Index: 43 */
59 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
59 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
60
60
61 /* Character Data - Index: 44 */
61 /* Character Data - Index: 44 */
62 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
62 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
63
63
64 /* Character Data - Index: 45 */
64 /* Character Data - Index: 45 */
65 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
65 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
66
66
67 /* Character Data - Index: 46 */
67 /* Character Data - Index: 46 */
68 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
68 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
69
69
70 /* Character Data - Index: 47 */
70 /* Character Data - Index: 47 */
71 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x18,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
71 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x18,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
72
72
73 /* Character Data - Index: 48 */
73 /* Character Data - Index: 48 */
74 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x48,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
74 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x48,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
75
75
76 /* Character Data - Index: 49 */
76 /* Character Data - Index: 49 */
77 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
78
78
79 /* Character Data - Index: 50 */
79 /* Character Data - Index: 50 */
80 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x30,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
80 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x30,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
81
81
82 /* Character Data - Index: 51 */
82 /* Character Data - Index: 51 */
83 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x40,0x00,0x40,0x00,0x38,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
83 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x40,0x00,0x40,0x00,0x38,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
84
84
85 /* Character Data - Index: 52 */
85 /* Character Data - Index: 52 */
86 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x60,0x00,0x50,0x00,0x48,0x00,0x44,0x00,0x42,0x00,0xFE,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
86 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x60,0x00,0x50,0x00,0x48,0x00,0x44,0x00,0x42,0x00,0xFE,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
87
87
88 /* Character Data - Index: 53 */
88 /* Character Data - Index: 53 */
89 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x74,0x00,0x8C,0x00,0x84,0x00,0x80,0x00,0x80,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
89 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x74,0x00,0x8C,0x00,0x84,0x00,0x80,0x00,0x80,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
90
90
91 /* Character Data - Index: 54 */
91 /* Character Data - Index: 54 */
92 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x7C,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
92 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x7C,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
93
93
94 /* Character Data - Index: 55 */
94 /* Character Data - Index: 55 */
95 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
95 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
96
96
97 /* Character Data - Index: 56 */
97 /* Character Data - Index: 56 */
98 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
98 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99
99
100 /* Character Data - Index: 57 */
100 /* Character Data - Index: 57 */
101 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
101 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x78,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
102
102
103 /* Character Data - Index: 58 */
103 /* Character Data - Index: 58 */
104 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
104 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
105
105
106 /* Character Data - Index: 59 */
106 /* Character Data - Index: 59 */
107 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x06,0x00,0x02,0x00,0x00,0x00,0x00,0x00,
107 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x06,0x00,0x02,0x00,0x00,0x00,0x00,0x00,
108
108
109 /* Character Data - Index: 60 */
109 /* Character Data - Index: 60 */
110 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x06,0x00,0x08,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
110 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x06,0x00,0x08,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
111
111
112 /* Character Data - Index: 61 */
112 /* Character Data - Index: 61 */
113 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
113 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
114
114
115 /* Character Data - Index: 62 */
115 /* Character Data - Index: 62 */
116 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x18,0x00,0x04,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
116 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x18,0x00,0x04,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
117
117
118 /* Character Data - Index: 63 */
118 /* Character Data - Index: 63 */
119 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x60,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
119 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x60,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
120
120
121 /* Character Data - Index: 64 */
121 /* Character Data - Index: 64 */
122 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x0C,0x03,0x64,0x06,0x32,0x04,0xCA,0x04,0xCA,0x04,0x72,0x03,0x02,0x00,0x04,0x00,0x08,0x02,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
122 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x0C,0x03,0x64,0x06,0x32,0x04,0xCA,0x04,0xCA,0x04,0x72,0x03,0x02,0x00,0x04,0x00,0x08,0x02,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
123
123
124 /* Character Data - Index: 65 */
124 /* Character Data - Index: 65 */
125 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0xA0,0x00,0x90,0x00,0x90,0x00,0xF8,0x00,0x08,0x01,0x04,0x01,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
125 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0xA0,0x00,0x90,0x00,0x90,0x00,0xF8,0x00,0x08,0x01,0x04,0x01,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
126
126
127 /* Character Data - Index: 66 */
127 /* Character Data - Index: 66 */
128 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x24,0x00,0x7C,0x00,0x84,0x00,0x84,0x00,0x44,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
128 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x24,0x00,0x7C,0x00,0x84,0x00,0x84,0x00,0x44,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
129
129
130 /* Character Data - Index: 67 */
130 /* Character Data - Index: 67 */
131 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x88,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x82,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
131 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x88,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x82,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
132
132
133 /* Character Data - Index: 68 */
133 /* Character Data - Index: 68 */
134 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x34,0x00,0x44,0x00,0x84,0x00,0x04,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
134 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x34,0x00,0x44,0x00,0x84,0x00,0x04,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
135
135
136 /* Character Data - Index: 69 */
136 /* Character Data - Index: 69 */
137 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
137 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
138
138
139 /* Character Data - Index: 70 */
139 /* Character Data - Index: 70 */
140 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
140 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
141
141
142 /* Character Data - Index: 71 */
142 /* Character Data - Index: 71 */
143 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x88,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0xF2,0x01,0x02,0x01,0x82,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
143 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x88,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0xF2,0x01,0x02,0x01,0x82,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
144
144
145 /* Character Data - Index: 72 */
145 /* Character Data - Index: 72 */
146 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0xFC,0x03,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
146 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0xFC,0x03,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
147
147
148 /* Character Data - Index: 73 */
148 /* Character Data - Index: 73 */
149 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
149 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
150
150
151 /* Character Data - Index: 74 */
151 /* Character Data - Index: 74 */
152 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x01,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x44,0x00,0x44,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
152 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x01,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x44,0x00,0x44,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
153
153
154 /* Character Data - Index: 75 */
154 /* Character Data - Index: 75 */
155 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x00,0x44,0x00,0x24,0x00,0x14,0x00,0x0C,0x00,0x0C,0x00,0x14,0x00,0x24,0x00,0x44,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
155 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x00,0x44,0x00,0x24,0x00,0x14,0x00,0x0C,0x00,0x0C,0x00,0x14,0x00,0x24,0x00,0x44,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
156
156
157 /* Character Data - Index: 76 */
157 /* Character Data - Index: 76 */
158 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
158 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
159
159
160 /* Character Data - Index: 77 */
160 /* Character Data - Index: 77 */
161 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x10,0x01,0x10,0x01,0x90,0x01,0xA8,0x02,0xA8,0x02,0xA8,0x02,0xA4,0x02,0x44,0x04,0x44,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
161 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x10,0x01,0x10,0x01,0x90,0x01,0xA8,0x02,0xA8,0x02,0xA8,0x02,0xA4,0x02,0x44,0x04,0x44,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
162
162
163 /* Character Data - Index: 78 */
163 /* Character Data - Index: 78 */
164 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x06,0x02,0x0A,0x02,0x0A,0x02,0x12,0x02,0x22,0x02,0x42,0x02,0x82,0x02,0x02,0x03,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
164 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x06,0x02,0x0A,0x02,0x0A,0x02,0x12,0x02,0x22,0x02,0x42,0x02,0x82,0x02,0x02,0x03,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
165
165
166 /* Character Data - Index: 79 */
166 /* Character Data - Index: 79 */
167 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x08,0x01,0x04,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
167 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x08,0x01,0x04,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
168
168
169 /* Character Data - Index: 80 */
169 /* Character Data - Index: 80 */
170 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x3C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
170 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x3C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
171
171
172 /* Character Data - Index: 81 */
172 /* Character Data - Index: 81 */
173 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x08,0x03,0x04,0x02,0x02,0x04,0x02,0x04,0x02,0x04,0x42,0x04,0xC4,0x04,0x8C,0x03,0xF0,0x03,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,
173 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x08,0x03,0x04,0x02,0x02,0x04,0x02,0x04,0x02,0x04,0x42,0x04,0xC4,0x04,0x8C,0x03,0xF0,0x03,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,
174
174
175 /* Character Data - Index: 82 */
175 /* Character Data - Index: 82 */
176 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x44,0x00,0x3C,0x00,0x24,0x00,0x44,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
176 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x44,0x00,0x3C,0x00,0x24,0x00,0x44,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
177
177
178 /* Character Data - Index: 83 */
178 /* Character Data - Index: 83 */
179 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x08,0x00,0x04,0x00,0x04,0x00,0xF8,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x82,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
179 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x08,0x00,0x04,0x00,0x04,0x00,0xF8,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x82,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
180
180
181 /* Character Data - Index: 84 */
181 /* Character Data - Index: 84 */
182 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
182 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
183
183
184 /* Character Data - Index: 85 */
184 /* Character Data - Index: 85 */
185 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x08,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
185 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02,0x08,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
186
186
187 /* Character Data - Index: 86 */
187 /* Character Data - Index: 86 */
188 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x01,0x82,0x00,0x84,0x00,0x44,0x00,0x44,0x00,0x28,0x00,0x28,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
188 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x01,0x82,0x00,0x84,0x00,0x44,0x00,0x44,0x00,0x28,0x00,0x28,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
189
189
190 /* Character Data - Index: 87 */
190 /* Character Data - Index: 87 */
191 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x10,0x84,0x10,0x84,0x08,0x48,0x09,0x48,0x09,0x28,0x05,0x28,0x05,0x28,0x05,0x10,0x02,0x10,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
191 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x10,0x84,0x10,0x84,0x08,0x48,0x09,0x48,0x09,0x28,0x05,0x28,0x05,0x28,0x05,0x10,0x02,0x10,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
192
192
193 /* Character Data - Index: 88 */
193 /* Character Data - Index: 88 */
194 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x04,0x01,0x88,0x00,0x50,0x00,0x20,0x00,0x20,0x00,0x50,0x00,0x88,0x00,0x04,0x01,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
194 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x04,0x01,0x88,0x00,0x50,0x00,0x20,0x00,0x20,0x00,0x50,0x00,0x88,0x00,0x04,0x01,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
195
195
196 /* Character Data - Index: 89 */
196 /* Character Data - Index: 89 */
197 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x84,0x00,0x88,0x00,0x48,0x00,0x50,0x00,0x30,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
197 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x84,0x00,0x88,0x00,0x48,0x00,0x50,0x00,0x30,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
198
198
199 /* Character Data - Index: 90 */
199 /* Character Data - Index: 90 */
200 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x80,0x00,0x40,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x02,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
200 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x80,0x00,0x40,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x08,0x00,0x04,0x00,0x02,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
201
201
202 /* Character Data - Index: 91 */
202 /* Character Data - Index: 91 */
203 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,
203 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,
204
204
205 /* Character Data - Index: 92 */
205 /* Character Data - Index: 92 */
206 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
206 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
207
207
208 /* Character Data - Index: 93 */
208 /* Character Data - Index: 93 */
209 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x1C,0x00,0x00,0x00,
209 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x1C,0x00,0x00,0x00,
210
210
211 /* Character Data - Index: 94 */
211 /* Character Data - Index: 94 */
212 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x1C,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
212 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x1C,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
213
213
214 /* Character Data - Index: 95 */
214 /* Character Data - Index: 95 */
215 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,
215 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,
216
216
217 /* Character Data - Index: 96 */
217 /* Character Data - Index: 96 */
218 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
218 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
219
219
220 /* Character Data - Index: 97 */
220 /* Character Data - Index: 97 */
221 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
221 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
222
222
223 /* Character Data - Index: 98 */
223 /* Character Data - Index: 98 */
224 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x34,0x00,0x4C,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x44,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
224 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x34,0x00,0x4C,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x44,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
225
225
226 /* Character Data - Index: 99 */
226 /* Character Data - Index: 99 */
227 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
227 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
228
228
229 /* Character Data - Index: 100 */
229 /* Character Data - Index: 100 */
230 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xF0,0x00,0x88,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
230 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xF0,0x00,0x88,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0x84,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
231
231
232 /* Character Data - Index: 101 */
232 /* Character Data - Index: 101 */
233 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x44,0x00,0x34,0x00,0x0C,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
233 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x44,0x00,0x34,0x00,0x0C,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
234
234
235 /* Character Data - Index: 102 */
235 /* Character Data - Index: 102 */
236 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x10,0x00,0x10,0x00,0x7C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
236 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x10,0x00,0x10,0x00,0x7C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
237
237
238 /* Character Data - Index: 103 */
238 /* Character Data - Index: 103 */
239 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x64,0x00,0x58,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x1C,0x00,
239 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x64,0x00,0x58,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x1C,0x00,
240
240
241 /* Character Data - Index: 104 */
241 /* Character Data - Index: 104 */
242 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x34,0x00,0x4C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
242 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x34,0x00,0x4C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
243
243
244 /* Character Data - Index: 105 */
244 /* Character Data - Index: 105 */
245 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
245 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
246
246
247 /* Character Data - Index: 106 */
247 /* Character Data - Index: 106 */
248 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x09,0x00,0x06,0x00,
248 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x09,0x00,0x06,0x00,
249
249
250 /* Character Data - Index: 107 */
250 /* Character Data - Index: 107 */
251 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x44,0x00,0x24,0x00,0x14,0x00,0x1C,0x00,0x24,0x00,0x24,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
251 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x44,0x00,0x24,0x00,0x14,0x00,0x1C,0x00,0x24,0x00,0x24,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
252
252
253 /* Character Data - Index: 108 */
253 /* Character Data - Index: 108 */
254 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
254 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
255
255
256 /* Character Data - Index: 109 */
256 /* Character Data - Index: 109 */
257 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x00,0x6C,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
257 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x00,0x6C,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
258
258
259 /* Character Data - Index: 110 */
259 /* Character Data - Index: 110 */
260 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x4C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
260 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x4C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
261
261
262 /* Character Data - Index: 111 */
262 /* Character Data - Index: 111 */
263 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
263 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
264
264
265 /* Character Data - Index: 112 */
265 /* Character Data - Index: 112 */
266 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x3C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,
266 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x3C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,
267
267
268 /* Character Data - Index: 113 */
268 /* Character Data - Index: 113 */
269 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x78,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,
269 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x78,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,
270
270
271 /* Character Data - Index: 114 */
271 /* Character Data - Index: 114 */
272 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x2C,0x00,0x24,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
272 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x2C,0x00,0x24,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
273
273
274 /* Character Data - Index: 115 */
274 /* Character Data - Index: 115 */
275 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x24,0x00,0x04,0x00,0x18,0x00,0x20,0x00,0x20,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
275 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x24,0x00,0x04,0x00,0x18,0x00,0x20,0x00,0x20,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
276
276
277 /* Character Data - Index: 116 */
277 /* Character Data - Index: 116 */
278 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
278 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
279
279
280 /* Character Data - Index: 117 */
280 /* Character Data - Index: 117 */
281 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
281 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
282
282
283 /* Character Data - Index: 118 */
283 /* Character Data - Index: 118 */
284 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x44,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
284 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x44,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
285
285
286 /* Character Data - Index: 119 */
286 /* Character Data - Index: 119 */
287 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x02,0x22,0x02,0x54,0x01,0x54,0x01,0x54,0x01,0xC8,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
287 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x02,0x22,0x02,0x54,0x01,0x54,0x01,0x54,0x01,0xC8,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
288
288
289 /* Character Data - Index: 120 */
289 /* Character Data - Index: 120 */
290 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x00,0x44,0x00,0x38,0x00,0x10,0x00,0x28,0x00,0x44,0x00,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
290 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x00,0x44,0x00,0x38,0x00,0x10,0x00,0x28,0x00,0x44,0x00,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
291
291
292 /* Character Data - Index: 121 */
292 /* Character Data - Index: 121 */
293 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x42,0x00,0x24,0x00,0x24,0x00,0x18,0x00,0x18,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x04,0x00,
293 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x42,0x00,0x24,0x00,0x24,0x00,0x18,0x00,0x18,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x04,0x00,
294
294
295 /* Character Data - Index: 122 */
295 /* Character Data - Index: 122 */
296 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
296 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
297
297
298 /* Character Data - Index: 123 */
298 /* Character Data - Index: 123 */
299 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x06,0x00,0x06,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x18,0x00,0x00,0x00,
299 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x06,0x00,0x06,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x18,0x00,0x00,0x00,
300
300
301 /* Character Data - Index: 124 */
301 /* Character Data - Index: 124 */
302 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
302 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
303
303
304 /* Character Data - Index: 125 */
304 /* Character Data - Index: 125 */
305 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x06,0x00,0x00,0x00,
305 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x06,0x00,0x00,0x00,
306
306
307 /* Character Data - Index: 126 */
307 /* Character Data - Index: 126 */
308 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x00,0xD6,0x00,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
308 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x00,0xD6,0x00,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
309
309
310 /* Character Data - Index: 127 */
310 /* Character Data - Index: 127 */
311 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
311 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
312 };
312 };
313
313
314 const uint8_t ComicSansMS_24_TBL[] = {
314 const uint8_t ComicSansMS_24_TBL[] = {
315
315
316 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
316 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
317
317
318 /* Character Data - Index: 33 */
318 /* Character Data - Index: 33 */
319 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
319 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
320
320
321 /* Character Data - Index: 34 */
321 /* Character Data - Index: 34 */
322 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
322 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
323
323
324 /* Character Data - Index: 35 */
324 /* Character Data - Index: 35 */
325 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x18,0x00,0xC0,0x18,0x00,0xC0,0x18,0x00,0xFC,0x7F,0x00,0xFC,0x7F,0x00,0x60,0x0C,0x00,0x60,0x0C,0x00,0x30,0x06,0x00,0xFE,0x3F,0x00,0xFE,0x3F,0x00,0x30,0x06,0x00,0x18,0x03,0x00,0x18,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
325 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x18,0x00,0xC0,0x18,0x00,0xC0,0x18,0x00,0xFC,0x7F,0x00,0xFC,0x7F,0x00,0x60,0x0C,0x00,0x60,0x0C,0x00,0x30,0x06,0x00,0xFE,0x3F,0x00,0xFE,0x3F,0x00,0x30,0x06,0x00,0x18,0x03,0x00,0x18,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
326
326
327 /* Character Data - Index: 36 */
327 /* Character Data - Index: 36 */
328 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xE0,0x03,0x00,0xF8,0x07,0x00,0xDC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xFC,0x03,0x00,0xF0,0x07,0x00,0xC0,0x0E,0x00,0xC0,0x0C,0x00,0xC0,0x0C,0x00,0xCC,0x0E,0x00,0xFC,0x07,0x00,0xF8,0x03,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
328 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xE0,0x03,0x00,0xF8,0x07,0x00,0xDC,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0xFC,0x03,0x00,0xF0,0x07,0x00,0xC0,0x0E,0x00,0xC0,0x0C,0x00,0xC0,0x0C,0x00,0xCC,0x0E,0x00,0xFC,0x07,0x00,0xF8,0x03,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
329
329
330 /* Character Data - Index: 37 */
330 /* Character Data - Index: 37 */
331 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x3C,0x06,0x00,0x7E,0x03,0x00,0x66,0x03,0x00,0xFE,0x03,0x00,0xBC,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xE0,0x1E,0x00,0x60,0x3F,0x00,0x60,0x33,0x00,0x30,0x3F,0x00,0x30,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
331 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x3C,0x06,0x00,0x7E,0x03,0x00,0x66,0x03,0x00,0xFE,0x03,0x00,0xBC,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xE0,0x1E,0x00,0x60,0x3F,0x00,0x60,0x33,0x00,0x30,0x3F,0x00,0x30,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
332
332
333 /* Character Data - Index: 38 */
333 /* Character Data - Index: 38 */
334 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xF0,0x01,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xF0,0x00,0x00,0x70,0x04,0x00,0xDC,0x04,0x00,0xCC,0x04,0x00,0x86,0x07,0x00,0x06,0x07,0x00,0x0E,0x07,0x00,0xFC,0x07,0x00,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
334 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xF0,0x01,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xF0,0x00,0x00,0x70,0x04,0x00,0xDC,0x04,0x00,0xCC,0x04,0x00,0x86,0x07,0x00,0x06,0x07,0x00,0x0E,0x07,0x00,0xFC,0x07,0x00,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
335
335
336 /* Character Data - Index: 39 */
336 /* Character Data - Index: 39 */
337 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
337 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
338
338
339 /* Character Data - Index: 40 */
339 /* Character Data - Index: 40 */
340 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x38,0x00,0x00,0x70,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
340 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x38,0x00,0x00,0x70,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
341
341
342 /* Character Data - Index: 41 */
342 /* Character Data - Index: 41 */
343 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x10,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x1C,0x00,0x00,0x0E,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,
343 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x10,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x1C,0x00,0x00,0x0E,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,
344
344
345 /* Character Data - Index: 42 */
345 /* Character Data - Index: 42 */
346 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0xFE,0x01,0x00,0xFC,0x00,0x00,0x78,0x00,0x00,0x6C,0x00,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
346 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0xFE,0x01,0x00,0xFC,0x00,0x00,0x78,0x00,0x00,0x6C,0x00,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
347
347
348 /* Character Data - Index: 43 */
348 /* Character Data - Index: 43 */
349 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFE,0x01,0x00,0xFE,0x01,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
349 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFE,0x01,0x00,0xFE,0x01,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
350
350
351 /* Character Data - Index: 44 */
351 /* Character Data - Index: 44 */
352 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
352 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
353
353
354 /* Character Data - Index: 45 */
354 /* Character Data - Index: 45 */
355 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
355 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
356
356
357 /* Character Data - Index: 46 */
357 /* Character Data - Index: 46 */
358 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
358 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
359
359
360 /* Character Data - Index: 47 */
360 /* Character Data - Index: 47 */
361 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
361 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
362
362
363 /* Character Data - Index: 48 */
363 /* Character Data - Index: 48 */
364 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x8C,0x01,0x00,0x0E,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0x8C,0x01,0x00,0xFC,0x01,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
364 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x8C,0x01,0x00,0x0E,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0x8C,0x01,0x00,0xFC,0x01,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
365
365
366 /* Character Data - Index: 49 */
366 /* Character Data - Index: 49 */
367 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x38,0x00,0x00,0x3C,0x00,0x00,0x34,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
367 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x38,0x00,0x00,0x3C,0x00,0x00,0x34,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
368
368
369 /* Character Data - Index: 50 */
369 /* Character Data - Index: 50 */
370 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x03,0x00,0x9C,0x03,0x00,0x0C,0x03,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0x70,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
370 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x03,0x00,0x9C,0x03,0x00,0x0C,0x03,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0x70,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
371
371
372 /* Character Data - Index: 51 */
372 /* Character Data - Index: 51 */
373 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xFC,0x01,0x00,0x0C,0x03,0x00,0x00,0x03,0x00,0x80,0x03,0x00,0xF0,0x01,0x00,0xF0,0x00,0x00,0x80,0x03,0x00,0x00,0x03,0x00,0x04,0x03,0x00,0x8C,0x03,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
373 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xFC,0x01,0x00,0x0C,0x03,0x00,0x00,0x03,0x00,0x80,0x03,0x00,0xF0,0x01,0x00,0xF0,0x00,0x00,0x80,0x03,0x00,0x00,0x03,0x00,0x04,0x03,0x00,0x8C,0x03,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
374
374
375 /* Character Data - Index: 52 */
375 /* Character Data - Index: 52 */
376 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0xC0,0x01,0x00,0xE0,0x01,0x00,0xA0,0x01,0x00,0x90,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0xFE,0x07,0x00,0xFE,0x07,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
376 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0xC0,0x01,0x00,0xE0,0x01,0x00,0xA0,0x01,0x00,0x90,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0xFE,0x07,0x00,0xFE,0x07,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
377
377
378 /* Character Data - Index: 53 */
378 /* Character Data - Index: 53 */
379 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x0C,0x00,0x00,0xFC,0x00,0x00,0xFC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x8C,0x01,0x00,0xFC,0x01,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
379 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x0C,0x00,0x00,0xFC,0x00,0x00,0xFC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x8C,0x01,0x00,0xFC,0x01,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
380
380
381 /* Character Data - Index: 54 */
381 /* Character Data - Index: 54 */
382 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0xE0,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00,0x18,0x00,0x00,0xFC,0x00,0x00,0xFC,0x01,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x9C,0x03,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
382 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0xE0,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00,0x18,0x00,0x00,0xFC,0x00,0x00,0xFC,0x01,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x9C,0x03,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
383
383
384 /* Character Data - Index: 55 */
384 /* Character Data - Index: 55 */
385 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x07,0x00,0xFE,0x07,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
385 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x07,0x00,0xFE,0x07,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
386
386
387 /* Character Data - Index: 56 */
387 /* Character Data - Index: 56 */
388 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xFC,0x03,0x00,0x0E,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFE,0x01,0x00,0xFC,0x01,0x00,0x8E,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFC,0x01,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
388 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xFC,0x03,0x00,0x0E,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFE,0x01,0x00,0xFC,0x01,0x00,0x8E,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFC,0x01,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
389
389
390 /* Character Data - Index: 57 */
390 /* Character Data - Index: 57 */
391 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xFC,0x01,0x00,0x8E,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFC,0x03,0x00,0xF8,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xE0,0x00,0x00,0x3C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
391 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xFC,0x01,0x00,0x8E,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFC,0x03,0x00,0xF8,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xE0,0x00,0x00,0x3C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
392
392
393 /* Character Data - Index: 58 */
393 /* Character Data - Index: 58 */
394 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
394 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
395
395
396 /* Character Data - Index: 59 */
396 /* Character Data - Index: 59 */
397 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
397 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
398
398
399 /* Character Data - Index: 60 */
399 /* Character Data - Index: 60 */
400 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x38,0x00,0x00,0x1C,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
400 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x38,0x00,0x00,0x1C,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
401
401
402 /* Character Data - Index: 61 */
402 /* Character Data - Index: 61 */
403 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
403 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
404
404
405 /* Character Data - Index: 62 */
405 /* Character Data - Index: 62 */
406 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x1C,0x00,0x00,0x30,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,0x38,0x00,0x00,0x1C,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
406 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x1C,0x00,0x00,0x30,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,0x38,0x00,0x00,0x1C,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
407
407
408 /* Character Data - Index: 63 */
408 /* Character Data - Index: 63 */
409 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0xFC,0x01,0x00,0x8C,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xE0,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
409 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0xFC,0x01,0x00,0x8C,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xE0,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
410
410
411 /* Character Data - Index: 64 */
411 /* Character Data - Index: 64 */
412 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x0F,0x00,0xE0,0x3F,0x00,0x70,0x78,0x00,0x18,0x60,0x00,0x98,0xC3,0x00,0xCC,0xC1,0x00,0x6C,0xC6,0x00,0x6C,0xC6,0x00,0xEC,0x7F,0x00,0xCC,0x3D,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x70,0x18,0x00,0xE0,0x1F,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
412 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x0F,0x00,0xE0,0x3F,0x00,0x70,0x78,0x00,0x18,0x60,0x00,0x98,0xC3,0x00,0xCC,0xC1,0x00,0x6C,0xC6,0x00,0x6C,0xC6,0x00,0xEC,0x7F,0x00,0xCC,0x3D,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x70,0x18,0x00,0xE0,0x1F,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
413
413
414 /* Character Data - Index: 65 */
414 /* Character Data - Index: 65 */
415 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x03,0x00,0x80,0x03,0x00,0xC0,0x06,0x00,0xC0,0x06,0x00,0x60,0x06,0x00,0x60,0x07,0x00,0xF0,0x07,0x00,0x78,0x06,0x00,0x18,0x0E,0x00,0x18,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
415 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x03,0x00,0x80,0x03,0x00,0xC0,0x06,0x00,0xC0,0x06,0x00,0x60,0x06,0x00,0x60,0x07,0x00,0xF0,0x07,0x00,0x78,0x06,0x00,0x18,0x0E,0x00,0x18,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
416
416
417 /* Character Data - Index: 66 */
417 /* Character Data - Index: 66 */
418 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0xFC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x8C,0x03,0x00,0xFC,0x01,0x00,0xFC,0x03,0x00,0x0C,0x07,0x00,0x0C,0x06,0x00,0x8C,0x07,0x00,0xFC,0x03,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
418 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0xFC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x8C,0x03,0x00,0xFC,0x01,0x00,0xFC,0x03,0x00,0x0C,0x07,0x00,0x0C,0x06,0x00,0x8C,0x07,0x00,0xFC,0x03,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
419
419
420 /* Character Data - Index: 67 */
420 /* Character Data - Index: 67 */
421 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF0,0x03,0x00,0x38,0x03,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFC,0x01,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
421 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF0,0x03,0x00,0x38,0x03,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xFC,0x01,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
422
422
423 /* Character Data - Index: 68 */
423 /* Character Data - Index: 68 */
424 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x7C,0x00,0x00,0xEC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x06,0x00,0x0C,0x0E,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x0E,0x00,0x0C,0x07,0x00,0xFC,0x03,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
424 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x7C,0x00,0x00,0xEC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x06,0x00,0x0C,0x0E,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x0E,0x00,0x0C,0x07,0x00,0xFC,0x03,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
425
425
426 /* Character Data - Index: 69 */
426 /* Character Data - Index: 69 */
427 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x07,0x00,0xFC,0x07,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xF8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
427 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x07,0x00,0xFC,0x07,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xF8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
428
428
429 /* Character Data - Index: 70 */
429 /* Character Data - Index: 70 */
430 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0xFC,0x07,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
430 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0xFC,0x07,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
431
431
432 /* Character Data - Index: 71 */
432 /* Character Data - Index: 71 */
433 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0xF0,0x07,0x00,0x38,0x06,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xF6,0x0F,0x00,0xF6,0x0F,0x00,0x06,0x0C,0x00,0x06,0x06,0x00,0x0E,0x07,0x00,0xFC,0x03,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
433 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0xF0,0x07,0x00,0x38,0x06,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xF6,0x0F,0x00,0xF6,0x0F,0x00,0x06,0x0C,0x00,0x06,0x06,0x00,0x0E,0x07,0x00,0xFC,0x03,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
434
434
435 /* Character Data - Index: 72 */
435 /* Character Data - Index: 72 */
436 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x8C,0x1F,0x00,0xFC,0x1F,0x00,0x7C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
436 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x8C,0x1F,0x00,0xFC,0x1F,0x00,0x7C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
437
437
438 /* Character Data - Index: 73 */
438 /* Character Data - Index: 73 */
439 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0xFE,0x01,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFE,0x01,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
439 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0xFE,0x01,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFE,0x01,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
440
440
441 /* Character Data - Index: 74 */
441 /* Character Data - Index: 74 */
442 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xF0,0x0F,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x86,0x01,0x00,0x86,0x01,0x00,0xCE,0x01,0x00,0xFC,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
442 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xF0,0x0F,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x86,0x01,0x00,0x86,0x01,0x00,0xCE,0x01,0x00,0xFC,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
443
443
444 /* Character Data - Index: 75 */
444 /* Character Data - Index: 75 */
445 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x04,0x00,0x0C,0x06,0x00,0x0C,0x03,0x00,0x8C,0x01,0x00,0xEC,0x00,0x00,0x7C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x6C,0x00,0x00,0xEC,0x00,0x00,0xCC,0x01,0x00,0x8C,0x07,0x00,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
445 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x04,0x00,0x0C,0x06,0x00,0x0C,0x03,0x00,0x8C,0x01,0x00,0xEC,0x00,0x00,0x7C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x6C,0x00,0x00,0xEC,0x00,0x00,0xCC,0x01,0x00,0x8C,0x07,0x00,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
446
446
447 /* Character Data - Index: 76 */
447 /* Character Data - Index: 76 */
448 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x01,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
448 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xFC,0x01,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
449
449
450 /* Character Data - Index: 77 */
450 /* Character Data - Index: 77 */
451 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x08,0x00,0x70,0x1C,0x00,0x70,0x1C,0x00,0x70,0x1C,0x00,0x70,0x14,0x00,0xD8,0x34,0x00,0xD8,0x36,0x00,0xD8,0x36,0x00,0xD8,0x36,0x00,0xCC,0x36,0x00,0x8C,0x33,0x00,0x8C,0x63,0x00,0x8C,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
451 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x08,0x00,0x70,0x1C,0x00,0x70,0x1C,0x00,0x70,0x1C,0x00,0x70,0x14,0x00,0xD8,0x34,0x00,0xD8,0x36,0x00,0xD8,0x36,0x00,0xD8,0x36,0x00,0xCC,0x36,0x00,0x8C,0x33,0x00,0x8C,0x63,0x00,0x8C,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
452
452
453 /* Character Data - Index: 78 */
453 /* Character Data - Index: 78 */
454 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x10,0x00,0x1C,0x30,0x00,0x1C,0x30,0x00,0x3C,0x30,0x00,0x6C,0x30,0x00,0xCC,0x30,0x00,0x8C,0x31,0x00,0x8C,0x31,0x00,0x0C,0x33,0x00,0x0C,0x36,0x00,0x0C,0x3C,0x00,0x0C,0x38,0x00,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
454 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x10,0x00,0x1C,0x30,0x00,0x1C,0x30,0x00,0x3C,0x30,0x00,0x6C,0x30,0x00,0xCC,0x30,0x00,0x8C,0x31,0x00,0x8C,0x31,0x00,0x0C,0x33,0x00,0x0C,0x36,0x00,0x0C,0x3C,0x00,0x0C,0x38,0x00,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
455
455
456 /* Character Data - Index: 79 */
456 /* Character Data - Index: 79 */
457 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xE0,0x1F,0x00,0x70,0x38,0x00,0x38,0x30,0x00,0x18,0x30,0x00,0x0C,0x30,0x00,0x0C,0x30,0x00,0x0C,0x30,0x00,0x0C,0x18,0x00,0x1C,0x18,0x00,0x38,0x0C,0x00,0xF0,0x07,0x00,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
457 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xE0,0x1F,0x00,0x70,0x38,0x00,0x38,0x30,0x00,0x18,0x30,0x00,0x0C,0x30,0x00,0x0C,0x30,0x00,0x0C,0x30,0x00,0x0C,0x18,0x00,0x1C,0x18,0x00,0x38,0x0C,0x00,0xF0,0x07,0x00,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
458
458
459 /* Character Data - Index: 80 */
459 /* Character Data - Index: 80 */
460 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0xFC,0x00,0x00,0xCC,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xCC,0x01,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
460 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0xFC,0x00,0x00,0xCC,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xCC,0x01,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
461
461
462 /* Character Data - Index: 81 */
462 /* Character Data - Index: 81 */
463 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x0F,0x00,0xE0,0x1F,0x00,0x70,0x38,0x00,0x18,0x30,0x00,0x1C,0x70,0x00,0x0C,0x60,0x00,0x0C,0x60,0x00,0x0C,0x60,0x00,0x0C,0x61,0x00,0x18,0x63,0x00,0x38,0x36,0x00,0xF0,0x3F,0x00,0xC0,0x1B,0x00,0x00,0x30,0x00,0x00,0x70,0x00,0x00,0x60,0x00,0x00,0x40,0x00,0x00,0x00,0x00,
463 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x0F,0x00,0xE0,0x1F,0x00,0x70,0x38,0x00,0x18,0x30,0x00,0x1C,0x70,0x00,0x0C,0x60,0x00,0x0C,0x60,0x00,0x0C,0x60,0x00,0x0C,0x61,0x00,0x18,0x63,0x00,0x38,0x36,0x00,0xF0,0x3F,0x00,0xC0,0x1B,0x00,0x00,0x30,0x00,0x00,0x70,0x00,0x00,0x60,0x00,0x00,0x40,0x00,0x00,0x00,0x00,
464
464
465 /* Character Data - Index: 82 */
465 /* Character Data - Index: 82 */
466 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0xFC,0x00,0x00,0xCC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x8C,0x03,0x00,0xFC,0x01,0x00,0x7C,0x00,0x00,0xEC,0x00,0x00,0x8C,0x03,0x00,0x0C,0x07,0x00,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
466 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0xFC,0x00,0x00,0xCC,0x01,0x00,0x8C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x8C,0x03,0x00,0xFC,0x01,0x00,0x7C,0x00,0x00,0xEC,0x00,0x00,0x8C,0x03,0x00,0x0C,0x07,0x00,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
467
467
468 /* Character Data - Index: 83 */
468 /* Character Data - Index: 83 */
469 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0xF0,0x07,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0xF8,0x03,0x00,0xF0,0x07,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x0C,0x0C,0x00,0x1C,0x0E,0x00,0xF8,0x07,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
469 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0xF0,0x07,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0xF8,0x03,0x00,0xF0,0x07,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x0C,0x0C,0x00,0x1C,0x0E,0x00,0xF8,0x07,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
470
470
471 /* Character Data - Index: 84 */
471 /* Character Data - Index: 84 */
472 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x0F,0x00,0xFE,0x0F,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
472 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x0F,0x00,0xFE,0x0F,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
473
473
474 /* Character Data - Index: 85 */
474 /* Character Data - Index: 85 */
475 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x00,0x38,0x0E,0x00,0xF8,0x07,0x00,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
475 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x18,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x00,0x38,0x0E,0x00,0xF8,0x07,0x00,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
476
476
477 /* Character Data - Index: 86 */
477 /* Character Data - Index: 86 */
478 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x06,0x00,0x18,0x06,0x00,0x18,0x06,0x00,0x18,0x03,0x00,0x18,0x03,0x00,0x30,0x03,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
478 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x0C,0x06,0x00,0x18,0x06,0x00,0x18,0x06,0x00,0x18,0x03,0x00,0x18,0x03,0x00,0x30,0x03,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
479
479
480 /* Character Data - Index: 87 */
480 /* Character Data - Index: 87 */
481 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x02,0x0C,0x0E,0x03,0x1C,0x0E,0x03,0x18,0x0E,0x03,0x18,0x1B,0x03,0x18,0x9B,0x01,0x30,0x9B,0x01,0xB0,0x99,0x01,0xB0,0xD9,0x00,0xA0,0xD9,0x00,0xE0,0xD8,0x00,0xE0,0x78,0x00,0xE0,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
481 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x02,0x0C,0x0E,0x03,0x1C,0x0E,0x03,0x18,0x0E,0x03,0x18,0x1B,0x03,0x18,0x9B,0x01,0x30,0x9B,0x01,0xB0,0x99,0x01,0xB0,0xD9,0x00,0xA0,0xD9,0x00,0xE0,0xD8,0x00,0xE0,0x78,0x00,0xE0,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
482
482
483 /* Character Data - Index: 88 */
483 /* Character Data - Index: 88 */
484 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x1C,0x18,0x00,0x38,0x0C,0x00,0x70,0x06,0x00,0x60,0x07,0x00,0xC0,0x03,0x00,0x80,0x01,0x00,0xC0,0x03,0x00,0x60,0x03,0x00,0x30,0x06,0x00,0x18,0x0C,0x00,0x1C,0x1C,0x00,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
484 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x1C,0x18,0x00,0x38,0x0C,0x00,0x70,0x06,0x00,0x60,0x07,0x00,0xC0,0x03,0x00,0x80,0x01,0x00,0xC0,0x03,0x00,0x60,0x03,0x00,0x30,0x06,0x00,0x18,0x0C,0x00,0x1C,0x1C,0x00,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
485
485
486 /* Character Data - Index: 89 */
486 /* Character Data - Index: 89 */
487 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x06,0x06,0x00,0x0C,0x03,0x00,0x18,0x03,0x00,0x98,0x01,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xE0,0x00,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
487 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x06,0x06,0x00,0x0C,0x03,0x00,0x18,0x03,0x00,0x98,0x01,0x00,0xB0,0x01,0x00,0xB0,0x01,0x00,0xE0,0x00,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
488
488
489 /* Character Data - Index: 90 */
489 /* Character Data - Index: 90 */
490 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x1F,0x00,0xFC,0x1F,0x00,0x00,0x0E,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xC0,0x01,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0xFC,0x1F,0x00,0xFC,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
490 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x1F,0x00,0xFC,0x1F,0x00,0x00,0x0E,0x00,0x00,0x03,0x00,0x80,0x01,0x00,0xC0,0x01,0x00,0xC0,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x0C,0x00,0x00,0xFC,0x1F,0x00,0xFC,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
491
491
492 /* Character Data - Index: 91 */
492 /* Character Data - Index: 91 */
493 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,
493 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,
494
494
495 /* Character Data - Index: 92 */
495 /* Character Data - Index: 92 */
496 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x40,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
496 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x40,0x00,0x00,0xC0,0x00,0x00,0xC0,0x00,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
497
497
498 /* Character Data - Index: 93 */
498 /* Character Data - Index: 93 */
499 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x3E,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x3E,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,
499 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x3E,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x3E,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,
500
500
501 /* Character Data - Index: 94 */
501 /* Character Data - Index: 94 */
502 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0xE0,0x00,0x00,0x30,0x01,0x00,0x18,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
502 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0xE0,0x00,0x00,0x30,0x01,0x00,0x18,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
503
503
504 /* Character Data - Index: 95 */
504 /* Character Data - Index: 95 */
505 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
505 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
506
506
507 /* Character Data - Index: 96 */
507 /* Character Data - Index: 96 */
508 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
508 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
509
509
510 /* Character Data - Index: 97 */
510 /* Character Data - Index: 97 */
511 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xF8,0x03,0x00,0x70,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
511 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xF8,0x03,0x00,0x70,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
512
512
513 /* Character Data - Index: 98 */
513 /* Character Data - Index: 98 */
514 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xEC,0x00,0x00,0xFC,0x01,0x00,0x9C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x8C,0x03,0x00,0xFC,0x01,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
514 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xEC,0x00,0x00,0xFC,0x01,0x00,0x9C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x8C,0x03,0x00,0xFC,0x01,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
515
515
516 /* Character Data - Index: 99 */
516 /* Character Data - Index: 99 */
517 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x9C,0x01,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
517 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x9C,0x01,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
518
518
519 /* Character Data - Index: 100 */
519 /* Character Data - Index: 100 */
520 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0xF0,0x03,0x00,0xF8,0x03,0x00,0x1C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x9C,0x03,0x00,0xF8,0x03,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
520 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0xF0,0x03,0x00,0xF8,0x03,0x00,0x1C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x9C,0x03,0x00,0xF8,0x03,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
521
521
522 /* Character Data - Index: 101 */
522 /* Character Data - Index: 101 */
523 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x00,0xF8,0x03,0x00,0x18,0x03,0x00,0xCC,0x03,0x00,0xFC,0x00,0x00,0x3C,0x00,0x00,0x1C,0x02,0x00,0xF8,0x03,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
523 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x00,0xF8,0x03,0x00,0x18,0x03,0x00,0xCC,0x03,0x00,0xFC,0x00,0x00,0x3C,0x00,0x00,0x1C,0x02,0x00,0xF8,0x03,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
524
524
525 /* Character Data - Index: 102 */
525 /* Character Data - Index: 102 */
526 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x00,0xE0,0x01,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFC,0x01,0x00,0xFC,0x01,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
526 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x00,0xE0,0x01,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFC,0x01,0x00,0xFC,0x01,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
527
527
528 /* Character Data - Index: 103 */
528 /* Character Data - Index: 103 */
529 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xCC,0x01,0x00,0xF8,0x01,0x00,0xB8,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,
529 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xCC,0x01,0x00,0xF8,0x01,0x00,0xB8,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0xC0,0x00,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,
530
530
531 /* Character Data - Index: 104 */
531 /* Character Data - Index: 104 */
532 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xEC,0x00,0x00,0xFC,0x01,0x00,0x9C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
532 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0xEC,0x00,0x00,0xFC,0x01,0x00,0x9C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
533
533
534 /* Character Data - Index: 105 */
534 /* Character Data - Index: 105 */
535 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
535 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
536
536
537 /* Character Data - Index: 106 */
537 /* Character Data - Index: 106 */
538 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x33,0x00,0x00,0x33,0x00,0x00,0x3E,0x00,0x00,0x1C,0x00,0x00,
538 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x33,0x00,0x00,0x33,0x00,0x00,0x3E,0x00,0x00,0x1C,0x00,0x00,
539
539
540 /* Character Data - Index: 107 */
540 /* Character Data - Index: 107 */
541 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x03,0x00,0x8C,0x01,0x00,0xCC,0x00,0x00,0x6C,0x00,0x00,0x7C,0x00,0x00,0xDC,0x00,0x00,0x8C,0x01,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
541 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x03,0x00,0x8C,0x01,0x00,0xCC,0x00,0x00,0x6C,0x00,0x00,0x7C,0x00,0x00,0xDC,0x00,0x00,0x8C,0x01,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
542
542
543 /* Character Data - Index: 108 */
543 /* Character Data - Index: 108 */
544 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
544 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
545
545
546 /* Character Data - Index: 109 */
546 /* Character Data - Index: 109 */
547 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0x0E,0x00,0xEC,0x1F,0x00,0xBC,0x1B,0x00,0x9C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
547 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0x0E,0x00,0xEC,0x1F,0x00,0xBC,0x1B,0x00,0x9C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
548
548
549 /* Character Data - Index: 110 */
549 /* Character Data - Index: 110 */
550 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x00,0x00,0xFC,0x01,0x00,0x9C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
550 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x00,0x00,0xFC,0x01,0x00,0x9C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
551
551
552 /* Character Data - Index: 111 */
552 /* Character Data - Index: 111 */
553 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x98,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x9C,0x03,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
553 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x01,0x00,0x98,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x0C,0x03,0x00,0x9C,0x03,0x00,0xF8,0x01,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
554
554
555 /* Character Data - Index: 112 */
555 /* Character Data - Index: 112 */
556 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0xEC,0x00,0x00,0xFC,0x00,0x00,0x9C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xCC,0x01,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,
556 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0xEC,0x00,0x00,0xFC,0x00,0x00,0x9C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xCC,0x01,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,
557
557
558 /* Character Data - Index: 113 */
558 /* Character Data - Index: 113 */
559 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xF8,0x01,0x00,0xF0,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,
559 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0xF8,0x01,0x00,0x98,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xF8,0x01,0x00,0xF0,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,0x80,0x01,0x00,
560
560
561 /* Character Data - Index: 114 */
561 /* Character Data - Index: 114 */
562 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x00,0x00,0xFC,0x00,0x00,0xDC,0x00,0x00,0xCC,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
562 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x00,0x00,0xFC,0x00,0x00,0xDC,0x00,0x00,0xCC,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
563
563
564 /* Character Data - Index: 115 */
564 /* Character Data - Index: 115 */
565 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xF8,0x00,0x00,0xDC,0x00,0x00,0x0C,0x00,0x00,0x7C,0x00,0x00,0xF0,0x00,0x00,0xC0,0x00,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
565 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xF8,0x00,0x00,0xDC,0x00,0x00,0x0C,0x00,0x00,0x7C,0x00,0x00,0xF0,0x00,0x00,0xC0,0x00,0x00,0xFC,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
566
566
567 /* Character Data - Index: 116 */
567 /* Character Data - Index: 116 */
568 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
568 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
569
569
570 /* Character Data - Index: 117 */
570 /* Character Data - Index: 117 */
571 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xFC,0x01,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
571 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xFC,0x01,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
572
572
573 /* Character Data - Index: 118 */
573 /* Character Data - Index: 118 */
574 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x01,0x00,0x86,0x01,0x00,0x8C,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
574 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x01,0x00,0x86,0x01,0x00,0x8C,0x00,0x00,0xCC,0x00,0x00,0xCC,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
575
575
576 /* Character Data - Index: 119 */
576 /* Character Data - Index: 119 */
577 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0xCC,0x19,0x00,0xCC,0x0D,0x00,0xD8,0x0D,0x00,0x58,0x0D,0x00,0x78,0x0D,0x00,0x38,0x07,0x00,0x30,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
577 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x19,0x00,0x8C,0x19,0x00,0xCC,0x19,0x00,0xCC,0x0D,0x00,0xD8,0x0D,0x00,0x58,0x0D,0x00,0x78,0x0D,0x00,0x38,0x07,0x00,0x30,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
578
578
579 /* Character Data - Index: 120 */
579 /* Character Data - Index: 120 */
580 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xDC,0x01,0x00,0xF8,0x00,0x00,0x70,0x00,0x00,0xF8,0x00,0x00,0xDC,0x01,0x00,0x8E,0x03,0x00,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
580 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x03,0x00,0x8E,0x03,0x00,0xDC,0x01,0x00,0xF8,0x00,0x00,0x70,0x00,0x00,0xF8,0x00,0x00,0xDC,0x01,0x00,0x8E,0x03,0x00,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
581
581
582 /* Character Data - Index: 121 */
582 /* Character Data - Index: 121 */
583 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xD8,0x00,0x00,0xD8,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,
583 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x03,0x00,0x06,0x03,0x00,0x8C,0x01,0x00,0x8C,0x01,0x00,0xD8,0x00,0x00,0xD8,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,
584
584
585 /* Character Data - Index: 122 */
585 /* Character Data - Index: 122 */
586 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0xC0,0x01,0x00,0xC0,0x00,0x00,0xE0,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
586 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0xC0,0x01,0x00,0xC0,0x00,0x00,0xE0,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00,0xFC,0x03,0x00,0xFC,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
587
587
588 /* Character Data - Index: 123 */
588 /* Character Data - Index: 123 */
589 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x78,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0E,0x00,0x00,0x06,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x1C,0x00,0x00,0x78,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,
589 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x78,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0E,0x00,0x00,0x06,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x1C,0x00,0x00,0x78,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,
590
590
591 /* Character Data - Index: 124 */
591 /* Character Data - Index: 124 */
592 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
592 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
593
593
594 /* Character Data - Index: 125 */
594 /* Character Data - Index: 125 */
595 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x1E,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x38,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,
595 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x1E,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x38,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,
596
596
597 /* Character Data - Index: 126 */
597 /* Character Data - Index: 126 */
598 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x78,0x04,0x00,0xC8,0x06,0x00,0xCC,0x07,0x00,0x84,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
598 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x78,0x04,0x00,0xC8,0x06,0x00,0xCC,0x07,0x00,0x84,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
599
599
600 /* Character Data - Index: 127 */
600 /* Character Data - Index: 127 */
601 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
601 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
602
602
603 };
603 };
604
604
605
605
606 /* Character bitmaps for Comic Sans MS 8pt */
606 /* Character bitmaps for Comic Sans MS 8pt */
607 const uint8_t comicSansMS_8ptBitmaps[] =
607 const uint8_t comicSansMS_8ptBitmaps[] =
608 {
608 {
609 // @0 ' ' (11 pixels wide)
609 // @0 ' ' (11 pixels wide)
610 0x00, 0x00, //
610 0x00, 0x00, //
611 0x00, 0x00, //
611 0x00, 0x00, //
612 0x00, 0x00, //
612 0x00, 0x00, //
613 0x00, 0x00, //
613 0x00, 0x00, //
614 0x00, 0x00, //
614 0x00, 0x00, //
615 0x00, 0x00, //
615 0x00, 0x00, //
616 0x00, 0x00, //
616 0x00, 0x00, //
617 0x00, 0x00, //
617 0x00, 0x00, //
618 0x00, 0x00, //
618 0x00, 0x00, //
619 0x00, 0x00, //
619 0x00, 0x00, //
620 0x00, 0x00, //
620 0x00, 0x00, //
621 0x00, 0x00, //
621 0x00, 0x00, //
622
622
623 // @24 '!' (11 pixels wide)
623 // @24 '!' (11 pixels wide)
624 0x20, 0x00, // #
624 0x20, 0x00, // #
625 0x20, 0x00, // #
625 0x20, 0x00, // #
626 0x20, 0x00, // #
626 0x20, 0x00, // #
627 0x20, 0x00, // #
627 0x20, 0x00, // #
628 0x20, 0x00, // #
628 0x20, 0x00, // #
629 0x20, 0x00, // #
629 0x20, 0x00, // #
630 0x20, 0x00, // #
630 0x20, 0x00, // #
631 0x00, 0x00, //
631 0x00, 0x00, //
632 0x20, 0x00, // #
632 0x20, 0x00, // #
633 0x00, 0x00, //
633 0x00, 0x00, //
634 0x00, 0x00, //
634 0x00, 0x00, //
635 0x00, 0x00, //
635 0x00, 0x00, //
636
636
637 // @48 '"' (11 pixels wide)
637 // @48 '"' (11 pixels wide)
638 0x00, 0x00, //
638 0x00, 0x00, //
639 0x50, 0x00, // # #
639 0x50, 0x00, // # #
640 0x50, 0x00, // # #
640 0x50, 0x00, // # #
641 0x50, 0x00, // # #
641 0x50, 0x00, // # #
642 0x00, 0x00, //
642 0x00, 0x00, //
643 0x00, 0x00, //
643 0x00, 0x00, //
644 0x00, 0x00, //
644 0x00, 0x00, //
645 0x00, 0x00, //
645 0x00, 0x00, //
646 0x00, 0x00, //
646 0x00, 0x00, //
647 0x00, 0x00, //
647 0x00, 0x00, //
648 0x00, 0x00, //
648 0x00, 0x00, //
649 0x00, 0x00, //
649 0x00, 0x00, //
650
650
651 // @72 '#' (11 pixels wide)
651 // @72 '#' (11 pixels wide)
652 0x00, 0x00, //
652 0x00, 0x00, //
653 0x10, 0x01, // # #
653 0x10, 0x01, // # #
654 0x10, 0x01, // # #
654 0x10, 0x01, // # #
655 0xFC, 0x03, // ########
655 0xFC, 0x03, // ########
656 0x88, 0x00, // # #
656 0x88, 0x00, // # #
657 0x88, 0x00, // # #
657 0x88, 0x00, // # #
658 0xFE, 0x01, // ########
658 0xFE, 0x01, // ########
659 0x44, 0x00, // # #
659 0x44, 0x00, // # #
660 0x44, 0x00, // # #
660 0x44, 0x00, // # #
661 0x00, 0x00, //
661 0x00, 0x00, //
662 0x00, 0x00, //
662 0x00, 0x00, //
663 0x00, 0x00, //
663 0x00, 0x00, //
664
664
665 // @96 '$' (11 pixels wide)
665 // @96 '$' (11 pixels wide)
666 0x20, 0x00, // #
666 0x20, 0x00, // #
667 0xF0, 0x00, // ####
667 0xF0, 0x00, // ####
668 0x28, 0x00, // # #
668 0x28, 0x00, // # #
669 0x28, 0x00, // # #
669 0x28, 0x00, // # #
670 0x70, 0x00, // ###
670 0x70, 0x00, // ###
671 0xA0, 0x00, // # #
671 0xA0, 0x00, // # #
672 0xA0, 0x00, // # #
672 0xA0, 0x00, // # #
673 0xA0, 0x00, // # #
673 0xA0, 0x00, // # #
674 0x78, 0x00, // ####
674 0x78, 0x00, // ####
675 0x20, 0x00, // #
675 0x20, 0x00, // #
676 0x20, 0x00, // #
676 0x20, 0x00, // #
677 0x00, 0x00, //
677 0x00, 0x00, //
678
678
679 // @120 '%' (11 pixels wide)
679 // @120 '%' (11 pixels wide)
680 0x80, 0x00, // #
680 0x80, 0x00, // #
681 0xCC, 0x00, // ## ##
681 0xCC, 0x00, // ## ##
682 0x52, 0x00, // # # #
682 0x52, 0x00, // # # #
683 0x72, 0x00, // # ###
683 0x72, 0x00, // # ###
684 0x2C, 0x00, // ## #
684 0x2C, 0x00, // ## #
685 0xB0, 0x01, // ## ##
685 0xB0, 0x01, // ## ##
686 0x50, 0x02, // # # #
686 0x50, 0x02, // # # #
687 0x58, 0x02, // ## # #
687 0x58, 0x02, // ## # #
688 0x88, 0x01, // # ##
688 0x88, 0x01, // # ##
689 0x00, 0x00, //
689 0x00, 0x00, //
690 0x00, 0x00, //
690 0x00, 0x00, //
691 0x00, 0x00, //
691 0x00, 0x00, //
692
692
693 // @144 '&' (11 pixels wide)
693 // @144 '&' (11 pixels wide)
694 0x00, 0x00, //
694 0x00, 0x00, //
695 0x60, 0x00, // ##
695 0x60, 0x00, // ##
696 0x50, 0x00, // # #
696 0x50, 0x00, // # #
697 0x30, 0x00, // ##
697 0x30, 0x00, // ##
698 0xB8, 0x00, // ### #
698 0xB8, 0x00, // ### #
699 0xAC, 0x00, // ## # #
699 0xAC, 0x00, // ## # #
700 0xC4, 0x00, // # ##
700 0xC4, 0x00, // # ##
701 0x44, 0x00, // # #
701 0x44, 0x00, // # #
702 0xB8, 0x00, // ### #
702 0xB8, 0x00, // ### #
703 0x00, 0x00, //
703 0x00, 0x00, //
704 0x00, 0x00, //
704 0x00, 0x00, //
705 0x00, 0x00, //
705 0x00, 0x00, //
706
706
707 // @168 ''' (11 pixels wide)
707 // @168 ''' (11 pixels wide)
708 0x00, 0x00, //
708 0x00, 0x00, //
709 0x20, 0x00, // #
709 0x20, 0x00, // #
710 0x20, 0x00, // #
710 0x20, 0x00, // #
711 0x20, 0x00, // #
711 0x20, 0x00, // #
712 0x00, 0x00, //
712 0x00, 0x00, //
713 0x00, 0x00, //
713 0x00, 0x00, //
714 0x00, 0x00, //
714 0x00, 0x00, //
715 0x00, 0x00, //
715 0x00, 0x00, //
716 0x00, 0x00, //
716 0x00, 0x00, //
717 0x00, 0x00, //
717 0x00, 0x00, //
718 0x00, 0x00, //
718 0x00, 0x00, //
719 0x00, 0x00, //
719 0x00, 0x00, //
720
720
721 // @192 '(' (11 pixels wide)
721 // @192 '(' (11 pixels wide)
722 0x40, 0x00, // #
722 0x40, 0x00, // #
723 0x20, 0x00, // #
723 0x20, 0x00, // #
724 0x20, 0x00, // #
724 0x20, 0x00, // #
725 0x10, 0x00, // #
725 0x10, 0x00, // #
726 0x10, 0x00, // #
726 0x10, 0x00, // #
727 0x10, 0x00, // #
727 0x10, 0x00, // #
728 0x10, 0x00, // #
728 0x10, 0x00, // #
729 0x10, 0x00, // #
729 0x10, 0x00, // #
730 0x10, 0x00, // #
730 0x10, 0x00, // #
731 0x20, 0x00, // #
731 0x20, 0x00, // #
732 0x40, 0x00, // #
732 0x40, 0x00, // #
733 0x00, 0x00, //
733 0x00, 0x00, //
734
734
735 // @216 ')' (11 pixels wide)
735 // @216 ')' (11 pixels wide)
736 0x08, 0x00, // #
736 0x08, 0x00, // #
737 0x10, 0x00, // #
737 0x10, 0x00, // #
738 0x10, 0x00, // #
738 0x10, 0x00, // #
739 0x20, 0x00, // #
739 0x20, 0x00, // #
740 0x20, 0x00, // #
740 0x20, 0x00, // #
741 0x20, 0x00, // #
741 0x20, 0x00, // #
742 0x20, 0x00, // #
742 0x20, 0x00, // #
743 0x20, 0x00, // #
743 0x20, 0x00, // #
744 0x20, 0x00, // #
744 0x20, 0x00, // #
745 0x10, 0x00, // #
745 0x10, 0x00, // #
746 0x08, 0x00, // #
746 0x08, 0x00, // #
747 0x00, 0x00, //
747 0x00, 0x00, //
748
748
749 // @240 '*' (11 pixels wide)
749 // @240 '*' (11 pixels wide)
750 0x00, 0x00, //
750 0x00, 0x00, //
751 0x10, 0x00, // #
751 0x10, 0x00, // #
752 0x7C, 0x00, // #####
752 0x7C, 0x00, // #####
753 0x38, 0x00, // ###
753 0x38, 0x00, // ###
754 0x2C, 0x00, // ## #
754 0x2C, 0x00, // ## #
755 0x00, 0x00, //
755 0x00, 0x00, //
756 0x00, 0x00, //
756 0x00, 0x00, //
757 0x00, 0x00, //
757 0x00, 0x00, //
758 0x00, 0x00, //
758 0x00, 0x00, //
759 0x00, 0x00, //
759 0x00, 0x00, //
760 0x00, 0x00, //
760 0x00, 0x00, //
761 0x00, 0x00, //
761 0x00, 0x00, //
762
762
763 // @264 '+' (11 pixels wide)
763 // @264 '+' (11 pixels wide)
764 0x00, 0x00, //
764 0x00, 0x00, //
765 0x00, 0x00, //
765 0x00, 0x00, //
766 0x00, 0x00, //
766 0x00, 0x00, //
767 0x20, 0x00, // #
767 0x20, 0x00, // #
768 0x20, 0x00, // #
768 0x20, 0x00, // #
769 0xF8, 0x00, // #####
769 0xF8, 0x00, // #####
770 0x20, 0x00, // #
770 0x20, 0x00, // #
771 0x20, 0x00, // #
771 0x20, 0x00, // #
772 0x00, 0x00, //
772 0x00, 0x00, //
773 0x00, 0x00, //
773 0x00, 0x00, //
774 0x00, 0x00, //
774 0x00, 0x00, //
775 0x00, 0x00, //
775 0x00, 0x00, //
776
776
777 // @288 ',' (11 pixels wide)
777 // @288 ',' (11 pixels wide)
778 0x00, 0x00, //
778 0x00, 0x00, //
779 0x00, 0x00, //
779 0x00, 0x00, //
780 0x00, 0x00, //
780 0x00, 0x00, //
781 0x00, 0x00, //
781 0x00, 0x00, //
782 0x00, 0x00, //
782 0x00, 0x00, //
783 0x00, 0x00, //
783 0x00, 0x00, //
784 0x00, 0x00, //
784 0x00, 0x00, //
785 0x00, 0x00, //
785 0x00, 0x00, //
786 0x20, 0x00, // #
786 0x20, 0x00, // #
787 0x10, 0x00, // #
787 0x10, 0x00, // #
788 0x00, 0x00, //
788 0x00, 0x00, //
789 0x00, 0x00, //
789 0x00, 0x00, //
790
790
791 // @312 '-' (11 pixels wide)
791 // @312 '-' (11 pixels wide)
792 0x00, 0x00, //
792 0x00, 0x00, //
793 0x00, 0x00, //
793 0x00, 0x00, //
794 0x00, 0x00, //
794 0x00, 0x00, //
795 0x00, 0x00, //
795 0x00, 0x00, //
796 0x00, 0x00, //
796 0x00, 0x00, //
797 0x00, 0x00, //
797 0x00, 0x00, //
798 0x70, 0x00, // ###
798 0x70, 0x00, // ###
799 0x00, 0x00, //
799 0x00, 0x00, //
800 0x00, 0x00, //
800 0x00, 0x00, //
801 0x00, 0x00, //
801 0x00, 0x00, //
802 0x00, 0x00, //
802 0x00, 0x00, //
803 0x00, 0x00, //
803 0x00, 0x00, //
804
804
805 // @336 '.' (11 pixels wide)
805 // @336 '.' (11 pixels wide)
806 0x00, 0x00, //
806 0x00, 0x00, //
807 0x00, 0x00, //
807 0x00, 0x00, //
808 0x00, 0x00, //
808 0x00, 0x00, //
809 0x00, 0x00, //
809 0x00, 0x00, //
810 0x00, 0x00, //
810 0x00, 0x00, //
811 0x00, 0x00, //
811 0x00, 0x00, //
812 0x00, 0x00, //
812 0x00, 0x00, //
813 0x00, 0x00, //
813 0x00, 0x00, //
814 0x20, 0x00, // #
814 0x20, 0x00, // #
815 0x00, 0x00, //
815 0x00, 0x00, //
816 0x00, 0x00, //
816 0x00, 0x00, //
817 0x00, 0x00, //
817 0x00, 0x00, //
818
818
819 // @360 '/' (11 pixels wide)
819 // @360 '/' (11 pixels wide)
820 0x80, 0x00, // #
820 0x80, 0x00, // #
821 0x40, 0x00, // #
821 0x40, 0x00, // #
822 0x40, 0x00, // #
822 0x40, 0x00, // #
823 0x40, 0x00, // #
823 0x40, 0x00, // #
824 0x20, 0x00, // #
824 0x20, 0x00, // #
825 0x10, 0x00, // #
825 0x10, 0x00, // #
826 0x10, 0x00, // #
826 0x10, 0x00, // #
827 0x08, 0x00, // #
827 0x08, 0x00, // #
828 0x08, 0x00, // #
828 0x08, 0x00, // #
829 0x00, 0x00, //
829 0x00, 0x00, //
830 0x00, 0x00, //
830 0x00, 0x00, //
831 0x00, 0x00, //
831 0x00, 0x00, //
832
832
833 // @384 '0' (11 pixels wide)
833 // @384 '0' (11 pixels wide)
834 0x00, 0x00, //
834 0x00, 0x00, //
835 0x70, 0x00, // ###
835 0x70, 0x00, // ###
836 0x88, 0x00, // # #
836 0x88, 0x00, // # #
837 0x88, 0x00, // # #
837 0x88, 0x00, // # #
838 0x88, 0x00, // # #
838 0x88, 0x00, // # #
839 0x88, 0x00, // # #
839 0x88, 0x00, // # #
840 0x88, 0x00, // # #
840 0x88, 0x00, // # #
841 0x88, 0x00, // # #
841 0x88, 0x00, // # #
842 0x70, 0x00, // ###
842 0x70, 0x00, // ###
843 0x00, 0x00, //
843 0x00, 0x00, //
844 0x00, 0x00, //
844 0x00, 0x00, //
845 0x00, 0x00, //
845 0x00, 0x00, //
846
846
847 // @408 '1' (11 pixels wide)
847 // @408 '1' (11 pixels wide)
848 0x00, 0x00, //
848 0x00, 0x00, //
849 0x20, 0x00, // #
849 0x20, 0x00, // #
850 0x30, 0x00, // ##
850 0x30, 0x00, // ##
851 0x20, 0x00, // #
851 0x20, 0x00, // #
852 0x20, 0x00, // #
852 0x20, 0x00, // #
853 0x20, 0x00, // #
853 0x20, 0x00, // #
854 0x20, 0x00, // #
854 0x20, 0x00, // #
855 0x20, 0x00, // #
855 0x20, 0x00, // #
856 0x70, 0x00, // ###
856 0x70, 0x00, // ###
857 0x00, 0x00, //
857 0x00, 0x00, //
858 0x00, 0x00, //
858 0x00, 0x00, //
859 0x00, 0x00, //
859 0x00, 0x00, //
860
860
861 // @432 '2' (11 pixels wide)
861 // @432 '2' (11 pixels wide)
862 0x00, 0x00, //
862 0x00, 0x00, //
863 0x70, 0x00, // ###
863 0x70, 0x00, // ###
864 0x88, 0x00, // # #
864 0x88, 0x00, // # #
865 0x80, 0x00, // #
865 0x80, 0x00, // #
866 0x40, 0x00, // #
866 0x40, 0x00, // #
867 0x20, 0x00, // #
867 0x20, 0x00, // #
868 0x10, 0x00, // #
868 0x10, 0x00, // #
869 0x08, 0x00, // #
869 0x08, 0x00, // #
870 0xF8, 0x00, // #####
870 0xF8, 0x00, // #####
871 0x00, 0x00, //
871 0x00, 0x00, //
872 0x00, 0x00, //
872 0x00, 0x00, //
873 0x00, 0x00, //
873 0x00, 0x00, //
874
874
875 // @456 '3' (11 pixels wide)
875 // @456 '3' (11 pixels wide)
876 0x00, 0x00, //
876 0x00, 0x00, //
877 0x70, 0x00, // ###
877 0x70, 0x00, // ###
878 0x88, 0x00, // # #
878 0x88, 0x00, // # #
879 0x80, 0x00, // #
879 0x80, 0x00, // #
880 0x70, 0x00, // ###
880 0x70, 0x00, // ###
881 0x80, 0x00, // #
881 0x80, 0x00, // #
882 0x80, 0x00, // #
882 0x80, 0x00, // #
883 0x88, 0x00, // # #
883 0x88, 0x00, // # #
884 0x70, 0x00, // ###
884 0x70, 0x00, // ###
885 0x00, 0x00, //
885 0x00, 0x00, //
886 0x00, 0x00, //
886 0x00, 0x00, //
887 0x00, 0x00, //
887 0x00, 0x00, //
888
888
889 // @480 '4' (11 pixels wide)
889 // @480 '4' (11 pixels wide)
890 0x00, 0x00, //
890 0x00, 0x00, //
891 0x40, 0x00, // #
891 0x40, 0x00, // #
892 0x60, 0x00, // ##
892 0x60, 0x00, // ##
893 0x50, 0x00, // # #
893 0x50, 0x00, // # #
894 0x50, 0x00, // # #
894 0x50, 0x00, // # #
895 0x48, 0x00, // # #
895 0x48, 0x00, // # #
896 0xFC, 0x00, // ######
896 0xFC, 0x00, // ######
897 0x40, 0x00, // #
897 0x40, 0x00, // #
898 0x40, 0x00, // #
898 0x40, 0x00, // #
899 0x00, 0x00, //
899 0x00, 0x00, //
900 0x00, 0x00, //
900 0x00, 0x00, //
901 0x00, 0x00, //
901 0x00, 0x00, //
902
902
903 // @504 '5' (11 pixels wide)
903 // @504 '5' (11 pixels wide)
904 0x00, 0x00, //
904 0x00, 0x00, //
905 0xF8, 0x00, // #####
905 0xF8, 0x00, // #####
906 0x08, 0x00, // #
906 0x08, 0x00, // #
907 0x78, 0x00, // ####
907 0x78, 0x00, // ####
908 0x88, 0x00, // # #
908 0x88, 0x00, // # #
909 0x80, 0x00, // #
909 0x80, 0x00, // #
910 0x80, 0x00, // #
910 0x80, 0x00, // #
911 0x88, 0x00, // # #
911 0x88, 0x00, // # #
912 0x70, 0x00, // ###
912 0x70, 0x00, // ###
913 0x00, 0x00, //
913 0x00, 0x00, //
914 0x00, 0x00, //
914 0x00, 0x00, //
915 0x00, 0x00, //
915 0x00, 0x00, //
916
916
917 // @528 '6' (11 pixels wide)
917 // @528 '6' (11 pixels wide)
918 0x00, 0x00, //
918 0x00, 0x00, //
919 0x40, 0x00, // #
919 0x40, 0x00, // #
920 0x20, 0x00, // #
920 0x20, 0x00, // #
921 0x10, 0x00, // #
921 0x10, 0x00, // #
922 0x78, 0x00, // ####
922 0x78, 0x00, // ####
923 0x88, 0x00, // # #
923 0x88, 0x00, // # #
924 0x88, 0x00, // # #
924 0x88, 0x00, // # #
925 0x88, 0x00, // # #
925 0x88, 0x00, // # #
926 0x70, 0x00, // ###
926 0x70, 0x00, // ###
927 0x00, 0x00, //
927 0x00, 0x00, //
928 0x00, 0x00, //
928 0x00, 0x00, //
929 0x00, 0x00, //
929 0x00, 0x00, //
930
930
931 // @552 '7' (11 pixels wide)
931 // @552 '7' (11 pixels wide)
932 0x00, 0x00, //
932 0x00, 0x00, //
933 0xFC, 0x00, // ######
933 0xFC, 0x00, // ######
934 0x40, 0x00, // #
934 0x40, 0x00, // #
935 0x20, 0x00, // #
935 0x20, 0x00, // #
936 0x20, 0x00, // #
936 0x20, 0x00, // #
937 0x10, 0x00, // #
937 0x10, 0x00, // #
938 0x10, 0x00, // #
938 0x10, 0x00, // #
939 0x10, 0x00, // #
939 0x10, 0x00, // #
940 0x08, 0x00, // #
940 0x08, 0x00, // #
941 0x00, 0x00, //
941 0x00, 0x00, //
942 0x00, 0x00, //
942 0x00, 0x00, //
943 0x00, 0x00, //
943 0x00, 0x00, //
944
944
945 // @576 '8' (11 pixels wide)
945 // @576 '8' (11 pixels wide)
946 0x00, 0x00, //
946 0x00, 0x00, //
947 0x70, 0x00, // ###
947 0x70, 0x00, // ###
948 0x88, 0x00, // # #
948 0x88, 0x00, // # #
949 0x88, 0x00, // # #
949 0x88, 0x00, // # #
950 0x70, 0x00, // ###
950 0x70, 0x00, // ###
951 0x88, 0x00, // # #
951 0x88, 0x00, // # #
952 0x88, 0x00, // # #
952 0x88, 0x00, // # #
953 0x88, 0x00, // # #
953 0x88, 0x00, // # #
954 0x70, 0x00, // ###
954 0x70, 0x00, // ###
955 0x00, 0x00, //
955 0x00, 0x00, //
956 0x00, 0x00, //
956 0x00, 0x00, //
957 0x00, 0x00, //
957 0x00, 0x00, //
958
958
959 // @600 '9' (11 pixels wide)
959 // @600 '9' (11 pixels wide)
960 0x00, 0x00, //
960 0x00, 0x00, //
961 0x70, 0x00, // ###
961 0x70, 0x00, // ###
962 0x88, 0x00, // # #
962 0x88, 0x00, // # #
963 0x88, 0x00, // # #
963 0x88, 0x00, // # #
964 0x88, 0x00, // # #
964 0x88, 0x00, // # #
965 0xF0, 0x00, // ####
965 0xF0, 0x00, // ####
966 0x40, 0x00, // #
966 0x40, 0x00, // #
967 0x20, 0x00, // #
967 0x20, 0x00, // #
968 0x18, 0x00, // ##
968 0x18, 0x00, // ##
969 0x00, 0x00, //
969 0x00, 0x00, //
970 0x00, 0x00, //
970 0x00, 0x00, //
971 0x00, 0x00, //
971 0x00, 0x00, //
972
972
973 // @624 ':' (11 pixels wide)
973 // @624 ':' (11 pixels wide)
974 0x00, 0x00, //
974 0x00, 0x00, //
975 0x00, 0x00, //
975 0x00, 0x00, //
976 0x00, 0x00, //
976 0x00, 0x00, //
977 0x20, 0x00, // #
977 0x20, 0x00, // #
978 0x00, 0x00, //
978 0x00, 0x00, //
979 0x00, 0x00, //
979 0x00, 0x00, //
980 0x00, 0x00, //
980 0x00, 0x00, //
981 0x20, 0x00, // #
981 0x20, 0x00, // #
982 0x00, 0x00, //
982 0x00, 0x00, //
983 0x00, 0x00, //
983 0x00, 0x00, //
984 0x00, 0x00, //
984 0x00, 0x00, //
985 0x00, 0x00, //
985 0x00, 0x00, //
986
986
987 // @648 ';' (11 pixels wide)
987 // @648 ';' (11 pixels wide)
988 0x00, 0x00, //
988 0x00, 0x00, //
989 0x00, 0x00, //
989 0x00, 0x00, //
990 0x00, 0x00, //
990 0x00, 0x00, //
991 0x20, 0x00, // #
991 0x20, 0x00, // #
992 0x00, 0x00, //
992 0x00, 0x00, //
993 0x00, 0x00, //
993 0x00, 0x00, //
994 0x00, 0x00, //
994 0x00, 0x00, //
995 0x00, 0x00, //
995 0x00, 0x00, //
996 0x20, 0x00, // #
996 0x20, 0x00, // #
997 0x10, 0x00, // #
997 0x10, 0x00, // #
998 0x00, 0x00, //
998 0x00, 0x00, //
999 0x00, 0x00, //
999 0x00, 0x00, //
1000
1000
1001 // @672 '<' (11 pixels wide)
1001 // @672 '<' (11 pixels wide)
1002 0x00, 0x00, //
1002 0x00, 0x00, //
1003 0x00, 0x00, //
1003 0x00, 0x00, //
1004 0x00, 0x00, //
1004 0x00, 0x00, //
1005 0x20, 0x00, // #
1005 0x20, 0x00, // #
1006 0x10, 0x00, // #
1006 0x10, 0x00, // #
1007 0x08, 0x00, // #
1007 0x08, 0x00, // #
1008 0x10, 0x00, // #
1008 0x10, 0x00, // #
1009 0x20, 0x00, // #
1009 0x20, 0x00, // #
1010 0x00, 0x00, //
1010 0x00, 0x00, //
1011 0x00, 0x00, //
1011 0x00, 0x00, //
1012 0x00, 0x00, //
1012 0x00, 0x00, //
1013 0x00, 0x00, //
1013 0x00, 0x00, //
1014
1014
1015 // @696 '=' (11 pixels wide)
1015 // @696 '=' (11 pixels wide)
1016 0x00, 0x00, //
1016 0x00, 0x00, //
1017 0x00, 0x00, //
1017 0x00, 0x00, //
1018 0x00, 0x00, //
1018 0x00, 0x00, //
1019 0xF0, 0x00, // ####
1019 0xF0, 0x00, // ####
1020 0x00, 0x00, //
1020 0x00, 0x00, //
1021 0x00, 0x00, //
1021 0x00, 0x00, //
1022 0xF0, 0x00, // ####
1022 0xF0, 0x00, // ####
1023 0x00, 0x00, //
1023 0x00, 0x00, //
1024 0x00, 0x00, //
1024 0x00, 0x00, //
1025 0x00, 0x00, //
1025 0x00, 0x00, //
1026 0x00, 0x00, //
1026 0x00, 0x00, //
1027 0x00, 0x00, //
1027 0x00, 0x00, //
1028
1028
1029 // @720 '>' (11 pixels wide)
1029 // @720 '>' (11 pixels wide)
1030 0x00, 0x00, //
1030 0x00, 0x00, //
1031 0x00, 0x00, //
1031 0x00, 0x00, //
1032 0x00, 0x00, //
1032 0x00, 0x00, //
1033 0x08, 0x00, // #
1033 0x08, 0x00, // #
1034 0x10, 0x00, // #
1034 0x10, 0x00, // #
1035 0x20, 0x00, // #
1035 0x20, 0x00, // #
1036 0x10, 0x00, // #
1036 0x10, 0x00, // #
1037 0x08, 0x00, // #
1037 0x08, 0x00, // #
1038 0x00, 0x00, //
1038 0x00, 0x00, //
1039 0x00, 0x00, //
1039 0x00, 0x00, //
1040 0x00, 0x00, //
1040 0x00, 0x00, //
1041 0x00, 0x00, //
1041 0x00, 0x00, //
1042
1042
1043 // @744 '?' (11 pixels wide)
1043 // @744 '?' (11 pixels wide)
1044 0x00, 0x00, //
1044 0x00, 0x00, //
1045 0x78, 0x00, // ####
1045 0x78, 0x00, // ####
1046 0x80, 0x00, // #
1046 0x80, 0x00, // #
1047 0x80, 0x00, // #
1047 0x80, 0x00, // #
1048 0x40, 0x00, // #
1048 0x40, 0x00, // #
1049 0x20, 0x00, // #
1049 0x20, 0x00, // #
1050 0x10, 0x00, // #
1050 0x10, 0x00, // #
1051 0x00, 0x00, //
1051 0x00, 0x00, //
1052 0x10, 0x00, // #
1052 0x10, 0x00, // #
1053 0x00, 0x00, //
1053 0x00, 0x00, //
1054 0x00, 0x00, //
1054 0x00, 0x00, //
1055 0x00, 0x00, //
1055 0x00, 0x00, //
1056
1056
1057 // @768 '@' (11 pixels wide)
1057 // @768 '@' (11 pixels wide)
1058 0xF8, 0x00, // #####
1058 0xF8, 0x00, // #####
1059 0x04, 0x01, // # #
1059 0x04, 0x01, // # #
1060 0x72, 0x02, // # ### #
1060 0x72, 0x02, // # ### #
1061 0xDA, 0x02, // # ## ## #
1061 0xDA, 0x02, // # ## ## #
1062 0xCA, 0x02, // # # ## #
1062 0xCA, 0x02, // # # ## #
1063 0xB2, 0x01, // # ## ##
1063 0xB2, 0x01, // # ## ##
1064 0x02, 0x00, // #
1064 0x02, 0x00, // #
1065 0x04, 0x01, // # #
1065 0x04, 0x01, // # #
1066 0xF8, 0x00, // #####
1066 0xF8, 0x00, // #####
1067 0x00, 0x00, //
1067 0x00, 0x00, //
1068 0x00, 0x00, //
1068 0x00, 0x00, //
1069 0x00, 0x00, //
1069 0x00, 0x00, //
1070
1070
1071 // @792 'A' (11 pixels wide)
1071 // @792 'A' (11 pixels wide)
1072 0x00, 0x00, //
1072 0x00, 0x00, //
1073 0x20, 0x00, // #
1073 0x20, 0x00, // #
1074 0x20, 0x00, // #
1074 0x20, 0x00, // #
1075 0x50, 0x00, // # #
1075 0x50, 0x00, // # #
1076 0x48, 0x00, // # #
1076 0x48, 0x00, // # #
1077 0x78, 0x00, // ####
1077 0x78, 0x00, // ####
1078 0x44, 0x00, // # #
1078 0x44, 0x00, // # #
1079 0x84, 0x00, // # #
1079 0x84, 0x00, // # #
1080 0x82, 0x00, // # #
1080 0x82, 0x00, // # #
1081 0x00, 0x00, //
1081 0x00, 0x00, //
1082 0x00, 0x00, //
1082 0x00, 0x00, //
1083 0x00, 0x00, //
1083 0x00, 0x00, //
1084
1084
1085 // @816 'B' (11 pixels wide)
1085 // @816 'B' (11 pixels wide)
1086 0x00, 0x00, //
1086 0x00, 0x00, //
1087 0x78, 0x00, // ####
1087 0x78, 0x00, // ####
1088 0x88, 0x00, // # #
1088 0x88, 0x00, // # #
1089 0x88, 0x00, // # #
1089 0x88, 0x00, // # #
1090 0x48, 0x00, // # #
1090 0x48, 0x00, // # #
1091 0x78, 0x00, // ####
1091 0x78, 0x00, // ####
1092 0x88, 0x00, // # #
1092 0x88, 0x00, // # #
1093 0x88, 0x00, // # #
1093 0x88, 0x00, // # #
1094 0x78, 0x00, // ####
1094 0x78, 0x00, // ####
1095 0x00, 0x00, //
1095 0x00, 0x00, //
1096 0x00, 0x00, //
1096 0x00, 0x00, //
1097 0x00, 0x00, //
1097 0x00, 0x00, //
1098
1098
1099 // @840 'C' (11 pixels wide)
1099 // @840 'C' (11 pixels wide)
1100 0x00, 0x00, //
1100 0x00, 0x00, //
1101 0xE0, 0x00, // ###
1101 0xE0, 0x00, // ###
1102 0x90, 0x00, // # #
1102 0x90, 0x00, // # #
1103 0x08, 0x00, // #
1103 0x08, 0x00, // #
1104 0x04, 0x00, // #
1104 0x04, 0x00, // #
1105 0x04, 0x00, // #
1105 0x04, 0x00, // #
1106 0x04, 0x00, // #
1106 0x04, 0x00, // #
1107 0x84, 0x00, // # #
1107 0x84, 0x00, // # #
1108 0x78, 0x00, // ####
1108 0x78, 0x00, // ####
1109 0x00, 0x00, //
1109 0x00, 0x00, //
1110 0x00, 0x00, //
1110 0x00, 0x00, //
1111 0x00, 0x00, //
1111 0x00, 0x00, //
1112
1112
1113 // @864 'D' (11 pixels wide)
1113 // @864 'D' (11 pixels wide)
1114 0x00, 0x00, //
1114 0x00, 0x00, //
1115 0x0C, 0x00, // ##
1115 0x0C, 0x00, // ##
1116 0x34, 0x00, // # ##
1116 0x34, 0x00, // # ##
1117 0x44, 0x00, // # #
1117 0x44, 0x00, // # #
1118 0x84, 0x00, // # #
1118 0x84, 0x00, // # #
1119 0x84, 0x00, // # #
1119 0x84, 0x00, // # #
1120 0x84, 0x00, // # #
1120 0x84, 0x00, // # #
1121 0x44, 0x00, // # #
1121 0x44, 0x00, // # #
1122 0x3C, 0x00, // ####
1122 0x3C, 0x00, // ####
1123 0x00, 0x00, //
1123 0x00, 0x00, //
1124 0x00, 0x00, //
1124 0x00, 0x00, //
1125 0x00, 0x00, //
1125 0x00, 0x00, //
1126
1126
1127 // @888 'E' (11 pixels wide)
1127 // @888 'E' (11 pixels wide)
1128 0x00, 0x00, //
1128 0x00, 0x00, //
1129 0xF8, 0x00, // #####
1129 0xF8, 0x00, // #####
1130 0x08, 0x00, // #
1130 0x08, 0x00, // #
1131 0x08, 0x00, // #
1131 0x08, 0x00, // #
1132 0xF8, 0x00, // #####
1132 0xF8, 0x00, // #####
1133 0x08, 0x00, // #
1133 0x08, 0x00, // #
1134 0x08, 0x00, // #
1134 0x08, 0x00, // #
1135 0x08, 0x00, // #
1135 0x08, 0x00, // #
1136 0xF8, 0x00, // #####
1136 0xF8, 0x00, // #####
1137 0x00, 0x00, //
1137 0x00, 0x00, //
1138 0x00, 0x00, //
1138 0x00, 0x00, //
1139 0x00, 0x00, //
1139 0x00, 0x00, //
1140
1140
1141 // @912 'F' (11 pixels wide)
1141 // @912 'F' (11 pixels wide)
1142 0x00, 0x00, //
1142 0x00, 0x00, //
1143 0xF0, 0x01, // #####
1143 0xF0, 0x01, // #####
1144 0x10, 0x00, // #
1144 0x10, 0x00, // #
1145 0x10, 0x00, // #
1145 0x10, 0x00, // #
1146 0xF0, 0x00, // ####
1146 0xF0, 0x00, // ####
1147 0x10, 0x00, // #
1147 0x10, 0x00, // #
1148 0x10, 0x00, // #
1148 0x10, 0x00, // #
1149 0x10, 0x00, // #
1149 0x10, 0x00, // #
1150 0x10, 0x00, // #
1150 0x10, 0x00, // #
1151 0x00, 0x00, //
1151 0x00, 0x00, //
1152 0x00, 0x00, //
1152 0x00, 0x00, //
1153 0x00, 0x00, //
1153 0x00, 0x00, //
1154
1154
1155 // @936 'G' (11 pixels wide)
1155 // @936 'G' (11 pixels wide)
1156 0x00, 0x00, //
1156 0x00, 0x00, //
1157 0xE0, 0x00, // ###
1157 0xE0, 0x00, // ###
1158 0x10, 0x01, // # #
1158 0x10, 0x01, // # #
1159 0x08, 0x00, // #
1159 0x08, 0x00, // #
1160 0x04, 0x00, // #
1160 0x04, 0x00, // #
1161 0xF4, 0x01, // # #####
1161 0xF4, 0x01, // # #####
1162 0x04, 0x01, // # #
1162 0x04, 0x01, // # #
1163 0x84, 0x00, // # #
1163 0x84, 0x00, // # #
1164 0x78, 0x00, // ####
1164 0x78, 0x00, // ####
1165 0x00, 0x00, //
1165 0x00, 0x00, //
1166 0x00, 0x00, //
1166 0x00, 0x00, //
1167 0x00, 0x00, //
1167 0x00, 0x00, //
1168
1168
1169 // @960 'H' (11 pixels wide)
1169 // @960 'H' (11 pixels wide)
1170 0x00, 0x00, //
1170 0x00, 0x00, //
1171 0x08, 0x01, // # #
1171 0x08, 0x01, // # #
1172 0x08, 0x01, // # #
1172 0x08, 0x01, // # #
1173 0x08, 0x01, // # #
1173 0x08, 0x01, // # #
1174 0xF8, 0x01, // ######
1174 0xF8, 0x01, // ######
1175 0x08, 0x01, // # #
1175 0x08, 0x01, // # #
1176 0x08, 0x01, // # #
1176 0x08, 0x01, // # #
1177 0x08, 0x01, // # #
1177 0x08, 0x01, // # #
1178 0x08, 0x01, // # #
1178 0x08, 0x01, // # #
1179 0x00, 0x00, //
1179 0x00, 0x00, //
1180 0x00, 0x00, //
1180 0x00, 0x00, //
1181 0x00, 0x00, //
1181 0x00, 0x00, //
1182
1182
1183 // @984 'I' (11 pixels wide)
1183 // @984 'I' (11 pixels wide)
1184 0x00, 0x00, //
1184 0x00, 0x00, //
1185 0x7C, 0x00, // #####
1185 0x7C, 0x00, // #####
1186 0x10, 0x00, // #
1186 0x10, 0x00, // #
1187 0x10, 0x00, // #
1187 0x10, 0x00, // #
1188 0x10, 0x00, // #
1188 0x10, 0x00, // #
1189 0x10, 0x00, // #
1189 0x10, 0x00, // #
1190 0x10, 0x00, // #
1190 0x10, 0x00, // #
1191 0x10, 0x00, // #
1191 0x10, 0x00, // #
1192 0x7C, 0x00, // #####
1192 0x7C, 0x00, // #####
1193 0x00, 0x00, //
1193 0x00, 0x00, //
1194 0x00, 0x00, //
1194 0x00, 0x00, //
1195 0x00, 0x00, //
1195 0x00, 0x00, //
1196
1196
1197 // @1008 'J' (11 pixels wide)
1197 // @1008 'J' (11 pixels wide)
1198 0x00, 0x00, //
1198 0x00, 0x00, //
1199 0xF0, 0x01, // #####
1199 0xF0, 0x01, // #####
1200 0x40, 0x00, // #
1200 0x40, 0x00, // #
1201 0x40, 0x00, // #
1201 0x40, 0x00, // #
1202 0x40, 0x00, // #
1202 0x40, 0x00, // #
1203 0x40, 0x00, // #
1203 0x40, 0x00, // #
1204 0x44, 0x00, // # #
1204 0x44, 0x00, // # #
1205 0x44, 0x00, // # #
1205 0x44, 0x00, // # #
1206 0x78, 0x00, // ####
1206 0x78, 0x00, // ####
1207 0x00, 0x00, //
1207 0x00, 0x00, //
1208 0x00, 0x00, //
1208 0x00, 0x00, //
1209 0x00, 0x00, //
1209 0x00, 0x00, //
1210
1210
1211 // @1032 'K' (11 pixels wide)
1211 // @1032 'K' (11 pixels wide)
1212 0x00, 0x00, //
1212 0x00, 0x00, //
1213 0x88, 0x00, // # #
1213 0x88, 0x00, // # #
1214 0x48, 0x00, // # #
1214 0x48, 0x00, // # #
1215 0x28, 0x00, // # #
1215 0x28, 0x00, // # #
1216 0x18, 0x00, // ##
1216 0x18, 0x00, // ##
1217 0x18, 0x00, // ##
1217 0x18, 0x00, // ##
1218 0x28, 0x00, // # #
1218 0x28, 0x00, // # #
1219 0x48, 0x00, // # #
1219 0x48, 0x00, // # #
1220 0x88, 0x00, // # #
1220 0x88, 0x00, // # #
1221 0x00, 0x00, //
1221 0x00, 0x00, //
1222 0x00, 0x00, //
1222 0x00, 0x00, //
1223 0x00, 0x00, //
1223 0x00, 0x00, //
1224
1224
1225 // @1056 'L' (11 pixels wide)
1225 // @1056 'L' (11 pixels wide)
1226 0x00, 0x00, //
1226 0x00, 0x00, //
1227 0x08, 0x00, // #
1227 0x08, 0x00, // #
1228 0x08, 0x00, // #
1228 0x08, 0x00, // #
1229 0x08, 0x00, // #
1229 0x08, 0x00, // #
1230 0x08, 0x00, // #
1230 0x08, 0x00, // #
1231 0x08, 0x00, // #
1231 0x08, 0x00, // #
1232 0x08, 0x00, // #
1232 0x08, 0x00, // #
1233 0x08, 0x00, // #
1233 0x08, 0x00, // #
1234 0x78, 0x00, // ####
1234 0x78, 0x00, // ####
1235 0x00, 0x00, //
1235 0x00, 0x00, //
1236 0x00, 0x00, //
1236 0x00, 0x00, //
1237 0x00, 0x00, //
1237 0x00, 0x00, //
1238
1238
1239 // @1080 'M' (11 pixels wide)
1239 // @1080 'M' (11 pixels wide)
1240 0x00, 0x00, //
1240 0x00, 0x00, //
1241 0x44, 0x00, // # #
1241 0x44, 0x00, // # #
1242 0x44, 0x00, // # #
1242 0x44, 0x00, // # #
1243 0x44, 0x00, // # #
1243 0x44, 0x00, // # #
1244 0xAA, 0x00, // # # # #
1244 0xAA, 0x00, // # # # #
1245 0xAA, 0x00, // # # # #
1245 0xAA, 0x00, // # # # #
1246 0xAA, 0x00, // # # # #
1246 0xAA, 0x00, // # # # #
1247 0x11, 0x01, // # # #
1247 0x11, 0x01, // # # #
1248 0x11, 0x01, // # # #
1248 0x11, 0x01, // # # #
1249 0x00, 0x00, //
1249 0x00, 0x00, //
1250 0x00, 0x00, //
1250 0x00, 0x00, //
1251 0x00, 0x00, //
1251 0x00, 0x00, //
1252
1252
1253 // @1104 'N' (11 pixels wide)
1253 // @1104 'N' (11 pixels wide)
1254 0x00, 0x00, //
1254 0x00, 0x00, //
1255 0x04, 0x01, // # #
1255 0x04, 0x01, // # #
1256 0x0C, 0x01, // ## #
1256 0x0C, 0x01, // ## #
1257 0x14, 0x01, // # # #
1257 0x14, 0x01, // # # #
1258 0x14, 0x01, // # # #
1258 0x14, 0x01, // # # #
1259 0x24, 0x01, // # # #
1259 0x24, 0x01, // # # #
1260 0x44, 0x01, // # # #
1260 0x44, 0x01, // # # #
1261 0x84, 0x01, // # ##
1261 0x84, 0x01, // # ##
1262 0x04, 0x01, // # #
1262 0x04, 0x01, // # #
1263 0x00, 0x00, //
1263 0x00, 0x00, //
1264 0x00, 0x00, //
1264 0x00, 0x00, //
1265 0x00, 0x00, //
1265 0x00, 0x00, //
1266
1266
1267 // @1128 'O' (11 pixels wide)
1267 // @1128 'O' (11 pixels wide)
1268 0x00, 0x00, //
1268 0x00, 0x00, //
1269 0xF0, 0x00, // ####
1269 0xF0, 0x00, // ####
1270 0x08, 0x01, // # #
1270 0x08, 0x01, // # #
1271 0x04, 0x01, // # #
1271 0x04, 0x01, // # #
1272 0x04, 0x01, // # #
1272 0x04, 0x01, // # #
1273 0x04, 0x01, // # #
1273 0x04, 0x01, // # #
1274 0x04, 0x01, // # #
1274 0x04, 0x01, // # #
1275 0x84, 0x00, // # #
1275 0x84, 0x00, // # #
1276 0x78, 0x00, // ####
1276 0x78, 0x00, // ####
1277 0x00, 0x00, //
1277 0x00, 0x00, //
1278 0x00, 0x00, //
1278 0x00, 0x00, //
1279 0x00, 0x00, //
1279 0x00, 0x00, //
1280
1280
1281 // @1152 'P' (11 pixels wide)
1281 // @1152 'P' (11 pixels wide)
1282 0x00, 0x00, //
1282 0x00, 0x00, //
1283 0x70, 0x00, // ###
1283 0x70, 0x00, // ###
1284 0x90, 0x00, // # #
1284 0x90, 0x00, // # #
1285 0x90, 0x00, // # #
1285 0x90, 0x00, // # #
1286 0x90, 0x00, // # #
1286 0x90, 0x00, // # #
1287 0x90, 0x00, // # #
1287 0x90, 0x00, // # #
1288 0x70, 0x00, // ###
1288 0x70, 0x00, // ###
1289 0x10, 0x00, // #
1289 0x10, 0x00, // #
1290 0x10, 0x00, // #
1290 0x10, 0x00, // #
1291 0x00, 0x00, //
1291 0x00, 0x00, //
1292 0x00, 0x00, //
1292 0x00, 0x00, //
1293 0x00, 0x00, //
1293 0x00, 0x00, //
1294
1294
1295 // @1176 'Q' (11 pixels wide)
1295 // @1176 'Q' (11 pixels wide)
1296 0x00, 0x00, //
1296 0x00, 0x00, //
1297 0xF0, 0x00, // ####
1297 0xF0, 0x00, // ####
1298 0x08, 0x01, // # #
1298 0x08, 0x01, // # #
1299 0x04, 0x02, // # #
1299 0x04, 0x02, // # #
1300 0x04, 0x02, // # #
1300 0x04, 0x02, // # #
1301 0x04, 0x02, // # #
1301 0x04, 0x02, // # #
1302 0x24, 0x02, // # # #
1302 0x24, 0x02, // # # #
1303 0x48, 0x01, // # # #
1303 0x48, 0x01, // # # #
1304 0xF0, 0x01, // #####
1304 0xF0, 0x01, // #####
1305 0x00, 0x03, // ##
1305 0x00, 0x03, // ##
1306 0x00, 0x02, // #
1306 0x00, 0x02, // #
1307 0x00, 0x00, //
1307 0x00, 0x00, //
1308
1308
1309 // @1200 'R' (11 pixels wide)
1309 // @1200 'R' (11 pixels wide)
1310 0x00, 0x00, //
1310 0x00, 0x00, //
1311 0x38, 0x00, // ###
1311 0x38, 0x00, // ###
1312 0x48, 0x00, // # #
1312 0x48, 0x00, // # #
1313 0x48, 0x00, // # #
1313 0x48, 0x00, // # #
1314 0x48, 0x00, // # #
1314 0x48, 0x00, // # #
1315 0x38, 0x00, // ###
1315 0x38, 0x00, // ###
1316 0x28, 0x00, // # #
1316 0x28, 0x00, // # #
1317 0x48, 0x00, // # #
1317 0x48, 0x00, // # #
1318 0x88, 0x00, // # #
1318 0x88, 0x00, // # #
1319 0x00, 0x00, //
1319 0x00, 0x00, //
1320 0x00, 0x00, //
1320 0x00, 0x00, //
1321 0x00, 0x00, //
1321 0x00, 0x00, //
1322
1322
1323 // @1224 'S' (11 pixels wide)
1323 // @1224 'S' (11 pixels wide)
1324 0x00, 0x00, //
1324 0x00, 0x00, //
1325 0xE0, 0x01, // ####
1325 0xE0, 0x01, // ####
1326 0x10, 0x00, // #
1326 0x10, 0x00, // #
1327 0x10, 0x00, // #
1327 0x10, 0x00, // #
1328 0xE0, 0x00, // ###
1328 0xE0, 0x00, // ###
1329 0x00, 0x01, // #
1329 0x00, 0x01, // #
1330 0x00, 0x01, // #
1330 0x00, 0x01, // #
1331 0x08, 0x01, // # #
1331 0x08, 0x01, // # #
1332 0xF0, 0x00, // ####
1332 0xF0, 0x00, // ####
1333 0x00, 0x00, //
1333 0x00, 0x00, //
1334 0x00, 0x00, //
1334 0x00, 0x00, //
1335 0x00, 0x00, //
1335 0x00, 0x00, //
1336
1336
1337 // @1248 'T' (11 pixels wide)
1337 // @1248 'T' (11 pixels wide)
1338 0x00, 0x00, //
1338 0x00, 0x00, //
1339 0xFC, 0x01, // #######
1339 0xFC, 0x01, // #######
1340 0x20, 0x00, // #
1340 0x20, 0x00, // #
1341 0x20, 0x00, // #
1341 0x20, 0x00, // #
1342 0x20, 0x00, // #
1342 0x20, 0x00, // #
1343 0x20, 0x00, // #
1343 0x20, 0x00, // #
1344 0x20, 0x00, // #
1344 0x20, 0x00, // #
1345 0x20, 0x00, // #
1345 0x20, 0x00, // #
1346 0x20, 0x00, // #
1346 0x20, 0x00, // #
1347 0x00, 0x00, //
1347 0x00, 0x00, //
1348 0x00, 0x00, //
1348 0x00, 0x00, //
1349 0x00, 0x00, //
1349 0x00, 0x00, //
1350
1350
1351 // @1272 'U' (11 pixels wide)
1351 // @1272 'U' (11 pixels wide)
1352 0x00, 0x00, //
1352 0x00, 0x00, //
1353 0x84, 0x00, // # #
1353 0x84, 0x00, // # #
1354 0x84, 0x00, // # #
1354 0x84, 0x00, // # #
1355 0x84, 0x00, // # #
1355 0x84, 0x00, // # #
1356 0x84, 0x00, // # #
1356 0x84, 0x00, // # #
1357 0x84, 0x00, // # #
1357 0x84, 0x00, // # #
1358 0x84, 0x00, // # #
1358 0x84, 0x00, // # #
1359 0x84, 0x00, // # #
1359 0x84, 0x00, // # #
1360 0x78, 0x00, // ####
1360 0x78, 0x00, // ####
1361 0x00, 0x00, //
1361 0x00, 0x00, //
1362 0x00, 0x00, //
1362 0x00, 0x00, //
1363 0x00, 0x00, //
1363 0x00, 0x00, //
1364
1364
1365 // @1296 'V' (11 pixels wide)
1365 // @1296 'V' (11 pixels wide)
1366 0x00, 0x00, //
1366 0x00, 0x00, //
1367 0x88, 0x00, // # #
1367 0x88, 0x00, // # #
1368 0x88, 0x00, // # #
1368 0x88, 0x00, // # #
1369 0x88, 0x00, // # #
1369 0x88, 0x00, // # #
1370 0x50, 0x00, // # #
1370 0x50, 0x00, // # #
1371 0x50, 0x00, // # #
1371 0x50, 0x00, // # #
1372 0x50, 0x00, // # #
1372 0x50, 0x00, // # #
1373 0x50, 0x00, // # #
1373 0x50, 0x00, // # #
1374 0x20, 0x00, // #
1374 0x20, 0x00, // #
1375 0x00, 0x00, //
1375 0x00, 0x00, //
1376 0x00, 0x00, //
1376 0x00, 0x00, //
1377 0x00, 0x00, //
1377 0x00, 0x00, //
1378
1378
1379 // @1320 'W' (11 pixels wide)
1379 // @1320 'W' (11 pixels wide)
1380 0x00, 0x00, //
1380 0x00, 0x00, //
1381 0x21, 0x04, // # # #
1381 0x21, 0x04, // # # #
1382 0x21, 0x04, // # # #
1382 0x21, 0x04, // # # #
1383 0x52, 0x02, // # # # #
1383 0x52, 0x02, // # # # #
1384 0x52, 0x02, // # # # #
1384 0x52, 0x02, // # # # #
1385 0x4A, 0x01, // # # # #
1385 0x4A, 0x01, // # # # #
1386 0x4A, 0x01, // # # # #
1386 0x4A, 0x01, // # # # #
1387 0x44, 0x01, // # # #
1387 0x44, 0x01, // # # #
1388 0x84, 0x00, // # #
1388 0x84, 0x00, // # #
1389 0x00, 0x00, //
1389 0x00, 0x00, //
1390 0x00, 0x00, //
1390 0x00, 0x00, //
1391 0x00, 0x00, //
1391 0x00, 0x00, //
1392
1392
1393 // @1344 'X' (11 pixels wide)
1393 // @1344 'X' (11 pixels wide)
1394 0x00, 0x00, //
1394 0x00, 0x00, //
1395 0x82, 0x00, // # #
1395 0x82, 0x00, // # #
1396 0x44, 0x00, // # #
1396 0x44, 0x00, // # #
1397 0x28, 0x00, // # #
1397 0x28, 0x00, // # #
1398 0x10, 0x00, // #
1398 0x10, 0x00, // #
1399 0x10, 0x00, // #
1399 0x10, 0x00, // #
1400 0x28, 0x00, // # #
1400 0x28, 0x00, // # #
1401 0x44, 0x00, // # #
1401 0x44, 0x00, // # #
1402 0x82, 0x00, // # #
1402 0x82, 0x00, // # #
1403 0x00, 0x00, //
1403 0x00, 0x00, //
1404 0x00, 0x00, //
1404 0x00, 0x00, //
1405 0x00, 0x00, //
1405 0x00, 0x00, //
1406
1406
1407 // @1368 'Y' (11 pixels wide)
1407 // @1368 'Y' (11 pixels wide)
1408 0x00, 0x00, //
1408 0x00, 0x00, //
1409 0x84, 0x00, // # #
1409 0x84, 0x00, // # #
1410 0x48, 0x00, // # #
1410 0x48, 0x00, // # #
1411 0x48, 0x00, // # #
1411 0x48, 0x00, // # #
1412 0x50, 0x00, // # #
1412 0x50, 0x00, // # #
1413 0x30, 0x00, // ##
1413 0x30, 0x00, // ##
1414 0x20, 0x00, // #
1414 0x20, 0x00, // #
1415 0x10, 0x00, // #
1415 0x10, 0x00, // #
1416 0x10, 0x00, // #
1416 0x10, 0x00, // #
1417 0x00, 0x00, //
1417 0x00, 0x00, //
1418 0x00, 0x00, //
1418 0x00, 0x00, //
1419 0x00, 0x00, //
1419 0x00, 0x00, //
1420
1420
1421 // @1392 'Z' (11 pixels wide)
1421 // @1392 'Z' (11 pixels wide)
1422 0x00, 0x00, //
1422 0x00, 0x00, //
1423 0xFC, 0x01, // #######
1423 0xFC, 0x01, // #######
1424 0x80, 0x00, // #
1424 0x80, 0x00, // #
1425 0x40, 0x00, // #
1425 0x40, 0x00, // #
1426 0x20, 0x00, // #
1426 0x20, 0x00, // #
1427 0x10, 0x00, // #
1427 0x10, 0x00, // #
1428 0x08, 0x00, // #
1428 0x08, 0x00, // #
1429 0x04, 0x00, // #
1429 0x04, 0x00, // #
1430 0xFC, 0x01, // #######
1430 0xFC, 0x01, // #######
1431 0x00, 0x00, //
1431 0x00, 0x00, //
1432 0x00, 0x00, //
1432 0x00, 0x00, //
1433 0x00, 0x00, //
1433 0x00, 0x00, //
1434
1434
1435 // @1416 '[' (11 pixels wide)
1435 // @1416 '[' (11 pixels wide)
1436 0x70, 0x00, // ###
1436 0x70, 0x00, // ###
1437 0x10, 0x00, // #
1437 0x10, 0x00, // #
1438 0x10, 0x00, // #
1438 0x10, 0x00, // #
1439 0x10, 0x00, // #
1439 0x10, 0x00, // #
1440 0x10, 0x00, // #
1440 0x10, 0x00, // #
1441 0x10, 0x00, // #
1441 0x10, 0x00, // #
1442 0x10, 0x00, // #
1442 0x10, 0x00, // #
1443 0x10, 0x00, // #
1443 0x10, 0x00, // #
1444 0x10, 0x00, // #
1444 0x10, 0x00, // #
1445 0x10, 0x00, // #
1445 0x10, 0x00, // #
1446 0x70, 0x00, // ###
1446 0x70, 0x00, // ###
1447 0x00, 0x00, //
1447 0x00, 0x00, //
1448
1448
1449 // @1440 '\' (11 pixels wide)
1449 // @1440 '\' (11 pixels wide)
1450 0x00, 0x00, //
1450 0x00, 0x00, //
1451 0x08, 0x00, // #
1451 0x08, 0x00, // #
1452 0x08, 0x00, // #
1452 0x08, 0x00, // #
1453 0x10, 0x00, // #
1453 0x10, 0x00, // #
1454 0x10, 0x00, // #
1454 0x10, 0x00, // #
1455 0x20, 0x00, // #
1455 0x20, 0x00, // #
1456 0x20, 0x00, // #
1456 0x20, 0x00, // #
1457 0x20, 0x00, // #
1457 0x20, 0x00, // #
1458 0x40, 0x00, // #
1458 0x40, 0x00, // #
1459 0x40, 0x00, // #
1459 0x40, 0x00, // #
1460 0x00, 0x00, //
1460 0x00, 0x00, //
1461 0x00, 0x00, //
1461 0x00, 0x00, //
1462
1462
1463 // @1464 ']' (11 pixels wide)
1463 // @1464 ']' (11 pixels wide)
1464 0x38, 0x00, // ###
1464 0x38, 0x00, // ###
1465 0x20, 0x00, // #
1465 0x20, 0x00, // #
1466 0x20, 0x00, // #
1466 0x20, 0x00, // #
1467 0x20, 0x00, // #
1467 0x20, 0x00, // #
1468 0x20, 0x00, // #
1468 0x20, 0x00, // #
1469 0x20, 0x00, // #
1469 0x20, 0x00, // #
1470 0x20, 0x00, // #
1470 0x20, 0x00, // #
1471 0x20, 0x00, // #
1471 0x20, 0x00, // #
1472 0x20, 0x00, // #
1472 0x20, 0x00, // #
1473 0x20, 0x00, // #
1473 0x20, 0x00, // #
1474 0x38, 0x00, // ###
1474 0x38, 0x00, // ###
1475 0x00, 0x00, //
1475 0x00, 0x00, //
1476
1476
1477 // @1488 '^' (11 pixels wide)
1477 // @1488 '^' (11 pixels wide)
1478 0x30, 0x00, // ##
1478 0x30, 0x00, // ##
1479 0x30, 0x00, // ##
1479 0x30, 0x00, // ##
1480 0x48, 0x00, // # #
1480 0x48, 0x00, // # #
1481 0x00, 0x00, //
1481 0x00, 0x00, //
1482 0x00, 0x00, //
1482 0x00, 0x00, //
1483 0x00, 0x00, //
1483 0x00, 0x00, //
1484 0x00, 0x00, //
1484 0x00, 0x00, //
1485 0x00, 0x00, //
1485 0x00, 0x00, //
1486 0x00, 0x00, //
1486 0x00, 0x00, //
1487 0x00, 0x00, //
1487 0x00, 0x00, //
1488 0x00, 0x00, //
1488 0x00, 0x00, //
1489 0x00, 0x00, //
1489 0x00, 0x00, //
1490
1490
1491 // @1512 '_' (11 pixels wide)
1491 // @1512 '_' (11 pixels wide)
1492 0x00, 0x00, //
1492 0x00, 0x00, //
1493 0x00, 0x00, //
1493 0x00, 0x00, //
1494 0x00, 0x00, //
1494 0x00, 0x00, //
1495 0x00, 0x00, //
1495 0x00, 0x00, //
1496 0x00, 0x00, //
1496 0x00, 0x00, //
1497 0x00, 0x00, //
1497 0x00, 0x00, //
1498 0x00, 0x00, //
1498 0x00, 0x00, //
1499 0x00, 0x00, //
1499 0x00, 0x00, //
1500 0x00, 0x00, //
1500 0x00, 0x00, //
1501 0x00, 0x00, //
1501 0x00, 0x00, //
1502 0xFC, 0x01, // #######
1502 0xFC, 0x01, // #######
1503 0x00, 0x00, //
1503 0x00, 0x00, //
1504
1504
1505 // @1536 '`' (11 pixels wide)
1505 // @1536 '`' (11 pixels wide)
1506 0x04, 0x00, // #
1506 0x04, 0x00, // #
1507 0x08, 0x00, // #
1507 0x08, 0x00, // #
1508 0x00, 0x00, //
1508 0x00, 0x00, //
1509 0x00, 0x00, //
1509 0x00, 0x00, //
1510 0x00, 0x00, //
1510 0x00, 0x00, //
1511 0x00, 0x00, //
1511 0x00, 0x00, //
1512 0x00, 0x00, //
1512 0x00, 0x00, //
1513 0x00, 0x00, //
1513 0x00, 0x00, //
1514 0x00, 0x00, //
1514 0x00, 0x00, //
1515 0x00, 0x00, //
1515 0x00, 0x00, //
1516 0x00, 0x00, //
1516 0x00, 0x00, //
1517 0x00, 0x00, //
1517 0x00, 0x00, //
1518
1518
1519 // @1560 'a' (11 pixels wide)
1519 // @1560 'a' (11 pixels wide)
1520 0x00, 0x00, //
1520 0x00, 0x00, //
1521 0x00, 0x00, //
1521 0x00, 0x00, //
1522 0x00, 0x00, //
1522 0x00, 0x00, //
1523 0xE0, 0x00, // ###
1523 0xE0, 0x00, // ###
1524 0x90, 0x00, // # #
1524 0x90, 0x00, // # #
1525 0x88, 0x00, // # #
1525 0x88, 0x00, // # #
1526 0x88, 0x00, // # #
1526 0x88, 0x00, // # #
1527 0x88, 0x00, // # #
1527 0x88, 0x00, // # #
1528 0x70, 0x01, // ### #
1528 0x70, 0x01, // ### #
1529 0x00, 0x00, //
1529 0x00, 0x00, //
1530 0x00, 0x00, //
1530 0x00, 0x00, //
1531 0x00, 0x00, //
1531 0x00, 0x00, //
1532
1532
1533 // @1584 'b' (11 pixels wide)
1533 // @1584 'b' (11 pixels wide)
1534 0x08, 0x00, // #
1534 0x08, 0x00, // #
1535 0x08, 0x00, // #
1535 0x08, 0x00, // #
1536 0x08, 0x00, // #
1536 0x08, 0x00, // #
1537 0x78, 0x00, // ####
1537 0x78, 0x00, // ####
1538 0x88, 0x00, // # #
1538 0x88, 0x00, // # #
1539 0x88, 0x00, // # #
1539 0x88, 0x00, // # #
1540 0x88, 0x00, // # #
1540 0x88, 0x00, // # #
1541 0x88, 0x00, // # #
1541 0x88, 0x00, // # #
1542 0x78, 0x00, // ####
1542 0x78, 0x00, // ####
1543 0x00, 0x00, //
1543 0x00, 0x00, //
1544 0x00, 0x00, //
1544 0x00, 0x00, //
1545 0x00, 0x00, //
1545 0x00, 0x00, //
1546
1546
1547 // @1608 'c' (11 pixels wide)
1547 // @1608 'c' (11 pixels wide)
1548 0x00, 0x00, //
1548 0x00, 0x00, //
1549 0x00, 0x00, //
1549 0x00, 0x00, //
1550 0x00, 0x00, //
1550 0x00, 0x00, //
1551 0x60, 0x00, // ##
1551 0x60, 0x00, // ##
1552 0x90, 0x00, // # #
1552 0x90, 0x00, // # #
1553 0x08, 0x00, // #
1553 0x08, 0x00, // #
1554 0x08, 0x00, // #
1554 0x08, 0x00, // #
1555 0x88, 0x00, // # #
1555 0x88, 0x00, // # #
1556 0x70, 0x00, // ###
1556 0x70, 0x00, // ###
1557 0x00, 0x00, //
1557 0x00, 0x00, //
1558 0x00, 0x00, //
1558 0x00, 0x00, //
1559 0x00, 0x00, //
1559 0x00, 0x00, //
1560
1560
1561 // @1632 'd' (11 pixels wide)
1561 // @1632 'd' (11 pixels wide)
1562 0x80, 0x00, // #
1562 0x80, 0x00, // #
1563 0x80, 0x00, // #
1563 0x80, 0x00, // #
1564 0x80, 0x00, // #
1564 0x80, 0x00, // #
1565 0xF0, 0x00, // ####
1565 0xF0, 0x00, // ####
1566 0x88, 0x00, // # #
1566 0x88, 0x00, // # #
1567 0x88, 0x00, // # #
1567 0x88, 0x00, // # #
1568 0x88, 0x00, // # #
1568 0x88, 0x00, // # #
1569 0x88, 0x00, // # #
1569 0x88, 0x00, // # #
1570 0xF0, 0x00, // ####
1570 0xF0, 0x00, // ####
1571 0x00, 0x00, //
1571 0x00, 0x00, //
1572 0x00, 0x00, //
1572 0x00, 0x00, //
1573 0x00, 0x00, //
1573 0x00, 0x00, //
1574
1574
1575 // @1656 'e' (11 pixels wide)
1575 // @1656 'e' (11 pixels wide)
1576 0x00, 0x00, //
1576 0x00, 0x00, //
1577 0x00, 0x00, //
1577 0x00, 0x00, //
1578 0x00, 0x00, //
1578 0x00, 0x00, //
1579 0x38, 0x00, // ###
1579 0x38, 0x00, // ###
1580 0x44, 0x00, // # #
1580 0x44, 0x00, // # #
1581 0x24, 0x00, // # #
1581 0x24, 0x00, // # #
1582 0x1C, 0x00, // ###
1582 0x1C, 0x00, // ###
1583 0x44, 0x00, // # #
1583 0x44, 0x00, // # #
1584 0x38, 0x00, // ###
1584 0x38, 0x00, // ###
1585 0x00, 0x00, //
1585 0x00, 0x00, //
1586 0x00, 0x00, //
1586 0x00, 0x00, //
1587 0x00, 0x00, //
1587 0x00, 0x00, //
1588
1588
1589 // @1680 'f' (11 pixels wide)
1589 // @1680 'f' (11 pixels wide)
1590 0xC0, 0x00, // ##
1590 0xC0, 0x00, // ##
1591 0x20, 0x00, // #
1591 0x20, 0x00, // #
1592 0x20, 0x00, // #
1592 0x20, 0x00, // #
1593 0xF8, 0x00, // #####
1593 0xF8, 0x00, // #####
1594 0x20, 0x00, // #
1594 0x20, 0x00, // #
1595 0x20, 0x00, // #
1595 0x20, 0x00, // #
1596 0x20, 0x00, // #
1596 0x20, 0x00, // #
1597 0x20, 0x00, // #
1597 0x20, 0x00, // #
1598 0x20, 0x00, // #
1598 0x20, 0x00, // #
1599 0x00, 0x00, //
1599 0x00, 0x00, //
1600 0x00, 0x00, //
1600 0x00, 0x00, //
1601 0x00, 0x00, //
1601 0x00, 0x00, //
1602
1602
1603 // @1704 'g' (11 pixels wide)
1603 // @1704 'g' (11 pixels wide)
1604 0x00, 0x00, //
1604 0x00, 0x00, //
1605 0x00, 0x00, //
1605 0x00, 0x00, //
1606 0x00, 0x00, //
1606 0x00, 0x00, //
1607 0x30, 0x00, // ##
1607 0x30, 0x00, // ##
1608 0x48, 0x00, // # #
1608 0x48, 0x00, // # #
1609 0x44, 0x00, // # #
1609 0x44, 0x00, // # #
1610 0x44, 0x00, // # #
1610 0x44, 0x00, // # #
1611 0x44, 0x00, // # #
1611 0x44, 0x00, // # #
1612 0x78, 0x00, // ####
1612 0x78, 0x00, // ####
1613 0x40, 0x00, // #
1613 0x40, 0x00, // #
1614 0x20, 0x00, // #
1614 0x20, 0x00, // #
1615 0x1C, 0x00, // ###
1615 0x1C, 0x00, // ###
1616
1616
1617 // @1728 'h' (11 pixels wide)
1617 // @1728 'h' (11 pixels wide)
1618 0x08, 0x00, // #
1618 0x08, 0x00, // #
1619 0x08, 0x00, // #
1619 0x08, 0x00, // #
1620 0x08, 0x00, // #
1620 0x08, 0x00, // #
1621 0x68, 0x00, // # ##
1621 0x68, 0x00, // # ##
1622 0x98, 0x00, // ## #
1622 0x98, 0x00, // ## #
1623 0x88, 0x00, // # #
1623 0x88, 0x00, // # #
1624 0x88, 0x00, // # #
1624 0x88, 0x00, // # #
1625 0x88, 0x00, // # #
1625 0x88, 0x00, // # #
1626 0x88, 0x00, // # #
1626 0x88, 0x00, // # #
1627 0x00, 0x00, //
1627 0x00, 0x00, //
1628 0x00, 0x00, //
1628 0x00, 0x00, //
1629 0x00, 0x00, //
1629 0x00, 0x00, //
1630
1630
1631 // @1752 'i' (11 pixels wide)
1631 // @1752 'i' (11 pixels wide)
1632 0x00, 0x00, //
1632 0x00, 0x00, //
1633 0x20, 0x00, // #
1633 0x20, 0x00, // #
1634 0x00, 0x00, //
1634 0x00, 0x00, //
1635 0x20, 0x00, // #
1635 0x20, 0x00, // #
1636 0x20, 0x00, // #
1636 0x20, 0x00, // #
1637 0x20, 0x00, // #
1637 0x20, 0x00, // #
1638 0x20, 0x00, // #
1638 0x20, 0x00, // #
1639 0x20, 0x00, // #
1639 0x20, 0x00, // #
1640 0x20, 0x00, // #
1640 0x20, 0x00, // #
1641 0x00, 0x00, //
1641 0x00, 0x00, //
1642 0x00, 0x00, //
1642 0x00, 0x00, //
1643 0x00, 0x00, //
1643 0x00, 0x00, //
1644
1644
1645 // @1776 'j' (11 pixels wide)
1645 // @1776 'j' (11 pixels wide)
1646 0x00, 0x00, //
1646 0x00, 0x00, //
1647 0x10, 0x00, // #
1647 0x10, 0x00, // #
1648 0x00, 0x00, //
1648 0x00, 0x00, //
1649 0x10, 0x00, // #
1649 0x10, 0x00, // #
1650 0x10, 0x00, // #
1650 0x10, 0x00, // #
1651 0x10, 0x00, // #
1651 0x10, 0x00, // #
1652 0x10, 0x00, // #
1652 0x10, 0x00, // #
1653 0x10, 0x00, // #
1653 0x10, 0x00, // #
1654 0x10, 0x00, // #
1654 0x10, 0x00, // #
1655 0x10, 0x00, // #
1655 0x10, 0x00, // #
1656 0x12, 0x00, // # #
1656 0x12, 0x00, // # #
1657 0x0C, 0x00, // ##
1657 0x0C, 0x00, // ##
1658
1658
1659 // @1800 'k' (11 pixels wide)
1659 // @1800 'k' (11 pixels wide)
1660 0x04, 0x00, // #
1660 0x04, 0x00, // #
1661 0x04, 0x00, // #
1661 0x04, 0x00, // #
1662 0x04, 0x00, // #
1662 0x04, 0x00, // #
1663 0x44, 0x00, // # #
1663 0x44, 0x00, // # #
1664 0x24, 0x00, // # #
1664 0x24, 0x00, // # #
1665 0x14, 0x00, // # #
1665 0x14, 0x00, // # #
1666 0x1C, 0x00, // ###
1666 0x1C, 0x00, // ###
1667 0x24, 0x00, // # #
1667 0x24, 0x00, // # #
1668 0x44, 0x00, // # #
1668 0x44, 0x00, // # #
1669 0x00, 0x00, //
1669 0x00, 0x00, //
1670 0x00, 0x00, //
1670 0x00, 0x00, //
1671 0x00, 0x00, //
1671 0x00, 0x00, //
1672
1672
1673 // @1824 'l' (11 pixels wide)
1673 // @1824 'l' (11 pixels wide)
1674 0x20, 0x00, // #
1674 0x20, 0x00, // #
1675 0x20, 0x00, // #
1675 0x20, 0x00, // #
1676 0x20, 0x00, // #
1676 0x20, 0x00, // #
1677 0x20, 0x00, // #
1677 0x20, 0x00, // #
1678 0x20, 0x00, // #
1678 0x20, 0x00, // #
1679 0x20, 0x00, // #
1679 0x20, 0x00, // #
1680 0x20, 0x00, // #
1680 0x20, 0x00, // #
1681 0x20, 0x00, // #
1681 0x20, 0x00, // #
1682 0x20, 0x00, // #
1682 0x20, 0x00, // #
1683 0x00, 0x00, //
1683 0x00, 0x00, //
1684 0x00, 0x00, //
1684 0x00, 0x00, //
1685 0x00, 0x00, //
1685 0x00, 0x00, //
1686
1686
1687 // @1848 'm' (11 pixels wide)
1687 // @1848 'm' (11 pixels wide)
1688 0x00, 0x00, //
1688 0x00, 0x00, //
1689 0x00, 0x00, //
1689 0x00, 0x00, //
1690 0x00, 0x00, //
1690 0x00, 0x00, //
1691 0x94, 0x00, // # # #
1691 0x94, 0x00, // # # #
1692 0x6C, 0x01, // ## ## #
1692 0x6C, 0x01, // ## ## #
1693 0x24, 0x01, // # # #
1693 0x24, 0x01, // # # #
1694 0x24, 0x01, // # # #
1694 0x24, 0x01, // # # #
1695 0x24, 0x01, // # # #
1695 0x24, 0x01, // # # #
1696 0x24, 0x01, // # # #
1696 0x24, 0x01, // # # #
1697 0x00, 0x00, //
1697 0x00, 0x00, //
1698 0x00, 0x00, //
1698 0x00, 0x00, //
1699 0x00, 0x00, //
1699 0x00, 0x00, //
1700
1700
1701 // @1872 'n' (11 pixels wide)
1701 // @1872 'n' (11 pixels wide)
1702 0x00, 0x00, //
1702 0x00, 0x00, //
1703 0x00, 0x00, //
1703 0x00, 0x00, //
1704 0x00, 0x00, //
1704 0x00, 0x00, //
1705 0x68, 0x00, // # ##
1705 0x68, 0x00, // # ##
1706 0x98, 0x00, // ## #
1706 0x98, 0x00, // ## #
1707 0x88, 0x00, // # #
1707 0x88, 0x00, // # #
1708 0x88, 0x00, // # #
1708 0x88, 0x00, // # #
1709 0x88, 0x00, // # #
1709 0x88, 0x00, // # #
1710 0x88, 0x00, // # #
1710 0x88, 0x00, // # #
1711 0x00, 0x00, //
1711 0x00, 0x00, //
1712 0x00, 0x00, //
1712 0x00, 0x00, //
1713 0x00, 0x00, //
1713 0x00, 0x00, //
1714
1714
1715 // @1896 'o' (11 pixels wide)
1715 // @1896 'o' (11 pixels wide)
1716 0x00, 0x00, //
1716 0x00, 0x00, //
1717 0x00, 0x00, //
1717 0x00, 0x00, //
1718 0x00, 0x00, //
1718 0x00, 0x00, //
1719 0x70, 0x00, // ###
1719 0x70, 0x00, // ###
1720 0x88, 0x00, // # #
1720 0x88, 0x00, // # #
1721 0x88, 0x00, // # #
1721 0x88, 0x00, // # #
1722 0x88, 0x00, // # #
1722 0x88, 0x00, // # #
1723 0x88, 0x00, // # #
1723 0x88, 0x00, // # #
1724 0x70, 0x00, // ###
1724 0x70, 0x00, // ###
1725 0x00, 0x00, //
1725 0x00, 0x00, //
1726 0x00, 0x00, //
1726 0x00, 0x00, //
1727 0x00, 0x00, //
1727 0x00, 0x00, //
1728
1728
1729 // @1920 'p' (11 pixels wide)
1729 // @1920 'p' (11 pixels wide)
1730 0x00, 0x00, //
1730 0x00, 0x00, //
1731 0x00, 0x00, //
1731 0x00, 0x00, //
1732 0x00, 0x00, //
1732 0x00, 0x00, //
1733 0x3C, 0x00, // ####
1733 0x3C, 0x00, // ####
1734 0x44, 0x00, // # #
1734 0x44, 0x00, // # #
1735 0x44, 0x00, // # #
1735 0x44, 0x00, // # #
1736 0x44, 0x00, // # #
1736 0x44, 0x00, // # #
1737 0x44, 0x00, // # #
1737 0x44, 0x00, // # #
1738 0x3C, 0x00, // ####
1738 0x3C, 0x00, // ####
1739 0x04, 0x00, // #
1739 0x04, 0x00, // #
1740 0x04, 0x00, // #
1740 0x04, 0x00, // #
1741 0x04, 0x00, // #
1741 0x04, 0x00, // #
1742
1742
1743 // @1944 'q' (11 pixels wide)
1743 // @1944 'q' (11 pixels wide)
1744 0x00, 0x00, //
1744 0x00, 0x00, //
1745 0x00, 0x00, //
1745 0x00, 0x00, //
1746 0x00, 0x00, //
1746 0x00, 0x00, //
1747 0xE0, 0x00, // ###
1747 0xE0, 0x00, // ###
1748 0x90, 0x00, // # #
1748 0x90, 0x00, // # #
1749 0x88, 0x00, // # #
1749 0x88, 0x00, // # #
1750 0x88, 0x00, // # #
1750 0x88, 0x00, // # #
1751 0x88, 0x00, // # #
1751 0x88, 0x00, // # #
1752 0xF0, 0x00, // ####
1752 0xF0, 0x00, // ####
1753 0x80, 0x00, // #
1753 0x80, 0x00, // #
1754 0x80, 0x00, // #
1754 0x80, 0x00, // #
1755 0x80, 0x00, // #
1755 0x80, 0x00, // #
1756
1756
1757 // @1968 'r' (11 pixels wide)
1757 // @1968 'r' (11 pixels wide)
1758 0x00, 0x00, //
1758 0x00, 0x00, //
1759 0x00, 0x00, //
1759 0x00, 0x00, //
1760 0x00, 0x00, //
1760 0x00, 0x00, //
1761 0x70, 0x00, // ###
1761 0x70, 0x00, // ###
1762 0x50, 0x00, // # #
1762 0x50, 0x00, // # #
1763 0x10, 0x00, // #
1763 0x10, 0x00, // #
1764 0x10, 0x00, // #
1764 0x10, 0x00, // #
1765 0x10, 0x00, // #
1765 0x10, 0x00, // #
1766 0x10, 0x00, // #
1766 0x10, 0x00, // #
1767 0x00, 0x00, //
1767 0x00, 0x00, //
1768 0x00, 0x00, //
1768 0x00, 0x00, //
1769 0x00, 0x00, //
1769 0x00, 0x00, //
1770
1770
1771 // @1992 's' (11 pixels wide)
1771 // @1992 's' (11 pixels wide)
1772 0x00, 0x00, //
1772 0x00, 0x00, //
1773 0x00, 0x00, //
1773 0x00, 0x00, //
1774 0x00, 0x00, //
1774 0x00, 0x00, //
1775 0x70, 0x00, // ###
1775 0x70, 0x00, // ###
1776 0x08, 0x00, // #
1776 0x08, 0x00, // #
1777 0x10, 0x00, // #
1777 0x10, 0x00, // #
1778 0x20, 0x00, // #
1778 0x20, 0x00, // #
1779 0x40, 0x00, // #
1779 0x40, 0x00, // #
1780 0x38, 0x00, // ###
1780 0x38, 0x00, // ###
1781 0x00, 0x00, //
1781 0x00, 0x00, //
1782 0x00, 0x00, //
1782 0x00, 0x00, //
1783 0x00, 0x00, //
1783 0x00, 0x00, //
1784
1784
1785 // @2016 't' (11 pixels wide)
1785 // @2016 't' (11 pixels wide)
1786 0x00, 0x00, //
1786 0x00, 0x00, //
1787 0x10, 0x00, // #
1787 0x10, 0x00, // #
1788 0x10, 0x00, // #
1788 0x10, 0x00, // #
1789 0x38, 0x00, // ###
1789 0x38, 0x00, // ###
1790 0x10, 0x00, // #
1790 0x10, 0x00, // #
1791 0x10, 0x00, // #
1791 0x10, 0x00, // #
1792 0x10, 0x00, // #
1792 0x10, 0x00, // #
1793 0x10, 0x00, // #
1793 0x10, 0x00, // #
1794 0x10, 0x00, // #
1794 0x10, 0x00, // #
1795 0x00, 0x00, //
1795 0x00, 0x00, //
1796 0x00, 0x00, //
1796 0x00, 0x00, //
1797 0x00, 0x00, //
1797 0x00, 0x00, //
1798
1798
1799 // @2040 'u' (11 pixels wide)
1799 // @2040 'u' (11 pixels wide)
1800 0x00, 0x00, //
1800 0x00, 0x00, //
1801 0x00, 0x00, //
1801 0x00, 0x00, //
1802 0x00, 0x00, //
1802 0x00, 0x00, //
1803 0x88, 0x00, // # #
1803 0x88, 0x00, // # #
1804 0x88, 0x00, // # #
1804 0x88, 0x00, // # #
1805 0x88, 0x00, // # #
1805 0x88, 0x00, // # #
1806 0x88, 0x00, // # #
1806 0x88, 0x00, // # #
1807 0x88, 0x00, // # #
1807 0x88, 0x00, // # #
1808 0xF0, 0x00, // ####
1808 0xF0, 0x00, // ####
1809 0x00, 0x00, //
1809 0x00, 0x00, //
1810 0x00, 0x00, //
1810 0x00, 0x00, //
1811 0x00, 0x00, //
1811 0x00, 0x00, //
1812
1812
1813 // @2064 'v' (11 pixels wide)
1813 // @2064 'v' (11 pixels wide)
1814 0x00, 0x00, //
1814 0x00, 0x00, //
1815 0x00, 0x00, //
1815 0x00, 0x00, //
1816 0x00, 0x00, //
1816 0x00, 0x00, //
1817 0x88, 0x00, // # #
1817 0x88, 0x00, // # #
1818 0x88, 0x00, // # #
1818 0x88, 0x00, // # #
1819 0x50, 0x00, // # #
1819 0x50, 0x00, // # #
1820 0x50, 0x00, // # #
1820 0x50, 0x00, // # #
1821 0x20, 0x00, // #
1821 0x20, 0x00, // #
1822 0x20, 0x00, // #
1822 0x20, 0x00, // #
1823 0x00, 0x00, //
1823 0x00, 0x00, //
1824 0x00, 0x00, //
1824 0x00, 0x00, //
1825 0x00, 0x00, //
1825 0x00, 0x00, //
1826
1826
1827 // @2088 'w' (11 pixels wide)
1827 // @2088 'w' (11 pixels wide)
1828 0x00, 0x00, //
1828 0x00, 0x00, //
1829 0x00, 0x00, //
1829 0x00, 0x00, //
1830 0x00, 0x00, //
1830 0x00, 0x00, //
1831 0x24, 0x01, // # # #
1831 0x24, 0x01, // # # #
1832 0x24, 0x01, // # # #
1832 0x24, 0x01, // # # #
1833 0xB4, 0x00, // # ## #
1833 0xB4, 0x00, // # ## #
1834 0xB4, 0x00, // # ## #
1834 0xB4, 0x00, // # ## #
1835 0xA8, 0x00, // # # #
1835 0xA8, 0x00, // # # #
1836 0x48, 0x00, // # #
1836 0x48, 0x00, // # #
1837 0x00, 0x00, //
1837 0x00, 0x00, //
1838 0x00, 0x00, //
1838 0x00, 0x00, //
1839 0x00, 0x00, //
1839 0x00, 0x00, //
1840
1840
1841 // @2112 'x' (11 pixels wide)
1841 // @2112 'x' (11 pixels wide)
1842 0x00, 0x00, //
1842 0x00, 0x00, //
1843 0x00, 0x00, //
1843 0x00, 0x00, //
1844 0x00, 0x00, //
1844 0x00, 0x00, //
1845 0x84, 0x00, // # #
1845 0x84, 0x00, // # #
1846 0x48, 0x00, // # #
1846 0x48, 0x00, // # #
1847 0x30, 0x00, // ##
1847 0x30, 0x00, // ##
1848 0x30, 0x00, // ##
1848 0x30, 0x00, // ##
1849 0x48, 0x00, // # #
1849 0x48, 0x00, // # #
1850 0x84, 0x00, // # #
1850 0x84, 0x00, // # #
1851 0x00, 0x00, //
1851 0x00, 0x00, //
1852 0x00, 0x00, //
1852 0x00, 0x00, //
1853 0x00, 0x00, //
1853 0x00, 0x00, //
1854
1854
1855 // @2136 'y' (11 pixels wide)
1855 // @2136 'y' (11 pixels wide)
1856 0x00, 0x00, //
1856 0x00, 0x00, //
1857 0x00, 0x00, //
1857 0x00, 0x00, //
1858 0x00, 0x00, //
1858 0x00, 0x00, //
1859 0x08, 0x01, // # #
1859 0x08, 0x01, // # #
1860 0x88, 0x00, // # #
1860 0x88, 0x00, // # #
1861 0x90, 0x00, // # #
1861 0x90, 0x00, // # #
1862 0x50, 0x00, // # #
1862 0x50, 0x00, // # #
1863 0x60, 0x00, // ##
1863 0x60, 0x00, // ##
1864 0x20, 0x00, // #
1864 0x20, 0x00, // #
1865 0x20, 0x00, // #
1865 0x20, 0x00, // #
1866 0x10, 0x00, // #
1866 0x10, 0x00, // #
1867 0x10, 0x00, // #
1867 0x10, 0x00, // #
1868
1868
1869 // @2160 'z' (11 pixels wide)
1869 // @2160 'z' (11 pixels wide)
1870 0x00, 0x00, //
1870 0x00, 0x00, //
1871 0x00, 0x00, //
1871 0x00, 0x00, //
1872 0x00, 0x00, //
1872 0x00, 0x00, //
1873 0x78, 0x00, // ####
1873 0x78, 0x00, // ####
1874 0x40, 0x00, // #
1874 0x40, 0x00, // #
1875 0x20, 0x00, // #
1875 0x20, 0x00, // #
1876 0x10, 0x00, // #
1876 0x10, 0x00, // #
1877 0x08, 0x00, // #
1877 0x08, 0x00, // #
1878 0x78, 0x00, // ####
1878 0x78, 0x00, // ####
1879 0x00, 0x00, //
1879 0x00, 0x00, //
1880 0x00, 0x00, //
1880 0x00, 0x00, //
1881 0x00, 0x00, //
1881 0x00, 0x00, //
1882
1882
1883 // @2184 '{' (11 pixels wide)
1883 // @2184 '{' (11 pixels wide)
1884 0x60, 0x00, // ##
1884 0x60, 0x00, // ##
1885 0x10, 0x00, // #
1885 0x10, 0x00, // #
1886 0x10, 0x00, // #
1886 0x10, 0x00, // #
1887 0x10, 0x00, // #
1887 0x10, 0x00, // #
1888 0x10, 0x00, // #
1888 0x10, 0x00, // #
1889 0x18, 0x00, // ##
1889 0x18, 0x00, // ##
1890 0x10, 0x00, // #
1890 0x10, 0x00, // #
1891 0x10, 0x00, // #
1891 0x10, 0x00, // #
1892 0x10, 0x00, // #
1892 0x10, 0x00, // #
1893 0x10, 0x00, // #
1893 0x10, 0x00, // #
1894 0x60, 0x00, // ##
1894 0x60, 0x00, // ##
1895 0x00, 0x00, //
1895 0x00, 0x00, //
1896
1896
1897 // @2208 '|' (11 pixels wide)
1897 // @2208 '|' (11 pixels wide)
1898 0x20, 0x00, // #
1898 0x20, 0x00, // #
1899 0x20, 0x00, // #
1899 0x20, 0x00, // #
1900 0x20, 0x00, // #
1900 0x20, 0x00, // #
1901 0x20, 0x00, // #
1901 0x20, 0x00, // #
1902 0x20, 0x00, // #
1902 0x20, 0x00, // #
1903 0x20, 0x00, // #
1903 0x20, 0x00, // #
1904 0x20, 0x00, // #
1904 0x20, 0x00, // #
1905 0x20, 0x00, // #
1905 0x20, 0x00, // #
1906 0x20, 0x00, // #
1906 0x20, 0x00, // #
1907 0x20, 0x00, // #
1907 0x20, 0x00, // #
1908 0x20, 0x00, // #
1908 0x20, 0x00, // #
1909 0x00, 0x00, //
1909 0x00, 0x00, //
1910
1910
1911 // @2232 '}' (11 pixels wide)
1911 // @2232 '}' (11 pixels wide)
1912 0x18, 0x00, // ##
1912 0x18, 0x00, // ##
1913 0x20, 0x00, // #
1913 0x20, 0x00, // #
1914 0x20, 0x00, // #
1914 0x20, 0x00, // #
1915 0x20, 0x00, // #
1915 0x20, 0x00, // #
1916 0x20, 0x00, // #
1916 0x20, 0x00, // #
1917 0x60, 0x00, // ##
1917 0x60, 0x00, // ##
1918 0x20, 0x00, // #
1918 0x20, 0x00, // #
1919 0x20, 0x00, // #
1919 0x20, 0x00, // #
1920 0x20, 0x00, // #
1920 0x20, 0x00, // #
1921 0x20, 0x00, // #
1921 0x20, 0x00, // #
1922 0x18, 0x00, // ##
1922 0x18, 0x00, // ##
1923 0x00, 0x00, //
1923 0x00, 0x00, //
1924
1924
1925 // @2256 '~' (11 pixels wide)
1925 // @2256 '~' (11 pixels wide)
1926 0x00, 0x00, //
1926 0x00, 0x00, //
1927 0x00, 0x00, //
1927 0x00, 0x00, //
1928 0x00, 0x00, //
1928 0x00, 0x00, //
1929 0x98, 0x00, // ## #
1929 0x98, 0x00, // ## #
1930 0x9C, 0x00, // ### #
1930 0x9C, 0x00, // ### #
1931 0x64, 0x00, // # ##
1931 0x64, 0x00, // # ##
1932 0x00, 0x00, //
1932 0x00, 0x00, //
1933 0x00, 0x00, //
1933 0x00, 0x00, //
1934 0x00, 0x00, //
1934 0x00, 0x00, //
1935 0x00, 0x00, //
1935 0x00, 0x00, //
1936 0x00, 0x00, //
1936 0x00, 0x00, //
1937 0x00, 0x00, //
1937 0x00, 0x00, //
1938 };
1938 };
1939
1939
1940
1940
1941
1941
1942 sFONT ComicSansMS_18 = {
1942 sFONT ComicSansMS_18 = {
1943 .table = ComicSansMS_18_TBL,
1943 .table = ComicSansMS_18_TBL,
1944 .Width = 16,
1944 .Width = 16,
1945 .Height = 18,
1945 .Height = 18,
1946 .bytesPerLine = 2
1946 .bytesPerLine = 2
1947 };
1947 };
1948
1948
1949 sFONT ComicSansMS_24 = {
1949 sFONT ComicSansMS_24 = {
1950 .table = ComicSansMS_24_TBL,
1950 .table = ComicSansMS_24_TBL,
1951 .Width = 19,
1951 .Width = 19,
1952 .Height = 24,
1952 .Height = 24,
1953 .bytesPerLine = 3
1953 .bytesPerLine = 3
1954 };
1954 };
1955
1955
1956 sFONT ComicSansMS_8 = {
1956 sFONT ComicSansMS_8 = {
1957 .table = comicSansMS_8ptBitmaps,
1957 .table = comicSansMS_8ptBitmaps,
1958 .Width = 11,
1958 .Width = 11,
1959 .Height = 12,
1959 .Height = 12,
1960 .bytesPerLine = 2
1960 .bytesPerLine = 2
1961 };
1961 };
1962
1962
1963
1963
1964
1964
1965 const uint8_t Monk_TBL[] = {
1965 const uint8_t Monk_TBL[] = {
1966
1966
1967 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xAF,0xFB,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xDF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xEF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x00,0x00,0x00,0x00,0x00,0xF0,0xDF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xAF,0xFA,0x00,0x00,0x00,0x00,0x00,0x70,0x7F,0xFB,0x07,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0xE0,0xDF,0xFE,0x03,0x00,0x00,0x00,0x00,0x80,0x6F,0xFD,0x01,0x00,0x00,0x00,0x00,0xA0,0xFF,0xDE,0x01,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0xC0,0xBF,0xF5,0x03,0x00,0x00,0x00,0x00,0x80,0xFF,0xFD,0x03,0x00,0x00,0x00,0x00,0xC0,0x7F,0xFD,0x01,0x00,0x00,0x00,0x00,0x80,0xB5,0xFF,0x03,0x00,0x00,0x00,0x00,0xC0,0x5F,0xDB,0x01,0x00,0x00,0x00,0x00,0xC0,0xED,0xFF,0x03,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0xE0,0xAA,0xFF,0x03,0x00,0x00,0x00,0x00,0x40,0xBF,0xFA,0x01,0x00,0x00,0x00,0x00,0xE0,0xF6,0xFF,0x07,0x00,0x00,0x00,0x00,0x60,0xBE,0xFB,0x01,0x00,0x00,0x00,0x00,0xF0,0xBA,0xFF,0x03,0x00,0x00,0x00,0x00,0x70,0xBC,0xEE,0x00,0x00,0x00,0x00,0x00,0xF0,0xF6,0xFF,0x07,0x00,0x00,0x00,0x00,0x7C,0x75,0xBD,0x00,0x00,0x00,0x00,0x00,0xF0,0xAA,0xFF,0x0F,0x00,0x00,0x00,0x00,0x7E,0xF0,0xFE,0x01,0x00,0x00,0x00,0x00,0xE0,0xF5,0xFF,0x0F,0x00,0x00,0x00,0x80,0xFF,0xF0,0xF5,0x07,0x00,0x00,0x00,0x00,0xE0,0xFB,0xFF,0x07,0x00,0x00,0x00,0xE0,0x7F,0xF4,0xFF,0x0F,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x03,0x00,0x00,0x00,0xF8,0xFF,0xC8,0xEF,0x3F,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x07,0x00,0x00,0x00,0xFC,0xFF,0x8A,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xBE,0xFD,0x07,0x00,0x00,0x00,0xFF,0xFF,0x90,0xFF,0xFF,0x00,0x00,0x00,0x00,0x80,0x5F,0xEA,0x0F,0x00,0x00,0x80,0xFF,0xFF,0xA2,0xF7,0xFF,0x01,0x00,0x00,0x00,0xE0,0x3F,0xF8,0x1F,0x00,0x00,0x80,0xFF,0xFF,0x80,0xBF,0xFF,0x03,0x00,0x00,0x00,0xF8,0x1E,0xF8,0x7F,0x00,0x00,0xC0,0xFF,0xFF,0xC9,0x5F,0xFF,0x0F,0x00,0x00,0x00,0x3F,0x0E,0xFD,0xFF,0x01,0x00,0xC0,0xFF,0xFF,0x81,0xBF,0xFF,0x0F,0x00,0x00,0xC0,0x9F,0x27,0xFE,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0x91,0xBF,0xFF,0x0F,0x00,0x00,0xE0,0x9F,0x0F,0xFE,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xC1,0x5F,0xFF,0x0F,0x00,0x00,0xE0,0xCF,0x07,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0x89,0xBF,0xFF,0x1F,0x00,0x00,0xC0,0xE7,0x87,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xC1,0xBF,0xFF,0x1F,0x00,0x00,0xE0,0xE7,0xC7,0xFF,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0x89,0xBF,0xFF,0x1F,0x00,0x00,0xF0,0xF3,0xC3,0xFF,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0xC3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0xF3,0xE3,0xFF,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0x81,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xF3,0xE1,0xFF,0xFF,0x3F,0x00,0xF0,0xFF,0xFF,0xD3,0xBF,0xFF,0x1F,0x00,0x00,0xF0,0xFB,0xF3,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0x83,0xDF,0xFF,0x3F,0x00,0x00,0xF8,0xF9,0xF1,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xA3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0xF9,0xF9,0xFF,0xFF,0x3F,0x00,0xF0,0xFF,0xFF,0xC3,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xF9,0xF9,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xD3,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xFC,0xF8,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xC3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0xFC,0xFD,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xCB,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xFD,0xFC,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0xFC,0xFC,0xFE,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xC3,0xDF,0xFF,0x0F,0x00,0x00,0xFE,0xFE,0xFE,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xD7,0xDF,0xFF,0x0F,0x00,0x00,0xFE,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE3,0xDF,0xFF,0x0F,0x00,0x00,0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xD7,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0x78,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xCF,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xEF,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xEF,0xFF,0xFF,0x1F,0x00,0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x80,0xFF,0xFF,0xEF,0xFF,0xFF,0x0F,0x00,0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0xEF,0xFF,0xFF,0x0F,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x5F,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x80,0x9F,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x80,0x1F,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x80,0x9F,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xBF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xBF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xA3,0x0F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0x0B,0x0E,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x7F,0x0D,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xCF,0x03,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x1F,0x03,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0x3F,0x02,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xE1,0xFF,0xFF,0x7F,0x03,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x3F,0xFC,0xFF,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0xBF,0xBF,0xFF,0xFF,0xFF,0x03,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x80,0xDF,0xFF,0xFF,0xFD,0xFF,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0x7E,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xD7,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xFB,0xFF,0xFF,0x1F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xF0,0xFF,0xFF,0xEE,0xFF,0xFF,0x1F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xF0,0xFF,0xFF,0xFB,0xFF,0xFF,0x1F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFE,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFF,0xFE,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xF8,0xFF,0xFF,0xFB,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xF8,0xFF,0xFF,0xBF,0xFF,0xFF,0x7F,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFC,0xFF,0xFF,0x07,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0x07,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0x03,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0x03,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xFD,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0xFF,0x01,0xFE,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0xF9,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0x7F,0x00,0xFC,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xF9,0xFF,0xFF,0x07,0x00,0xFC,0xFF,0x3F,0x00,0xFC,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xF9,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0xF1,0xFF,0xFF,0x07,0x00,0xFC,0xFF,0x1F,0x00,0xF0,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xF1,0xFF,0xFF,0x07,0x00,0xFC,0xFF,0x0F,0x00,0xE0,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x0F,0x00,0xC0,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0xE1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x0F,0x00,0x80,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x07,0x00,0x00,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0xC1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x07,0x00,0x00,0xFF,0xFF,0x00,0x80,0xFF,0xFF,0xC1,0xFF,0xFF,0x07,0x00,0xFF,0xFF,0x03,0x00,0x00,0xFF,0x7F,0x00,0x00,0xFF,0xFF,0x81,0xFF,0xFF,0x07,0x00,0xFF,0xFF,0x01,0x00,0x00,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0x80,0xFF,0xFF,0x03,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0x80,0xFF,0xFF,0x80,0xFF,0xFF,0x07,0x80,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x7F,0x00,0xE8,0xFF,0xFF,0x00,0xFF,0xFF,0x0F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x00,0xFC,0xFF,0x7F,0x00,0xFE,0xFF,0x1F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x00,0xFE,0xFF,0x3F,0x00,0xC0,0xFF,0x1F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x00,0xBE,0xFF,0x1F,0x00,0xC0,0xFF,0x1F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x01,0x04,0xFC,0x07,0x00,0xC0,0xFF,0x1F,0xC0,0xFF,0x7F,0x00,0x00,0xC0,0xFF,0xFF,0x1F,0x00,0x3C,0x00,0x00,0xF0,0xFF,0x07,0xC0,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0xF0,0xDD,0x0E,0x80,0xFF,0x7F,0x00,0x00,0x00,0xFE,0xFF,0x3B,0x00,0x00,0x00,0x00,0x50,0xE0,0x03,0xF0,0xFF,0x7F,0x00,0x00,0x00,0x80,0xFF,0x2E,0x00,0x00,0x00,0x00,0x00,0x40,0x01,0xF8,0xFF,0x3F,0x00,0x00,0x00,0x00,0x1A,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x55,0x0F,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xD2,0x05,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
1967 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xAF,0xFB,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xDF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xEF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x00,0x00,0x00,0x00,0x00,0xF0,0xDF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xAF,0xFA,0x00,0x00,0x00,0x00,0x00,0x70,0x7F,0xFB,0x07,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0xE0,0xDF,0xFE,0x03,0x00,0x00,0x00,0x00,0x80,0x6F,0xFD,0x01,0x00,0x00,0x00,0x00,0xA0,0xFF,0xDE,0x01,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0xC0,0xBF,0xF5,0x03,0x00,0x00,0x00,0x00,0x80,0xFF,0xFD,0x03,0x00,0x00,0x00,0x00,0xC0,0x7F,0xFD,0x01,0x00,0x00,0x00,0x00,0x80,0xB5,0xFF,0x03,0x00,0x00,0x00,0x00,0xC0,0x5F,0xDB,0x01,0x00,0x00,0x00,0x00,0xC0,0xED,0xFF,0x03,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0xE0,0xAA,0xFF,0x03,0x00,0x00,0x00,0x00,0x40,0xBF,0xFA,0x01,0x00,0x00,0x00,0x00,0xE0,0xF6,0xFF,0x07,0x00,0x00,0x00,0x00,0x60,0xBE,0xFB,0x01,0x00,0x00,0x00,0x00,0xF0,0xBA,0xFF,0x03,0x00,0x00,0x00,0x00,0x70,0xBC,0xEE,0x00,0x00,0x00,0x00,0x00,0xF0,0xF6,0xFF,0x07,0x00,0x00,0x00,0x00,0x7C,0x75,0xBD,0x00,0x00,0x00,0x00,0x00,0xF0,0xAA,0xFF,0x0F,0x00,0x00,0x00,0x00,0x7E,0xF0,0xFE,0x01,0x00,0x00,0x00,0x00,0xE0,0xF5,0xFF,0x0F,0x00,0x00,0x00,0x80,0xFF,0xF0,0xF5,0x07,0x00,0x00,0x00,0x00,0xE0,0xFB,0xFF,0x07,0x00,0x00,0x00,0xE0,0x7F,0xF4,0xFF,0x0F,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x03,0x00,0x00,0x00,0xF8,0xFF,0xC8,0xEF,0x3F,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x07,0x00,0x00,0x00,0xFC,0xFF,0x8A,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xBE,0xFD,0x07,0x00,0x00,0x00,0xFF,0xFF,0x90,0xFF,0xFF,0x00,0x00,0x00,0x00,0x80,0x5F,0xEA,0x0F,0x00,0x00,0x80,0xFF,0xFF,0xA2,0xF7,0xFF,0x01,0x00,0x00,0x00,0xE0,0x3F,0xF8,0x1F,0x00,0x00,0x80,0xFF,0xFF,0x80,0xBF,0xFF,0x03,0x00,0x00,0x00,0xF8,0x1E,0xF8,0x7F,0x00,0x00,0xC0,0xFF,0xFF,0xC9,0x5F,0xFF,0x0F,0x00,0x00,0x00,0x3F,0x0E,0xFD,0xFF,0x01,0x00,0xC0,0xFF,0xFF,0x81,0xBF,0xFF,0x0F,0x00,0x00,0xC0,0x9F,0x27,0xFE,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0x91,0xBF,0xFF,0x0F,0x00,0x00,0xE0,0x9F,0x0F,0xFE,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xC1,0x5F,0xFF,0x0F,0x00,0x00,0xE0,0xCF,0x07,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0x89,0xBF,0xFF,0x1F,0x00,0x00,0xC0,0xE7,0x87,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xC1,0xBF,0xFF,0x1F,0x00,0x00,0xE0,0xE7,0xC7,0xFF,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0x89,0xBF,0xFF,0x1F,0x00,0x00,0xF0,0xF3,0xC3,0xFF,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0xC3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0xF3,0xE3,0xFF,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0x81,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xF3,0xE1,0xFF,0xFF,0x3F,0x00,0xF0,0xFF,0xFF,0xD3,0xBF,0xFF,0x1F,0x00,0x00,0xF0,0xFB,0xF3,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0x83,0xDF,0xFF,0x3F,0x00,0x00,0xF8,0xF9,0xF1,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xA3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0xF9,0xF9,0xFF,0xFF,0x3F,0x00,0xF0,0xFF,0xFF,0xC3,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xF9,0xF9,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xD3,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xFC,0xF8,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xC3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0xFC,0xFD,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xCB,0xDF,0xFF,0x1F,0x00,0x00,0xF8,0xFD,0xFC,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0xFC,0xFC,0xFE,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xC3,0xDF,0xFF,0x0F,0x00,0x00,0xFE,0xFE,0xFE,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xD7,0xDF,0xFF,0x0F,0x00,0x00,0xFE,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE3,0xDF,0xFF,0x0F,0x00,0x00,0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xD7,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0xE7,0xDF,0xFF,0x0F,0x00,0x00,0x78,0xFE,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xCF,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xEF,0xDF,0xFF,0x0F,0x00,0x00,0x7C,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xEF,0xFF,0xFF,0x1F,0x00,0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x80,0xFF,0xFF,0xEF,0xFF,0xFF,0x0F,0x00,0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0xEF,0xFF,0xFF,0x0F,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x5F,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x80,0x9F,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x80,0x1F,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x80,0x9F,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xBF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xBF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xA3,0x0F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0x0B,0x0E,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x7F,0x0D,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xCF,0x03,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x1F,0x03,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0x3F,0x02,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xE1,0xFF,0xFF,0x7F,0x03,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x3F,0xFC,0xFF,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0xBF,0xBF,0xFF,0xFF,0xFF,0x03,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x80,0xDF,0xFF,0xFF,0xFD,0xFF,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0x7E,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xD7,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xE0,0xFF,0xFF,0xFB,0xFF,0xFF,0x1F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xF0,0xFF,0xFF,0xEE,0xFF,0xFF,0x1F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xF0,0xFF,0xFF,0xFB,0xFF,0xFF,0x1F,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFE,0xFF,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xF0,0xFF,0xFF,0xFF,0xFE,0xFF,0x3F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xF8,0xFF,0xFF,0xFB,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xF8,0xFF,0xFF,0xBF,0xFF,0xFF,0x7F,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFC,0xFF,0xFF,0x07,0xFF,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0x07,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0x03,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFC,0xFF,0xFF,0x03,0xFF,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xFD,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0xFF,0x01,0xFE,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0xF9,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0x7F,0x00,0xFC,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xF9,0xFF,0xFF,0x07,0x00,0xFC,0xFF,0x3F,0x00,0xFC,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xF9,0xFF,0xFF,0x03,0x00,0xFC,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0xF1,0xFF,0xFF,0x07,0x00,0xFC,0xFF,0x1F,0x00,0xF0,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xF1,0xFF,0xFF,0x07,0x00,0xFC,0xFF,0x0F,0x00,0xE0,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x0F,0x00,0xC0,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0xE1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x0F,0x00,0x80,0xFF,0x7F,0x00,0xC0,0xFF,0xFF,0xE1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x07,0x00,0x00,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0xC1,0xFF,0xFF,0x07,0x00,0xFE,0xFF,0x07,0x00,0x00,0xFF,0xFF,0x00,0x80,0xFF,0xFF,0xC1,0xFF,0xFF,0x07,0x00,0xFF,0xFF,0x03,0x00,0x00,0xFF,0x7F,0x00,0x00,0xFF,0xFF,0x81,0xFF,0xFF,0x07,0x00,0xFF,0xFF,0x01,0x00,0x00,0xFF,0x7F,0x00,0x80,0xFF,0xFF,0x80,0xFF,0xFF,0x03,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0x80,0xFF,0xFF,0x80,0xFF,0xFF,0x07,0x80,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x7F,0x00,0xE8,0xFF,0xFF,0x00,0xFF,0xFF,0x0F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x00,0xFC,0xFF,0x7F,0x00,0xFE,0xFF,0x1F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x00,0xFE,0xFF,0x3F,0x00,0xC0,0xFF,0x1F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x00,0xBE,0xFF,0x1F,0x00,0xC0,0xFF,0x1F,0x80,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x01,0x04,0xFC,0x07,0x00,0xC0,0xFF,0x1F,0xC0,0xFF,0x7F,0x00,0x00,0xC0,0xFF,0xFF,0x1F,0x00,0x3C,0x00,0x00,0xF0,0xFF,0x07,0xC0,0xFF,0x7F,0x00,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0xF0,0xDD,0x0E,0x80,0xFF,0x7F,0x00,0x00,0x00,0xFE,0xFF,0x3B,0x00,0x00,0x00,0x00,0x50,0xE0,0x03,0xF0,0xFF,0x7F,0x00,0x00,0x00,0x80,0xFF,0x2E,0x00,0x00,0x00,0x00,0x00,0x40,0x01,0xF8,0xFF,0x3F,0x00,0x00,0x00,0x00,0x1A,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x55,0x0F,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xD2,0x05,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
1968 };
1968 };
1969
1969
1970 sFONT Monk_24 = {
1970 sFONT Monk_24 = {
1971 .table = Monk_TBL,
1971 .table = Monk_TBL,
1972 .Width = 0x7F,
1972 .Width = 0x7F,
1973 .Height = 0x7E,
1973 .Height = 0x7E,
1974 .bytesPerLine = 16
1974 .bytesPerLine = 16
1975 };
1975 };
1976
1976
1977
1977
@@ -1,245 +1,245
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <widget.h>
22 #include <widget.h>
23 #include <terminal.h>
23 #include <terminal.h>
24 #include <stdint.h>
24 #include <stdint.h>
25 #include <stdio.h>
25 #include <stdio.h>
26 #include <gpio.h>
26 #include <gpio.h>
27 #include <core.h>
27 #include <core.h>
28 #include <malloc.h>
28 #include <malloc.h>
29
29
30 #define CHARXPOS(terminal,charwidth) (((terminal)->column * charwidth) + (terminal)->Xpos)
30 #define CHARXPOS(terminal,charwidth) (((terminal)->column * charwidth) + (terminal)->Xpos)
31 #define CHARYPOS(terminal,charheight) ((terminal)->line * charheight + (terminal)->Ypos+charheight)
31 #define CHARYPOS(terminal,charheight) ((terminal)->line * charheight + (terminal)->Ypos+charheight)
32
32
33 streamdevice_ops TERMINAL_OPS=
33 streamdevice_ops TERMINAL_OPS=
34 {
34 {
35 .write = &terminal_write,
35 .write = &terminal_write,
36 .read = &terminal_read,
36 .read = &terminal_read,
37 .setpos= &terminal_setpos,
37 .setpos= &terminal_setpos,
38 .close = NULL
38 .close = NULL
39 };
39 };
40
40
41 int terminal_init(terminal_t* terminal,LCD_t* LCD,sFONT* font,streamdevice* strdev)
41 int terminal_init(terminal_t* terminal,LCD_t* LCD,sFONT* font,streamdevice* strdev)
42 {
42 {
43 if((LCD!=NULL) && (font!=NULL) && (strdev!=NULL) && (terminal!=NULL))
43 if((LCD!=NULL) && (font!=NULL) && (strdev!=NULL) && (terminal!=NULL))
44 {
44 {
45 terminal->LCD=LCD;
45 terminal->LCD=LCD;
46 terminal->font=font;
46 terminal->font=font;
47 terminal->line = 0;
47 terminal->line = 0;
48 terminal->column = 0;
48 terminal->column = 0;
49 terminal->horizontalSpace = 0;
49 terminal->horizontalSpace = 0;
50 terminal->verticalSpace = 0;
50 terminal->verticalSpace = 0;
51 int charw=terminal->font->Width + terminal->horizontalSpace;
51 int charw=terminal->font->Width + terminal->horizontalSpace;
52 int charh=terminal->font->Height + terminal->verticalSpace;
52 int charh=terminal->font->Height + terminal->verticalSpace;
53 terminal->textColor=0xFFFF;
53 terminal->textColor=0xFFFF;
54 terminal->backgroundColor=0x0000;
54 terminal->backgroundColor=0x0000;
55 terminal_setgeometry(terminal,5,5,terminal->LCD->width-(10),terminal->LCD->height-(10));
55 terminal_setgeometry(terminal,5,5,terminal->LCD->width-(10),terminal->LCD->height-(10));
56 strdev->_stream = (UHANDLE)terminal;
56 strdev->_stream = (UHANDLE)terminal;
57 strdev->ops = &TERMINAL_OPS;
57 strdev->ops = &TERMINAL_OPS;
58 strdev->streamPt = 0;
58 strdev->streamPt = 0;
59 terminal_clear(terminal);
59 terminal_clear(terminal);
60 terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal, charw),CHARYPOS(terminal, charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor);
60 terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal, charw),CHARYPOS(terminal, charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor);
61 terminal->buffer = (char*)malloc(terminal->lineCount*(terminal->columnCount + 1));
61 terminal->buffer = (char*)malloc(terminal->lineCount*(terminal->columnCount + 1));
62 terminal->firstLine = 0;
62 terminal->firstLine = 0;
63 terminal->lastLine = 0;
63 terminal->lastLine = 0;
64 terminal->empty = 1;
64 terminal->empty = 1;
65 for(int i=1;i<=terminal->lineCount;i++)
65 for(int i=1;i<=terminal->lineCount;i++)
66 {
66 {
67 terminal->buffer[i * terminal->columnCount]='\n';
67 terminal->buffer[i * terminal->columnCount]='\n';
68 }
68 }
69 return 1;
69 return 1;
70 }
70 }
71 return 0;
71 return 0;
72 }
72 }
73
73
74 void terminal_setgeometry(terminal_t* terminal,uint16_t Xpos,uint16_t Ypos,uint16_t width,uint16_t height)
74 void terminal_setgeometry(terminal_t* terminal,uint16_t Xpos,uint16_t Ypos,uint16_t width,uint16_t height)
75 {
75 {
76 int charw=terminal->font->Width + terminal->horizontalSpace;
76 int charw=terminal->font->Width + terminal->horizontalSpace;
77 int charh=terminal->font->Height + terminal->verticalSpace;
77 int charh=terminal->font->Height + terminal->verticalSpace;
78 if(terminal->LCD->height<(Ypos+height))
78 if(terminal->LCD->height<(Ypos+height))
79 return;
79 return;
80 if(terminal->LCD->width<(Xpos+width))
80 if(terminal->LCD->width<(Xpos+width))
81 return;
81 return;
82 terminal->Xpos = Xpos;
82 terminal->Xpos = Xpos;
83 terminal->Ypos = Ypos;
83 terminal->Ypos = Ypos;
84 terminal->height = height;
84 terminal->height = height;
85 terminal->width = width;
85 terminal->width = width;
86 terminal->lineCount = terminal->height/charh;
86 terminal->lineCount = terminal->height/charh;
87 terminal->columnCount = (terminal->width/charw)-1;
87 terminal->columnCount = (terminal->width/charw)-1;
88 terminal_clear(terminal);
88 terminal_clear(terminal);
89 }
89 }
90
90
91
91
92 void terminal_clear(terminal_t* terminal)
92 void terminal_clear(terminal_t* terminal)
93 {
93 {
94 terminal->firstLine = 0;
94 terminal->firstLine = 0;
95 terminal->lastLine = 0;
95 terminal->lastLine = 0;
96 terminal->empty = 1;
96 terminal->empty = 1;
97 terminal->line =0;
97 terminal->line =0;
98 terminal->column=0;
98 terminal->column=0;
99 terminal->LCD->paintFilRect(terminal->LCD,terminal->Xpos,terminal->Ypos,terminal->width,terminal->height,terminal->backgroundColor,0,terminal->backgroundColor);
99 terminal->LCD->paintFilRect(terminal->LCD,terminal->Xpos,terminal->Ypos,terminal->width,terminal->height,terminal->backgroundColor,0,terminal->backgroundColor);
100 }
100 }
101
101
102 void terminal_setbackgroundColor(terminal_t* terminal, uint32_t backgrooundColor)
102 void terminal_setbackgroundColor(terminal_t* terminal, uint32_t backgrooundColor)
103 {
103 {
104 terminal->backgroundColor = backgrooundColor;
104 terminal->backgroundColor = backgrooundColor;
105 }
105 }
106
106
107 void terminal_settextColor(terminal_t* terminal, uint32_t textColor)
107 void terminal_settextColor(terminal_t* terminal, uint32_t textColor)
108 {
108 {
109 terminal->textColor = textColor;
109 terminal->textColor = textColor;
110 }
110 }
111
111
112
112
113 void terminal_movecursor(terminal_t* terminal,int n)
113 void terminal_movecursor(terminal_t* terminal,int n)
114 {
114 {
115 int charw=terminal->font->Width + terminal->horizontalSpace;
115 int charw=terminal->font->Width + terminal->horizontalSpace;
116 int charh=terminal->font->Height + terminal->verticalSpace;
116 int charh=terminal->font->Height + terminal->verticalSpace;
117 terminal->column += n;
117 terminal->column += n;
118 if(terminal->column>(terminal->columnCount))
118 if(terminal->column>(terminal->columnCount))
119 {
119 {
120 terminal->line += (terminal->column)/terminal->columnCount;
120 terminal->line += (terminal->column)/terminal->columnCount;
121 terminal->line = terminal->line % terminal->lineCount;
121 terminal->line = terminal->line % terminal->lineCount;
122 terminal->column = (terminal->column % terminal->columnCount)-1;
122 terminal->column = (terminal->column % terminal->columnCount)-1;
123 int x=CHARXPOS(terminal, charw);
123 int x=CHARXPOS(terminal, charw);
124 int y=CHARYPOS(terminal,charh)-charh;
124 int y=CHARYPOS(terminal,charh)-charh;
125 int w=charw*(terminal->columnCount-terminal->column);
125 int w=charw*(terminal->columnCount-terminal->column);
126 int h=charh;
126 int h=charh;
127 terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal, charw),CHARYPOS(terminal,charh)-charh,charw*(terminal->columnCount-terminal->column-1),charh,terminal->backgroundColor,0,terminal->backgroundColor);
127 //terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal, charw),CHARYPOS(terminal,charh)-charh,charw*(terminal->columnCount-terminal->column-1),charh,terminal->backgroundColor,0,terminal->backgroundColor);
128 }
128 }
129 terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal,charw),CHARYPOS(terminal,charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor);
129 //terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal,charw),CHARYPOS(terminal,charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor);
130 }
130 }
131
131
132 void terminal_clearCurentLine(terminal_t* terminal)
132 void terminal_clearCurentLine(terminal_t* terminal)
133 {
133 {
134 int charw=terminal->font->Width + terminal->horizontalSpace;
134 int charw=terminal->font->Width + terminal->horizontalSpace;
135 int charh=terminal->font->Height + terminal->verticalSpace;
135 int charh=terminal->font->Height + terminal->verticalSpace;
136 terminal->LCD->paintFilRect(terminal->LCD,terminal->Xpos,CHARYPOS(terminal, charh)-charh,terminal->width,charh,terminal->backgroundColor,0,terminal->backgroundColor);
136 // terminal->LCD->paintFilRect(terminal->LCD,terminal->Xpos,CHARYPOS(terminal, charh)-charh,terminal->width,charh,terminal->backgroundColor,0,terminal->backgroundColor);
137 }
137 }
138
138
139 int terminal_writenc(terminal_t* terminal,char* data, int n)
139 int terminal_writenc(terminal_t* terminal,char* data, int n)
140 {
140 {
141 int charw=terminal->font->Width + terminal->horizontalSpace;
141 int charw=terminal->font->Width + terminal->horizontalSpace;
142 int charh=terminal->font->Height + terminal->verticalSpace;
142 int charh=terminal->font->Height + terminal->verticalSpace;
143 int l=0;
143 int l=0;
144 char buffer[2]=" ";
144 char buffer[2]=" ";
145 while(l<n)
145 while(l<n)
146 {
146 {
147
147
148 buffer[0]=data[l];
148 buffer[0]=data[l];
149 if(buffer[0]=='\n')
149 if(buffer[0]=='\n')
150 {
150 {
151 terminal->line= (terminal->line+1) % terminal->lineCount;
151 terminal->line= (terminal->line+1) % terminal->lineCount;
152 terminal->column = 0;
152 terminal->column = 0;
153 if(terminal->line==0)
153 if(terminal->line==0)
154 terminal_clear(terminal);
154 terminal_clear(terminal);
155 else
155 else
156 terminal_clearCurentLine(terminal);
156 terminal_clearCurentLine(terminal);
157 }else {
157 }else {
158 if(buffer[0]=='\t')
158 if(buffer[0]=='\t')
159 {
159 {
160 for(int i=0;i<1;i++)terminal_movecursor(terminal,1);
160 for(int i=0;i<1;i++)terminal_movecursor(terminal,1);
161 }else
161 }else
162 if(terminal->column==0)terminal_clearCurentLine(terminal);
162 if(terminal->column==0)terminal_clearCurentLine(terminal);
163 if(buffer[0]!='\r'){
163 if(buffer[0]!='\r'){
164 terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal,charw),CHARYPOS(terminal, charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor);
164 // terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal,charw),CHARYPOS(terminal, charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor);
165 terminal->LCD->paintText(terminal->LCD,buffer,CHARXPOS(terminal,charw),CHARYPOS(terminal, charh),terminal->font,terminal->textColor);
165 terminal->LCD->paintText(terminal->LCD,buffer,CHARXPOS(terminal,charw),CHARYPOS(terminal, charh),terminal->font,terminal->textColor);
166 terminal_movecursor(terminal,1);
166 terminal_movecursor(terminal,1);
167 }
167 }
168 }
168 }
169 l++;
169 l++;
170 }
170 }
171 return n;
171 return n;
172 }
172 }
173
173
174 void terminal_print_line(terminal_t* terminal,int line)
174 void terminal_print_line(terminal_t* terminal,int line)
175 {
175 {
176 int charw=terminal->font->Width + terminal->horizontalSpace;
176 int charw=terminal->font->Width + terminal->horizontalSpace;
177 int charh=terminal->font->Height + terminal->verticalSpace;
177 int charh=terminal->font->Height + terminal->verticalSpace;
178 terminal_clearCurentLine(terminal);
178 terminal_clearCurentLine(terminal);
179 terminal->LCD->paintText(terminal->LCD,terminal->buffer+(line*(terminal->columnCount + 1)),CHARXPOS(terminal,charw),CHARYPOS(terminal, charh),terminal->font,terminal->textColor);
179 terminal->LCD->paintText(terminal->LCD,terminal->buffer+(line*(terminal->columnCount + 1)),CHARXPOS(terminal,charw),CHARYPOS(terminal, charh),terminal->font,terminal->textColor);
180 }
180 }
181
181
182 int terminal_writenc2(terminal_t* terminal,char* data, int n)
182 int terminal_writenc2(terminal_t* terminal,char* data, int n)
183 {
183 {
184 int charw=terminal->font->Width + terminal->horizontalSpace;
184 int charw=terminal->font->Width + terminal->horizontalSpace;
185 int charh=terminal->font->Height + terminal->verticalSpace;
185 int charh=terminal->font->Height + terminal->verticalSpace;
186 /* First copy to buffer*/
186 /* First copy to buffer*/
187 int offset = (terminal->lastLine*(terminal->columnCount + 1)) + terminal->column;
187 int offset = (terminal->lastLine*(terminal->columnCount + 1)) + terminal->column;
188 for(int i=0;i<n;i++)
188 for(int i=0;i<n;i++)
189 {
189 {
190 terminal->empty=0;
190 terminal->empty=0;
191 terminal->buffer[offset] = data[i];
191 terminal->buffer[offset] = data[i];
192 if(data[i]=='\n')
192 if(data[i]=='\n')
193 {
193 {
194 offset = ((offset/(terminal->columnCount + 1) + 1) * (terminal->columnCount + 1));
194 offset = ((offset/(terminal->columnCount + 1) + 1) * (terminal->columnCount + 1));
195 }
195 }
196 else
196 else
197 {
197 {
198 offset++;
198 offset++;
199 }
199 }
200 }
200 }
201 if(!terminal->empty)
201 if(!terminal->empty)
202 {
202 {
203 for(int i=terminal->firstLine;i<=terminal->lastLine;i++)
203 for(int i=terminal->firstLine;i<=terminal->lastLine;i++)
204 {
204 {
205 terminal_print_line(terminal,i);
205 terminal_print_line(terminal,i);
206 }
206 }
207 }
207 }
208 return n;
208 return n;
209 }
209 }
210
210
211
211
212
212
213 int terminal_write(streamdevice* device,void* data,int size, int n)
213 int terminal_write(streamdevice* device,void* data,int size, int n)
214 {
214 {
215 return terminal_writenc((terminal_t*)device->_stream,(char*) data,size*n);
215 return terminal_writenc((terminal_t*)device->_stream,(char*) data,size*n);
216 }
216 }
217
217
218 int terminal_read(streamdevice* device,void* data,int size, int n)
218 int terminal_read(streamdevice* device,void* data,int size, int n)
219 {
219 {
220 return n*size;
220 return n*size;
221 }
221 }
222
222
223 int terminal_setpos(streamdevice* device,int pos)
223 int terminal_setpos(streamdevice* device,int pos)
224 {
224 {
225 return 1;
225 return 1;
226 }
226 }
227
227
228 int terminal_close( streamdevice* device)
228 int terminal_close( streamdevice* device)
229 {
229 {
230 return 1;
230 return 1;
231 }
231 }
232
232
233
233
234
234
235
235
236
236
237
237
238
238
239
239
240
240
241
241
242
242
243
243
244
244
245
245
@@ -1,69 +1,69
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <STMPE811.h>
23 #include <STMPE811.h>
24
24
25 int stmpe811init(STMPE811_t *dev, i2c_t i2cdev, uint8_t A0)
25 int stmpe811init(STMPE811_t *dev, i2c_t i2cdev, uint8_t A0)
26 {
26 {
27
27
28 dev->devAddress = 0x82;
28 dev->devAddress = 0x82;
29 if(A0) dev->devAddress = 0x88;
29 if(A0) dev->devAddress = 0x88;
30 dev->i2cdev = i2cdev;
30 dev->i2cdev = i2cdev;
31 return 1;
31 return 1;
32 }
32 }
33
33
34 int stmpe811getID(STMPE811_t *dev)
34 int stmpe811getID(STMPE811_t *dev)
35 {
35 {
36 if(dev != NULL)
36 if(dev != NULL)
37 {
37 {
38 char DATA[2];
38 char DATA[2];
39 DATA[0]=STMPE811_REGISTER_CHIP_ID;
39 DATA[0]=STMPE811_REGISTER_CHIP_ID;
40 i2cwrite(dev->i2cdev,dev->devAddress,DATA,1);
40 i2cwrite(dev->i2cdev,dev->devAddress,DATA,1);
41 i2cread(dev->i2cdev,dev->devAddress,DATA,2);
41 i2cread(dev->i2cdev,dev->devAddress,DATA,2);
42 uint16_t val=DATA[0];
42 uint16_t val=DATA[0];
43 val=(val<<8)+DATA[1];
43 val=(val<<8)+DATA[1];
44 return val;
44 return val;
45 }
45 }
46 return -1;
46 return -1;
47 }
47 }
48
48
49
49
50
50
51
51
52
52
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
@@ -1,114 +1,114
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <ina226.h>
22 #include <ina226.h>
23 #include <stdio.h>
23 #include <stdio.h>
24 #include <stddef.h>
24 #include <stddef.h>
25
25
26
26
27 int ina226open(INA226_t *dev, i2c_t i2cdev, uint16_t config, uint8_t A0, uint8_t A1, uint32_t shuntmOhm, uint32_t CurrentRangeuAmp)
27 int ina226open(INA226_t *dev, i2c_t i2cdev, uint16_t config, uint8_t A0, uint8_t A1, uint32_t shuntmOhm, uint32_t CurrentRangeuAmp)
28 {
28 {
29 if(dev != NULL)
29 if(dev != NULL)
30 {
30 {
31 dev->i2cdev=i2cdev;
31 dev->i2cdev=i2cdev;
32 dev->devAddress = INA226_I2C_ADDRESS | (A0 & 1) | ((A1<<2) & 5);
32 dev->devAddress = INA226_I2C_ADDRESS | (A0 & 1) | ((A1<<2) & 5);
33 printf("dev->devAddress = %x\n\r",dev->devAddress);
33 printf("dev->devAddress = %x\n\r",dev->devAddress);
34 dev->shuntmOhm = shuntmOhm;
34 dev->shuntmOhm = shuntmOhm;
35 dev->CurrentRangeuAmp = CurrentRangeuAmp;
35 dev->CurrentRangeuAmp = CurrentRangeuAmp;
36 ina226setReg(dev,INA226_Configuration_Reg,0x8000);
36 ina226setReg(dev,INA226_Configuration_Reg,0x8000);
37 ina226setReg(dev,INA226_Configuration_Reg,config);
37 ina226setReg(dev,INA226_Configuration_Reg,config);
38 return ina226calibrate(dev,shuntmOhm,CurrentRangeuAmp);
38 return ina226calibrate(dev,shuntmOhm,CurrentRangeuAmp);
39 }
39 }
40 return -1;
40 return -1;
41 }
41 }
42
42
43 uint16_t ina226getID(INA226_t* dev)
43 uint16_t ina226getID(INA226_t* dev)
44 {
44 {
45 if(dev != NULL)
45 if(dev != NULL)
46 {
46 {
47 uint16_t id=ina226getReg(dev,INA226_Die_ID_Reg);
47 uint16_t id=ina226getReg(dev,INA226_Die_ID_Reg);
48 return id;
48 return id;
49 }
49 }
50 return -1;
50 return -1;
51 }
51 }
52
52
53
53
54 int ina226calibrate(INA226_t* dev,uint32_t shuntmOhm, uint32_t CurrentRangeuAmp)
54 int ina226calibrate(INA226_t* dev,uint32_t shuntmOhm, uint32_t CurrentRangeuAmp)
55 {
55 {
56 dev->shuntmOhm = shuntmOhm;
56 dev->shuntmOhm = shuntmOhm;
57 dev->CurrentRangeuAmp = CurrentRangeuAmp;
57 dev->CurrentRangeuAmp = CurrentRangeuAmp;
58 uint32_t CAL= (uint32_t)(5210000/(shuntmOhm*(CurrentRangeuAmp>>15)));
58 uint32_t CAL= (uint32_t)(5210000/(shuntmOhm*(CurrentRangeuAmp>>15)));
59 return ina226setReg(dev,INA226_Calibration_Reg,(uint16_t)CAL);
59 return ina226setReg(dev,INA226_Calibration_Reg,(uint16_t)CAL);
60 }
60 }
61
61
62 uint32_t ina226getBusVoltage(INA226_t *dev)
62 uint32_t ina226getBusVoltage(INA226_t *dev)
63 {
63 {
64 uint32_t busVoltage= ina226getReg(dev,INA226_Bus_Voltage_Reg);
64 uint32_t busVoltage= ina226getReg(dev,INA226_Bus_Voltage_Reg);
65 busVoltage*= 1250;
65 busVoltage*= 1250;
66 return busVoltage;
66 return busVoltage;
67 }
67 }
68
68
69 uint32_t ina226getPower(INA226_t *dev)
69 uint32_t ina226getPower(INA226_t *dev)
70 {
70 {
71 uint32_t power= ina226getReg(dev,INA226_Power_Reg);
71 uint32_t power= ina226getReg(dev,INA226_Power_Reg);
72 power*= ((dev->CurrentRangeuAmp>>15)*25);
72 power*= ((dev->CurrentRangeuAmp>>15)*25);
73 return power;
73 return power;
74 }
74 }
75
75
76 int32_t ina226getCurrent(INA226_t *dev)
76 int32_t ina226getCurrent(INA226_t *dev)
77 {
77 {
78 int32_t current= ina226getReg(dev,INA226_Current_Reg);
78 int32_t current= ina226getReg(dev,INA226_Current_Reg);
79 current<<=16;
79 current<<=16;
80 current>>=16;
80 current>>=16;
81 current = current*(dev->CurrentRangeuAmp>>15);
81 current = current*(dev->CurrentRangeuAmp>>15);
82 return current;
82 return current;
83 }
83 }
84
84
85 uint16_t ina226getReg(INA226_t* dev,char reg)
85 uint16_t ina226getReg(INA226_t* dev,char reg)
86 {
86 {
87 if(dev != NULL)
87 if(dev != NULL)
88 {
88 {
89 char DATA[2];
89 char DATA[2];
90 DATA[0]=reg;
90 DATA[0]=reg;
91 i2cwrite(dev->i2cdev,dev->devAddress,DATA,1);
91 i2cwrite(dev->i2cdev,dev->devAddress,DATA,1);
92 i2cread(dev->i2cdev,dev->devAddress,DATA,2);
92 i2cread(dev->i2cdev,dev->devAddress,DATA,2);
93 uint16_t val=DATA[0];
93 uint16_t val=DATA[0];
94 val=(val<<8)+DATA[1];
94 val=(val<<8)+DATA[1];
95 return val;
95 return val;
96 }
96 }
97 return -1;
97 return -1;
98 }
98 }
99
99
100
100
101 int ina226setReg(INA226_t* dev,char reg,int16_t value)
101 int ina226setReg(INA226_t* dev,char reg,int16_t value)
102 {
102 {
103 if(dev != NULL)
103 if(dev != NULL)
104 {
104 {
105 char DATA[3];
105 char DATA[3];
106 DATA[0]=INA226_Calibration_Reg;
106 DATA[0]=INA226_Calibration_Reg;
107 DATA[1]=(char)(0xff & (value>>8));
107 DATA[1]=(char)(0xff & (value>>8));
108 DATA[2]=(char)(0xff & value);
108 DATA[2]=(char)(0xff & value);
109 if(3==i2cwrite(dev->i2cdev,dev->devAddress,DATA,3))return 1;
109 if(3==i2cwrite(dev->i2cdev,dev->devAddress,DATA,3))return 1;
110 }
110 }
111 return -1;
111 return -1;
112 }
112 }
113
113
114
114
@@ -1,41 +1,41
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <thread.h>
23 #include <thread.h>
24
24
25
25
26 int threadcreate(thread_t *thread, void *stack, int stackSize)
26 int threadcreate(thread_t *thread, void *stack, int stackSize)
27 {
27 {
28 return 0;
28 return 0;
29 }
29 }
30
30
31
31
32 int threadstart(thread_t *thread)
32 int threadstart(thread_t *thread)
33 {
33 {
34 return 0;
34 return 0;
35 }
35 }
36
36
37
37
38 int threadstop(thread_t *thread)
38 int threadstop(thread_t *thread)
39 {
39 {
40 return 0;
40 return 0;
41 }
41 }
@@ -1,56 +1,56
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef B24LC0X_H
22 #ifndef B24LC0X_H
23 #define B24LC0X_H
23 #define B24LC0X_H
24
24
25 #include <i2c.h>
25 #include <i2c.h>
26 #include <uhandle.h>
26 #include <uhandle.h>
27
27
28 typedef struct eeprom24lc0xDev
28 typedef struct eeprom24lc0xDev
29 {
29 {
30 i2c_t iicdev;
30 i2c_t iicdev;
31 unsigned char devAddress;
31 unsigned char devAddress;
32 unsigned char size;
32 unsigned char size;
33 }eeprom24lc0xDev;
33 }eeprom24lc0xDev;
34
34
35
35
36
36
37 extern void eeprom24lc0xopen(eeprom24lc0xDev* dev,i2c_t iicdev,unsigned char A0_A1_A2_val,unsigned int size);
37 extern void eeprom24lc0xopen(eeprom24lc0xDev* dev,i2c_t iicdev,unsigned char A0_A1_A2_val,unsigned int size);
38
38
39 extern void eeprom24lc0xpagewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page);
39 extern void eeprom24lc0xpagewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page);
40 extern void eeprom24lc0xpageread(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page);
40 extern void eeprom24lc0xpageread(eeprom24lc0xDev* dev,unsigned char address,unsigned char* page);
41 extern void eeprom24lc0xbytewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char data);
41 extern void eeprom24lc0xbytewrite(eeprom24lc0xDev* dev,unsigned char address,unsigned char data);
42 extern unsigned char eeprom24lc0xbyteread(eeprom24lc0xDev* dev,unsigned char address);
42 extern unsigned char eeprom24lc0xbyteread(eeprom24lc0xDev* dev,unsigned char address);
43 extern void eeprom24lc0xreadn(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count);
43 extern void eeprom24lc0xreadn(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count);
44 extern void eeprom24lc0xwriten(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count);
44 extern void eeprom24lc0xwriten(eeprom24lc0xDev* dev,unsigned char address,unsigned char* data, unsigned int count);
45
45
46
46
47
47
48
48
49 #endif
49 #endif
50
50
51
51
52
52
53
53
54
54
55
55
56
56
@@ -1,72 +1,72
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef TERMINAL_H
22 #ifndef TERMINAL_H
23 #define TERMINAL_H
23 #define TERMINAL_H
24 #include <stdint.h>
24 #include <stdint.h>
25 #include <widget.h>
25 #include <widget.h>
26 #include <streamdevices.h>
26 #include <streamdevices.h>
27 #include <genericLCD_Controler.h>
27 #include <genericLCD_Controler.h>
28 #include <fonts.h>
28 #include <fonts.h>
29
29
30 typedef struct terminal_t
30 typedef struct terminal_t
31 {
31 {
32 uint16_t line;
32 uint16_t line;
33 uint16_t column;
33 uint16_t column;
34 uint16_t lineCount;
34 uint16_t lineCount;
35 uint16_t columnCount;
35 uint16_t columnCount;
36 uint16_t firstLine;
36 uint16_t firstLine;
37 uint16_t lastLine;
37 uint16_t lastLine;
38 uint16_t Xpos;
38 uint16_t Xpos;
39 uint16_t Ypos;
39 uint16_t Ypos;
40 uint16_t width;
40 uint16_t width;
41 uint16_t height;
41 uint16_t height;
42 uint32_t backgroundColor;
42 uint32_t backgroundColor;
43 uint32_t textColor;
43 uint32_t textColor;
44 int8_t verticalSpace;
44 int8_t verticalSpace;
45 int8_t horizontalSpace;
45 int8_t horizontalSpace;
46 int8_t empty;
46 int8_t empty;
47 LCD_t* LCD;
47 LCD_t* LCD;
48 sFONT* font;
48 sFONT* font;
49 char* buffer;
49 char* buffer;
50 }terminal_t;
50 }terminal_t;
51
51
52 int terminal_init(terminal_t* terminal,LCD_t* LCD,sFONT* font,streamdevice* strdev);
52 int terminal_init(terminal_t* terminal,LCD_t* LCD,sFONT* font,streamdevice* strdev);
53 void terminal_setgeometry(terminal_t* terminal,uint16_t Xpos,uint16_t Ypos,uint16_t width,uint16_t height);
53 void terminal_setgeometry(terminal_t* terminal,uint16_t Xpos,uint16_t Ypos,uint16_t width,uint16_t height);
54 void terminal_clear(terminal_t* terminal);
54 void terminal_clear(terminal_t* terminal);
55 void terminal_setbackgroundColor(terminal_t* terminal, uint32_t backgrooundColor);
55 void terminal_setbackgroundColor(terminal_t* terminal, uint32_t backgrooundColor);
56 void terminal_settextColor(terminal_t* terminal, uint32_t textColor);
56 void terminal_settextColor(terminal_t* terminal, uint32_t textColor);
57 void terminal_movecursor(terminal_t* terminal,int n);
57 void terminal_movecursor(terminal_t* terminal,int n);
58 void terminal_clearCurentLine(terminal_t* terminal);
58 void terminal_clearCurentLine(terminal_t* terminal);
59 int terminal_write(streamdevice* device,void* data,int size, int n);
59 int terminal_write(streamdevice* device,void* data,int size, int n);
60 int terminal_read(streamdevice* device,void* data,int size, int n);
60 int terminal_read(streamdevice* device,void* data,int size, int n);
61 int terminal_setpos(streamdevice* device,int pos);
61 int terminal_setpos(streamdevice* device,int pos);
62 int terminal_close(streamdevice* device);
62 int terminal_close(streamdevice* device);
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72 #endif
72 #endif
@@ -1,115 +1,115
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef STMPE811_H
22 #ifndef STMPE811_H
23 #define STMPE811_H
23 #define STMPE811_H
24 #include <stdio.h>
24 #include <stdio.h>
25 #include <uhandle.h>
25 #include <uhandle.h>
26 #include <genericTC_Controler.h>
26 #include <genericTC_Controler.h>
27 #include <stdint.h>
27 #include <stdint.h>
28 #include <fonts.h>
28 #include <fonts.h>
29 #include <i2c.h>
29 #include <i2c.h>
30
30
31 typedef struct STMPE811_t
31 typedef struct STMPE811_t
32 {
32 {
33 i2c_t i2cdev;
33 i2c_t i2cdev;
34 uint8_t devAddress;
34 uint8_t devAddress;
35 }STMPE811_t;
35 }STMPE811_t;
36
36
37
37
38 extern int stmpe811init(STMPE811_t *dev, i2c_t i2cdev, uint8_t A0);
38 extern int stmpe811init(STMPE811_t *dev, i2c_t i2cdev, uint8_t A0);
39 extern int stmpe811getID(STMPE811_t *dev);
39 extern int stmpe811getID(STMPE811_t *dev);
40
40
41
41
42
42
43 #define STMPE811_REGISTER_CHIP_ID ((uint32_t) 0x0000 )
43 #define STMPE811_REGISTER_CHIP_ID ((uint32_t) 0x0000 )
44 #define STMPE811_REGISTER_ID_VER ((uint32_t) 0x0002 )
44 #define STMPE811_REGISTER_ID_VER ((uint32_t) 0x0002 )
45 #define STMPE811_REGISTER_SYS_CTRL1 ((uint32_t) 0x0003 )
45 #define STMPE811_REGISTER_SYS_CTRL1 ((uint32_t) 0x0003 )
46 #define STMPE811_REGISTER_SYS_CTRL2 ((uint32_t) 0x0004 )
46 #define STMPE811_REGISTER_SYS_CTRL2 ((uint32_t) 0x0004 )
47 #define STMPE811_REGISTER_SPI_CFG ((uint32_t) 0x0008 )
47 #define STMPE811_REGISTER_SPI_CFG ((uint32_t) 0x0008 )
48 #define STMPE811_REGISTER_INT_CTRL ((uint32_t) 0x0009 )
48 #define STMPE811_REGISTER_INT_CTRL ((uint32_t) 0x0009 )
49 #define STMPE811_REGISTER_INT_EN ((uint32_t) 0x000A )
49 #define STMPE811_REGISTER_INT_EN ((uint32_t) 0x000A )
50 #define STMPE811_REGISTER_INT_STA ((uint32_t) 0x000B )
50 #define STMPE811_REGISTER_INT_STA ((uint32_t) 0x000B )
51 #define STMPE811_REGISTER_GPIO_EN ((uint32_t) 0x000C )
51 #define STMPE811_REGISTER_GPIO_EN ((uint32_t) 0x000C )
52 #define STMPE811_REGISTER_GPIO_INT_STA ((uint32_t) 0x000D )
52 #define STMPE811_REGISTER_GPIO_INT_STA ((uint32_t) 0x000D )
53 #define STMPE811_REGISTER_ADC_INT_EN ((uint32_t) 0x000E )
53 #define STMPE811_REGISTER_ADC_INT_EN ((uint32_t) 0x000E )
54 #define STMPE811_REGISTER_ADC_INT_STA ((uint32_t) 0x000F )
54 #define STMPE811_REGISTER_ADC_INT_STA ((uint32_t) 0x000F )
55 #define STMPE811_REGISTER_GPIO_SET_PIN ((uint32_t) 0x0010 )
55 #define STMPE811_REGISTER_GPIO_SET_PIN ((uint32_t) 0x0010 )
56 #define STMPE811_REGISTER_GPIO_CLR_PIN ((uint32_t) 0x0011 )
56 #define STMPE811_REGISTER_GPIO_CLR_PIN ((uint32_t) 0x0011 )
57 #define STMPE811_REGISTER_GPIO_MP_STA ((uint32_t) 0x0012 )
57 #define STMPE811_REGISTER_GPIO_MP_STA ((uint32_t) 0x0012 )
58 #define STMPE811_REGISTER_GPIO_DIR ((uint32_t) 0x0013 )
58 #define STMPE811_REGISTER_GPIO_DIR ((uint32_t) 0x0013 )
59 #define STMPE811_REGISTER_GPIO_ED ((uint32_t) 0x0014 )
59 #define STMPE811_REGISTER_GPIO_ED ((uint32_t) 0x0014 )
60 #define STMPE811_REGISTER_GPIO_RE ((uint32_t) 0x0015 )
60 #define STMPE811_REGISTER_GPIO_RE ((uint32_t) 0x0015 )
61 #define STMPE811_REGISTER_GPIO_FE ((uint32_t) 0x0016 )
61 #define STMPE811_REGISTER_GPIO_FE ((uint32_t) 0x0016 )
62 #define STMPE811_REGISTER_GPIO_AF ((uint32_t) 0x0017 )
62 #define STMPE811_REGISTER_GPIO_AF ((uint32_t) 0x0017 )
63 #define STMPE811_REGISTER_ADC_CTRL1 ((uint32_t) 0x0020 )
63 #define STMPE811_REGISTER_ADC_CTRL1 ((uint32_t) 0x0020 )
64 #define STMPE811_REGISTER_ADC_CTRL2 ((uint32_t) 0x0021 )
64 #define STMPE811_REGISTER_ADC_CTRL2 ((uint32_t) 0x0021 )
65 #define STMPE811_REGISTER_ADC_CAPT ((uint32_t) 0x0022 )
65 #define STMPE811_REGISTER_ADC_CAPT ((uint32_t) 0x0022 )
66 #define STMPE811_REGISTER_ADC_DATA_CH0 ((uint32_t) 0x0030 )
66 #define STMPE811_REGISTER_ADC_DATA_CH0 ((uint32_t) 0x0030 )
67 #define STMPE811_REGISTER_ADC_DATA_CH1 ((uint32_t) 0x0032 )
67 #define STMPE811_REGISTER_ADC_DATA_CH1 ((uint32_t) 0x0032 )
68 #define STMPE811_REGISTER_ADC_DATA_CH2 ((uint32_t) 0x0034 )
68 #define STMPE811_REGISTER_ADC_DATA_CH2 ((uint32_t) 0x0034 )
69 #define STMPE811_REGISTER_ADC_DATA_CH3 ((uint32_t) 0x0036 )
69 #define STMPE811_REGISTER_ADC_DATA_CH3 ((uint32_t) 0x0036 )
70 #define STMPE811_REGISTER_ADC_DATA_CH4 ((uint32_t) 0x0038 )
70 #define STMPE811_REGISTER_ADC_DATA_CH4 ((uint32_t) 0x0038 )
71 #define STMPE811_REGISTER_ADC_DATA_CH5 ((uint32_t) 0x003A )
71 #define STMPE811_REGISTER_ADC_DATA_CH5 ((uint32_t) 0x003A )
72 #define STMPE811_REGISTER_ADC_DATA_CH6 ((uint32_t) 0x003C )
72 #define STMPE811_REGISTER_ADC_DATA_CH6 ((uint32_t) 0x003C )
73 #define STMPE811_REGISTER_ADC_DATA_CH7 ((uint32_t) 0x003E )
73 #define STMPE811_REGISTER_ADC_DATA_CH7 ((uint32_t) 0x003E )
74 #define STMPE811_REGISTER_TSC_CTRL ((uint32_t) 0x0040 )
74 #define STMPE811_REGISTER_TSC_CTRL ((uint32_t) 0x0040 )
75 #define STMPE811_REGISTER_TSC_CFG ((uint32_t) 0x0041 )
75 #define STMPE811_REGISTER_TSC_CFG ((uint32_t) 0x0041 )
76 #define STMPE811_REGISTER_WDW_TR_X ((uint32_t) 0x0042 )
76 #define STMPE811_REGISTER_WDW_TR_X ((uint32_t) 0x0042 )
77 #define STMPE811_REGISTER_WDW_TR_Y ((uint32_t) 0x0044 )
77 #define STMPE811_REGISTER_WDW_TR_Y ((uint32_t) 0x0044 )
78 #define STMPE811_REGISTER_WDW_BL_X ((uint32_t) 0x0046 )
78 #define STMPE811_REGISTER_WDW_BL_X ((uint32_t) 0x0046 )
79 #define STMPE811_REGISTER_WDW_BL_Y ((uint32_t) 0x0048 )
79 #define STMPE811_REGISTER_WDW_BL_Y ((uint32_t) 0x0048 )
80 #define STMPE811_REGISTER_FIFO_TH ((uint32_t) 0x004A )
80 #define STMPE811_REGISTER_FIFO_TH ((uint32_t) 0x004A )
81 #define STMPE811_REGISTER_FIFO_STA ((uint32_t) 0x004B )
81 #define STMPE811_REGISTER_FIFO_STA ((uint32_t) 0x004B )
82 #define STMPE811_REGISTER_FIFO_SIZE ((uint32_t) 0x004C )
82 #define STMPE811_REGISTER_FIFO_SIZE ((uint32_t) 0x004C )
83 #define STMPE811_REGISTER_TSC_DATA_X ((uint32_t) 0x004D )
83 #define STMPE811_REGISTER_TSC_DATA_X ((uint32_t) 0x004D )
84 #define STMPE811_REGISTER_TSC_DATA_Y ((uint32_t) 0x004F )
84 #define STMPE811_REGISTER_TSC_DATA_Y ((uint32_t) 0x004F )
85 #define STMPE811_REGISTER_TSC_DATA_Z ((uint32_t) 0x0051 )
85 #define STMPE811_REGISTER_TSC_DATA_Z ((uint32_t) 0x0051 )
86 #define STMPE811_REGISTER_TSC_DATA_XYZ ((uint32_t) 0x0052 )
86 #define STMPE811_REGISTER_TSC_DATA_XYZ ((uint32_t) 0x0052 )
87 #define STMPE811_REGISTER_TSC_FRACTION_Z ((uint32_t) 0x0056 )
87 #define STMPE811_REGISTER_TSC_FRACTION_Z ((uint32_t) 0x0056 )
88 #define STMPE811_REGISTER_TSC_DATA ((uint32_t) 0x0057 )
88 #define STMPE811_REGISTER_TSC_DATA ((uint32_t) 0x0057 )
89 #define STMPE811_REGISTER_TSC_I_DRIVE ((uint32_t) 0x0058 )
89 #define STMPE811_REGISTER_TSC_I_DRIVE ((uint32_t) 0x0058 )
90 #define STMPE811_REGISTER_TSC_SHIELD ((uint32_t) 0x0059 )
90 #define STMPE811_REGISTER_TSC_SHIELD ((uint32_t) 0x0059 )
91 #define STMPE811_REGISTER_TEMP_CTRL ((uint32_t) 0x0060 )
91 #define STMPE811_REGISTER_TEMP_CTRL ((uint32_t) 0x0060 )
92 #define STMPE811_REGISTER_TEMP_DATA ((uint32_t) 0x0061 )
92 #define STMPE811_REGISTER_TEMP_DATA ((uint32_t) 0x0061 )
93 #define STMPE811_REGISTER_TEMP_TH ((uint32_t) 0x0062 )
93 #define STMPE811_REGISTER_TEMP_TH ((uint32_t) 0x0062 )
94
94
95
95
96 #endif
96 #endif
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
104
105
105
106
106
107
107
108
108
109
109
110
110
111
111
112
112
113
113
114
114
115
115
@@ -1,37 +1,37
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef GENERICTC_CONTROLER_H
22 #ifndef GENERICTC_CONTROLER_H
23 #define GENERICTC_CONTROLER_H
23 #define GENERICTC_CONTROLER_H
24
24
25 #include <uhandle.h>
25 #include <uhandle.h>
26 #include <stdint.h>
26 #include <stdint.h>
27 #include <fonts.h>
27 #include <fonts.h>
28
28
29
29
30
30
31
31
32 #endif /*GENERICTC_CONTROLER_H*/
32 #endif /*GENERICTC_CONTROLER_H*/
33
33
34
34
35
35
36
36
37
37
@@ -1,75 +1,75
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef N25Q128_H
22 #ifndef N25Q128_H
23 #define N25Q128_H
23 #define N25Q128_H
24
24
25 #include <spi.h>
25 #include <spi.h>
26 #include <uhandle.h>
26 #include <uhandle.h>
27 #include <stdint.h>
27 #include <stdint.h>
28
28
29 typedef struct eepromN25Q128Dev
29 typedef struct eepromN25Q128Dev
30 {
30 {
31 spi_t spidev;
31 spi_t spidev;
32 void (*select)(int sel);
32 void (*select)(int sel);
33 void (*writeprotect)(int wp);
33 void (*writeprotect)(int wp);
34 void (*holdreset)(int hr);
34 void (*holdreset)(int hr);
35 }eepromN25Q128Dev;
35 }eepromN25Q128Dev;
36
36
37 #define N25Q128_PAGE_SZ 256
37 #define N25Q128_PAGE_SZ 256
38 #define N25Q128_CAPACITY_IN_BYTES (1024*1024*16) /*16MB*/
38 #define N25Q128_CAPACITY_IN_BYTES (1024*1024*16) /*16MB*/
39
39
40 #define N25Q128_READID 0x9E
40 #define N25Q128_READID 0x9E
41 #define N25Q128_READ 0x03
41 #define N25Q128_READ 0x03
42 #define N25Q128_FASTREAD 0x0B
42 #define N25Q128_FASTREAD 0x0B
43 #define N25Q128_DOFR 0x3B
43 #define N25Q128_DOFR 0x3B
44 #define N25Q128_DIOFR 0xBB
44 #define N25Q128_DIOFR 0xBB
45 #define N25Q128_QOFR 0x6B
45 #define N25Q128_QOFR 0x6B
46 #define N25Q128_QIOFR 0xEB
46 #define N25Q128_QIOFR 0xEB
47 #define N25Q128_ROTP 0x4B
47 #define N25Q128_ROTP 0x4B
48 #define N25Q128_WREN 0x06
48 #define N25Q128_WREN 0x06
49 #define N25Q128_WRDI 0x04
49 #define N25Q128_WRDI 0x04
50 #define N25Q128_PP 0x02
50 #define N25Q128_PP 0x02
51
51
52
52
53
53
54
54
55
55
56 extern void eepromN25Q128open(eepromN25Q128Dev* dev,spi_t spidev,void (*select)(int sel),void (*writeprotect)(int wp),void (*holdreset)(int hr));
56 extern void eepromN25Q128open(eepromN25Q128Dev* dev,spi_t spidev,void (*select)(int sel),void (*writeprotect)(int wp),void (*holdreset)(int hr));
57 extern void eepromN25Q128pagewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page);
57 extern void eepromN25Q128pagewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page);
58 extern void eepromN25Q128pageread(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page);
58 extern void eepromN25Q128pageread(eepromN25Q128Dev* dev,uint32_t address,unsigned char* page);
59 extern void eepromN25Q128bytewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char data);
59 extern void eepromN25Q128bytewrite(eepromN25Q128Dev* dev,uint32_t address,unsigned char data);
60 extern unsigned char eepromN25Q128byteread(eepromN25Q128Dev* dev,uint32_t address);
60 extern unsigned char eepromN25Q128byteread(eepromN25Q128Dev* dev,uint32_t address);
61 extern void eepromN25Q128readn(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count);
61 extern void eepromN25Q128readn(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count);
62 extern void eepromN25Q128writen(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count);
62 extern void eepromN25Q128writen(eepromN25Q128Dev* dev,uint32_t address,unsigned char* data, unsigned int count);
63 extern void eepromN25Q128enablewrite(eepromN25Q128Dev* dev);
63 extern void eepromN25Q128enablewrite(eepromN25Q128Dev* dev);
64
64
65
65
66
66
67
67
68 #endif
68 #endif
69
69
70
70
71
71
72
72
73
73
74
74
75
75
@@ -1,97 +1,97
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 #-- This file is a part of the libuc, microcontroler library
2 #-- This file is a part of the libuc, microcontroler library
3 #-- Copyright (C) 2011, Alexis Jeandet
3 #-- Copyright (C) 2011, Alexis Jeandet
4 #--
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
5 #-- This program is free software; you can redistribute it and/or modify
6 #-- it under the terms of the GNU General Public License as published by
6 #-- it under the terms of the GNU General Public License as published by
7 #-- the Free Software Foundation; either version 3 of the License, or
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
8 #-- (at your option) any later version.
9 #--
9 #--
10 #-- This program is distributed in the hope that it will be useful,
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
13 #-- GNU General Public License for more details.
14 #--
14 #--
15 #-- You should have received a copy of the GNU General Public License
15 #-- You should have received a copy of the GNU General Public License
16 #-- along with this program; if not, write to the Free Software
16 #-- along with this program; if not, write to the Free Software
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
19 #-- Author : Alexis Jeandet
19 #-- Author : Alexis Jeandet
20 #-- Mail : alexis.jeandet@gmail.com
20 #-- Mail : alexis.jeandet@member.fsf.org
21 #-------------------------------------------------------------------------------*/
21 #-------------------------------------------------------------------------------*/
22 #ifndef VS10XX_H
22 #ifndef VS10XX_H
23 #define VS10XX_H
23 #define VS10XX_H
24 #include <uhandle.h>
24 #include <uhandle.h>
25 #include <spi.h>
25 #include <spi.h>
26
26
27 #define VSMODE 0
27 #define VSMODE 0
28 #define VSSTATUS 1
28 #define VSSTATUS 1
29 #define VSBASS 2
29 #define VSBASS 2
30 #define VSCLOCKF 3
30 #define VSCLOCKF 3
31 #define VSDECODE_TIME 4
31 #define VSDECODE_TIME 4
32 #define VSAUDATA 5
32 #define VSAUDATA 5
33 #define VSWRAM 6
33 #define VSWRAM 6
34 #define VSWRAMADDR 7
34 #define VSWRAMADDR 7
35 #define VSHDAT0 8
35 #define VSHDAT0 8
36 #define VSHDAT1 9
36 #define VSHDAT1 9
37 #define VSAIADDR 0xA
37 #define VSAIADDR 0xA
38 #define VSVOL 0xB
38 #define VSVOL 0xB
39 #define VSAICTRL0 0xC
39 #define VSAICTRL0 0xC
40 #define VSAICTRL1 0xD
40 #define VSAICTRL1 0xD
41 #define VSAICTRL2 0xE
41 #define VSAICTRL2 0xE
42 #define VSAICTRL3 0xF
42 #define VSAICTRL3 0xF
43
43
44 typedef enum VS10XXVER_en
44 typedef enum VS10XXVER_en
45 {
45 {
46 UNKNOWN,
46 UNKNOWN,
47 VS1001,
47 VS1001,
48 VS1011,
48 VS1011,
49 VS1002,
49 VS1002,
50 VS1003,
50 VS1003,
51 VS1053,
51 VS1053,
52 VS1033,
52 VS1033,
53 VS1103
53 VS1103
54 }VS10XXVER_en;
54 }VS10XXVER_en;
55
55
56 typedef struct vs10XXDev
56 typedef struct vs10XXDev
57 {
57 {
58 spi_t SPIdev;
58 spi_t SPIdev;
59 void (*setxCS)(char);
59 void (*setxCS)(char);
60 void (*setxRST)(char);
60 void (*setxRST)(char);
61 void (*setxDCS)(char);
61 void (*setxDCS)(char);
62 int (*getDREQ)();
62 int (*getDREQ)();
63 VS10XXVER_en VERSION;
63 VS10XXVER_en VERSION;
64 }vs10XXDev;
64 }vs10XXDev;
65
65
66
66
67 void vs10XXopen(vs10XXDev* codec,spi_t dev, void (*setxCS)(char),void (*setxRST)(char),void (*setxDCS)(char),int (*getDREQ)());
67 void vs10XXopen(vs10XXDev* codec,spi_t dev, void (*setxCS)(char),void (*setxRST)(char),void (*setxDCS)(char),int (*getDREQ)());
68 void vs10XXsoftreset(vs10XXDev* dev);
68 void vs10XXsoftreset(vs10XXDev* dev);
69 int vs10XXcmdread(vs10XXDev* dev,char address);
69 int vs10XXcmdread(vs10XXDev* dev,char address);
70 void vs10XXcmdwrite(vs10XXDev* dev,char address,int value);
70 void vs10XXcmdwrite(vs10XXDev* dev,char address,int value);
71 void vs10XXstream32bytes(vs10XXDev* dev,char* buffer);
71 void vs10XXstream32bytes(vs10XXDev* dev,char* buffer);
72 void vs10XXsetCansel(vs10XXDev* dev);
72 void vs10XXsetCansel(vs10XXDev* dev);
73 int vs10XXcanselAccepted(vs10XXDev* dev);
73 int vs10XXcanselAccepted(vs10XXDev* dev);
74 void vs10XXsoftReset(vs10XXDev* dev);
74 void vs10XXsoftReset(vs10XXDev* dev);
75 //extern void vs10XXclearXCS();
75 //extern void vs10XXclearXCS();
76 //extern void vs10XXsetXCS();
76 //extern void vs10XXsetXCS();
77 //extern int vs10XXDREQ();
77 //extern int vs10XXDREQ();
78
78
79 #endif //VS10XX_H
79 #endif //VS10XX_H
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
88
88
89
89
90
90
91
91
92
92
93
93
94
94
95
95
96
96
97
97
@@ -1,196 +1,196
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef FAT32_H
22 #ifndef FAT32_H
23 #define FAT32_H
23 #define FAT32_H
24 #include <mbr.h>
24 #include <mbr.h>
25 #include <libucfs.h>
25 #include <libucfs.h>
26 #include <ucdirent.h>
26 #include <ucdirent.h>
27 #include <stdint.h>
27 #include <stdint.h>
28 #include <stdint-gcc.h>
28 #include <stdint-gcc.h>
29 /*BPB (Boot Sector) Offsets */
29 /*BPB (Boot Sector) Offsets */
30
30
31 #define BS_jmpBootoff 0
31 #define BS_jmpBootoff 0
32 #define BS_OEMNameoff 3
32 #define BS_OEMNameoff 3
33 #define BPB_BytsPerSecoff 11
33 #define BPB_BytsPerSecoff 11
34 #define BPB_SecPerClusoff 13
34 #define BPB_SecPerClusoff 13
35 #define BPB_RsvdSecCntoff 14
35 #define BPB_RsvdSecCntoff 14
36 #define BPB_NumFATsoff 16
36 #define BPB_NumFATsoff 16
37 #define BPB_RootEntCntoff 17
37 #define BPB_RootEntCntoff 17
38 #define BPB_TotSec16off 19
38 #define BPB_TotSec16off 19
39 #define BPB_Mediaoff 21
39 #define BPB_Mediaoff 21
40 #define BPB_FATSz16off 22
40 #define BPB_FATSz16off 22
41 #define BPB_SecPerTrkoff 24
41 #define BPB_SecPerTrkoff 24
42 #define BPB_NumHeadsoff 26
42 #define BPB_NumHeadsoff 26
43 #define BPB_HiddSecoff 28
43 #define BPB_HiddSecoff 28
44 #define BPB_TotSec32off 32
44 #define BPB_TotSec32off 32
45 /*FAT16*/
45 /*FAT16*/
46 #define BS_DrvNumFAT16off 36
46 #define BS_DrvNumFAT16off 36
47 #define BS_Reserved1FAT16off 37
47 #define BS_Reserved1FAT16off 37
48 #define BS_BootSigFAT16off 38
48 #define BS_BootSigFAT16off 38
49 #define BS_VolIDFAT16off 39
49 #define BS_VolIDFAT16off 39
50 #define BS_VolLabFAT16off 43
50 #define BS_VolLabFAT16off 43
51 #define BS_FilSysTypeFAT16off 54
51 #define BS_FilSysTypeFAT16off 54
52 /*FAT32*/
52 /*FAT32*/
53 #define BPB_FATSz32off 36
53 #define BPB_FATSz32off 36
54 #define BPB_ExtFlagsoff 40
54 #define BPB_ExtFlagsoff 40
55 #define BPB_FSVeroff 42
55 #define BPB_FSVeroff 42
56 #define BPB_RootClusoff 44
56 #define BPB_RootClusoff 44
57 #define BPB_FSInfooff 48
57 #define BPB_FSInfooff 48
58 #define BPB_BkBootSecoff 50
58 #define BPB_BkBootSecoff 50
59 #define BPB_Reservedoff 52
59 #define BPB_Reservedoff 52
60 #define BS_DrvNumFAT32off 64
60 #define BS_DrvNumFAT32off 64
61 #define BS_Reserved1FAT32off 65
61 #define BS_Reserved1FAT32off 65
62 #define BS_BootSigFAT32off 66
62 #define BS_BootSigFAT32off 66
63 #define BS_VolIDFAT32off 67
63 #define BS_VolIDFAT32off 67
64 #define BS_VolLabFAT32off 71
64 #define BS_VolLabFAT32off 71
65 #define BS_FilSysTypeFAT32off 82
65 #define BS_FilSysTypeFAT32off 82
66
66
67
67
68 #define DIR_Nameoff 0
68 #define DIR_Nameoff 0
69 #define DIR_Attroff 0xb
69 #define DIR_Attroff 0xb
70 #define DIR_FstClusHIoff 0x14
70 #define DIR_FstClusHIoff 0x14
71 #define DIR_FstClusLOoff 0x1A
71 #define DIR_FstClusLOoff 0x1A
72 #define DIR_FileSizeoff 0x1c
72 #define DIR_FileSizeoff 0x1c
73 #define DIR_CrtTimeTenthoff 13
73 #define DIR_CrtTimeTenthoff 13
74 #define DIR_CrtTimeoff 14
74 #define DIR_CrtTimeoff 14
75 #define DIR_CrtDateoff 16
75 #define DIR_CrtDateoff 16
76 #define DIR_LstAccDateoff 18
76 #define DIR_LstAccDateoff 18
77 #define DIR_WrtTimeoff 22
77 #define DIR_WrtTimeoff 22
78 #define DIR_WrtDateoff 24
78 #define DIR_WrtDateoff 24
79
79
80
80
81
81
82 #define FATBadpart 1
82 #define FATBadpart 1
83 #define FATBabArg 2
83 #define FATBabArg 2
84 #define FATReadErr 3
84 #define FATReadErr 3
85 #define FATnoErr 0
85 #define FATnoErr 0
86
86
87 /*
87 /*
88 TODO :
88 TODO :
89 intergrate a per BLKDEV or per partition buffer.
89 intergrate a per BLKDEV or per partition buffer.
90 */
90 */
91 typedef struct FAT32fs
91 typedef struct FAT32fs
92 {
92 {
93 uint16_t BPB_BytsPerSec;
93 uint16_t BPB_BytsPerSec;
94 uint16_t BPB_RsvdSecCnt;
94 uint16_t BPB_RsvdSecCnt;
95 uint32_t BPB_FATSz32;
95 uint32_t BPB_FATSz32;
96 uint32_t BPB_RootClus;
96 uint32_t BPB_RootClus;
97 uint32_t fat_begin_lba;
97 uint32_t fat_begin_lba;
98 uint32_t cluster_begin_lba;
98 uint32_t cluster_begin_lba;
99 uint8_t BPB_SecPerClus;
99 uint8_t BPB_SecPerClus;
100 uint8_t BPB_NumFATs;
100 uint8_t BPB_NumFATs;
101 char valide;
101 char valide;
102 dikpartition* part;
102 dikpartition* part;
103 }FAT32fs;
103 }FAT32fs;
104
104
105
105
106 #define castUI64(val) ((uint64_t)(val))
106 #define castUI64(val) ((uint64_t)(val))
107 #define castUI32(val) ((uint32_t)(val))
107 #define castUI32(val) ((uint32_t)(val))
108 #define castUI16(val) ((uint16_t)(val))
108 #define castUI16(val) ((uint16_t)(val))
109 #define castUI8(val) ((uint8_t)(val))
109 #define castUI8(val) ((uint8_t)(val))
110
110
111 #define castI64(val) ((int64_t)(val))
111 #define castI64(val) ((int64_t)(val))
112 #define castI32(val) ((int32_t)(val))
112 #define castI32(val) ((int32_t)(val))
113 #define castI16(val) ((int16_t)(val))
113 #define castI16(val) ((int16_t)(val))
114 #define castI8(val) ((int8_t)(val))
114 #define castI8(val) ((int8_t)(val))
115
115
116 /*
116 /*
117 TODO :
117 TODO :
118 Should add global function for casting with endianness care.
118 Should add global function for casting with endianness care.
119 have a look at REV, REV16, REVSH, and RBIT ARMV7m asm
119 have a look at REV, REV16, REVSH, and RBIT ARMV7m asm
120 */
120 */
121
121
122 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
122 #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
123 #define fat32Ui8_2_Ui32(table,lsBindex) ((uint32_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint32_t)table[lsBindex+1])<<8))+(0xFF0000&(((uint32_t)table[lsBindex+2])<<16))+(0xFF000000&(((uint32_t)table[lsBindex+3])<<24))))
123 #define fat32Ui8_2_Ui32(table,lsBindex) ((uint32_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint32_t)table[lsBindex+1])<<8))+(0xFF0000&(((uint32_t)table[lsBindex+2])<<16))+(0xFF000000&(((uint32_t)table[lsBindex+3])<<24))))
124 #define fat32Ui8_2_Ui16(table,lsBindex) ((uint16_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint16_t)table[lsBindex+1])<<8))))
124 #define fat32Ui8_2_Ui16(table,lsBindex) ((uint16_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint16_t)table[lsBindex+1])<<8))))
125 #define fat32extract16b(table, LSBOffset) (uint16_t)(( (uint16_t) ((uint8_t)table[(LSBOffset)]) ) + (uint16_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 ))
125 #define fat32extract16b(table, LSBOffset) (uint16_t)(( (uint16_t) ((uint8_t)table[(LSBOffset)]) ) + (uint16_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 ))
126 #define fat32extract32b(table, LSBOffset) (uint32_t)(( (uint32_t) ((uint8_t)table[(LSBOffset)]) ) + (uint32_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+2]) << 16 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+3]) << 24 ))
126 #define fat32extract32b(table, LSBOffset) (uint32_t)(( (uint32_t) ((uint8_t)table[(LSBOffset)]) ) + (uint32_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+2]) << 16 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+3]) << 24 ))
127 #else
127 #else
128 #define fat32Ui8_2_Ui32(table,lsBindex) ((uint32_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint32_t)table[lsBindex+1])<<8))+(0xFF0000&(((uint32_t)table[lsBindex+2])<<16))+(0xFF000000&(((uint32_t)table[lsBindex+3])<<24))))
128 #define fat32Ui8_2_Ui32(table,lsBindex) ((uint32_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint32_t)table[lsBindex+1])<<8))+(0xFF0000&(((uint32_t)table[lsBindex+2])<<16))+(0xFF000000&(((uint32_t)table[lsBindex+3])<<24))))
129 #define fat32Ui8_2_Ui16(table,lsBindex) ((uint16_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint16_t)table[lsBindex+1])<<8))))
129 #define fat32Ui8_2_Ui16(table,lsBindex) ((uint16_t)((0xFF&(table[lsBindex]))+(0xFF00&(((uint16_t)table[lsBindex+1])<<8))))
130 #define fat32extract16b(table, LSBOffset) (uint16_t)(( (uint16_t) ((uint8_t)table[(LSBOffset)]) ) + (uint16_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 ))
130 #define fat32extract16b(table, LSBOffset) (uint16_t)(( (uint16_t) ((uint8_t)table[(LSBOffset)]) ) + (uint16_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 ))
131 #define fat32extract32b(table, LSBOffset) (uint32_t)(( (uint32_t) ((uint8_t)table[(LSBOffset)]) ) + (uint32_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+2]) << 16 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+3]) << 24 ))
131 #define fat32extract32b(table, LSBOffset) (uint32_t)(( (uint32_t) ((uint8_t)table[(LSBOffset)]) ) + (uint32_t)( ((uint8_t)table[(LSBOffset)+1]) << 8 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+2]) << 16 )+ (uint32_t)( ((uint8_t)table[(LSBOffset)+3]) << 24 ))
132 #endif
132 #endif
133
133
134
134
135 /* Get the first sector lba of given cluster number*/
135 /* Get the first sector lba of given cluster number*/
136 #define clusterlba(fs,cluster_number) ((uint32_t)fs->cluster_begin_lba + (((uint32_t)cluster_number) - (2)) * (uint32_t)fs->BPB_SecPerClus)
136 #define clusterlba(fs,cluster_number) ((uint32_t)fs->cluster_begin_lba + (((uint32_t)cluster_number) - (2)) * (uint32_t)fs->BPB_SecPerClus)
137
137
138 //#define fat32clusterinfatsect(fs,cluster_number) ((((uint32_t)(cluster_number))>>6) + fs->fat_begin_lba)
138 //#define fat32clusterinfatsect(fs,cluster_number) ((((uint32_t)(cluster_number))>>6) + fs->fat_begin_lba)
139 #define fat32clusterinfatsect(fs,cluster_number) ((((uint32_t)(cluster_number))>>7) + fs->fat_begin_lba)
139 #define fat32clusterinfatsect(fs,cluster_number) ((((uint32_t)(cluster_number))>>7) + fs->fat_begin_lba)
140 #define fat32clusterinfatoff(cluster_number) (((cluster_number)&0x7F)*4)
140 #define fat32clusterinfatoff(cluster_number) (((cluster_number)&0x7F)*4)
141
141
142 /*Get cluster index in FAT Table from sector address*/
142 /*Get cluster index in FAT Table from sector address*/
143 #define fat32masksectorlba(sectorlba,fs) (sectorlba)//(sectorlba & (castUI32(-1)^castUI32(fs->BPB_SecPerClus-1)))
143 #define fat32masksectorlba(sectorlba,fs) (sectorlba)//(sectorlba & (castUI32(-1)^castUI32(fs->BPB_SecPerClus-1)))
144 #define fat32sectorlbatoclusternum(fs,sectorlba) (((fat32masksectorlba(castUI32(sectorlba),fs) -(castUI32(fs->cluster_begin_lba)))/castUI32(fs->BPB_SecPerClus))+castUI32(2))
144 #define fat32sectorlbatoclusternum(fs,sectorlba) (((fat32masksectorlba(castUI32(sectorlba),fs) -(castUI32(fs->cluster_begin_lba)))/castUI32(fs->BPB_SecPerClus))+castUI32(2))
145
145
146
146
147 #ifdef FAT32_PRIVATE
147 #ifdef FAT32_PRIVATE
148 #define fat32sectorreadout(fs,fatsec) \
148 #define fat32sectorreadout(fs,fatsec) \
149 if((lastSecAddrs!=(fatsec)) || (lastFATFS!=(fs))) /*Check if sector already buffered*/ \
149 if((lastSecAddrs!=(fatsec)) || (lastFATFS!=(fs))) /*Check if sector already buffered*/ \
150 {\
150 {\
151 if((fs)->part->phy->read((fs)->part->phy,fat32buff,(fatsec),1)!=RES_OK) \
151 if((fs)->part->phy->read((fs)->part->phy,fat32buff,(fatsec),1)!=RES_OK) \
152 {\
152 {\
153 return DIRENT_ReadErr;\
153 return DIRENT_ReadErr;\
154 }\
154 }\
155 }\
155 }\
156 lastSecAddrs=(fatsec);\
156 lastSecAddrs=(fatsec);\
157 lastFATFS=(fs);
157 lastFATFS=(fs);
158 #endif
158 #endif
159
159
160 extern int fat32open(FAT32fs* fs,dikpartition* part);
160 extern int fat32open(FAT32fs* fs,dikpartition* part);
161 extern int fat32mkdirent(FAT32fs* fs,ucdirent* dirent);
161 extern int fat32mkdirent(FAT32fs* fs,ucdirent* dirent);
162 extern int fat32getVolName(FAT32fs* fs,char* Name);
162 extern int fat32getVolName(FAT32fs* fs,char* Name);
163 extern int fat32getrootfirstent(ucdirent* entry);
163 extern int fat32getrootfirstent(ucdirent* entry);
164 extern int fat32nextdirent(ucdirent* entry);
164 extern int fat32nextdirent(ucdirent* entry);
165 extern int fat32nextsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t* nextsector_lba);
165 extern int fat32nextsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t* nextsector_lba);
166 extern int fat32prevsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t *nextsector_lba);
166 extern int fat32prevsectorlba(FAT32fs* fs,uint32_t lastsector_lba,uint32_t *nextsector_lba);
167 extern int fat32prevsectorlba2(FAT32fs* fs,ucdirent* entry,uint32_t lastsector_lba,uint32_t *nextsector_lba);
167 extern int fat32prevsectorlba2(FAT32fs* fs,ucdirent* entry,uint32_t lastsector_lba,uint32_t *nextsector_lba);
168 extern uint32_t fat32getdirentlba(ucdirent* entry);
168 extern uint32_t fat32getdirentlba(ucdirent* entry);
169 extern int fat32getdirentname(ucdirent* entry,char* nameBuffer);
169 extern int fat32getdirentname(ucdirent* entry,char* nameBuffer);
170
170
171 #endif
171 #endif
172
172
173
173
174
174
175
175
176
176
177
177
178
178
179
179
180
180
181
181
182
182
183
183
184
184
185
185
186
186
187
187
188
188
189
189
190
190
191
191
192
192
193
193
194
194
195
195
196
196
@@ -1,72 +1,72
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef MBR_H
22 #ifndef MBR_H
23 #define MBR_H
23 #define MBR_H
24 #include <uhandle.h>
24 #include <uhandle.h>
25 #include <blkdevice.h>
25 #include <blkdevice.h>
26
26
27 #define BootFlagoffset 0
27 #define BootFlagoffset 0
28 #define TypeCodeoffset 4
28 #define TypeCodeoffset 4
29 #define LBABeginoffset 8
29 #define LBABeginoffset 8
30 #define NumOfSecoffset 12
30 #define NumOfSecoffset 12
31
31
32 #define MBRBadMbr 1
32 #define MBRBadMbr 1
33 #define MBRBabArg 2
33 #define MBRBabArg 2
34 #define MBRReadErr 3
34 #define MBRReadErr 3
35 #define MBRnoErr 0
35 #define MBRnoErr 0
36
36
37 #define isFat32(TypeCode) (((TypeCode)==0x0b)||((TypeCode)==0x0c))
37 #define isFat32(TypeCode) (((TypeCode)==0x0b)||((TypeCode)==0x0c))
38
38
39 typedef struct dikpartition
39 typedef struct dikpartition
40 {
40 {
41 char TypeCode;
41 char TypeCode;
42 char valide;
42 char valide;
43 unsigned int LBABegin;
43 unsigned int LBABegin;
44 unsigned int NumOfSec;
44 unsigned int NumOfSec;
45 blkdevice* phy;
45 blkdevice* phy;
46 }dikpartition;
46 }dikpartition;
47
47
48
48
49 int mbropen(blkdevice* phy,dikpartition* part,char partNum);
49 int mbropen(blkdevice* phy,dikpartition* part,char partNum);
50
50
51
51
52 #endif
52 #endif
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
@@ -1,106 +1,106
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef SDCARD_H
22 #ifndef SDCARD_H
23 #define SDCARD_H
23 #define SDCARD_H
24 #include "blkdevice.h"
24 #include "blkdevice.h"
25 #include <libucstrings.h>
25 #include <libucstrings.h>
26 #include <uhandle.h>
26 #include <uhandle.h>
27
27
28 /* MMC/SD command */
28 /* MMC/SD command */
29 #define CMD0 (0) /* GO_IDLE_STATE */
29 #define CMD0 (0) /* GO_IDLE_STATE */
30 #define CMD1 (1) /* SEND_OP_COND (MMC) */
30 #define CMD1 (1) /* SEND_OP_COND (MMC) */
31 #define ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */
31 #define ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */
32 #define CMD8 (8) /* SEND_IF_COND */
32 #define CMD8 (8) /* SEND_IF_COND */
33 #define CMD9 (9) /* SEND_CSD */
33 #define CMD9 (9) /* SEND_CSD */
34 #define CMD10 (10) /* SEND_CID */
34 #define CMD10 (10) /* SEND_CID */
35 #define CMD12 (12) /* STOP_TRANSMISSION */
35 #define CMD12 (12) /* STOP_TRANSMISSION */
36 #define ACMD13 (0x80+13) /* SD_STATUS (SDC) */
36 #define ACMD13 (0x80+13) /* SD_STATUS (SDC) */
37 #define CMD16 (16) /* SET_BLOCKLEN */
37 #define CMD16 (16) /* SET_BLOCKLEN */
38 #define CMD17 (17) /* READ_SINGLE_BLOCK */
38 #define CMD17 (17) /* READ_SINGLE_BLOCK */
39 #define CMD18 (18) /* READ_MULTIPLE_BLOCK */
39 #define CMD18 (18) /* READ_MULTIPLE_BLOCK */
40 #define CMD23 (23) /* SET_BLOCK_COUNT (MMC) */
40 #define CMD23 (23) /* SET_BLOCK_COUNT (MMC) */
41 #define ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */
41 #define ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */
42 #define CMD24 (24) /* WRITE_BLOCK */
42 #define CMD24 (24) /* WRITE_BLOCK */
43 #define CMD25 (25) /* WRITE_MULTIPLE_BLOCK */
43 #define CMD25 (25) /* WRITE_MULTIPLE_BLOCK */
44 #define CMD32 (32) /* ERASE_ER_BLK_START */
44 #define CMD32 (32) /* ERASE_ER_BLK_START */
45 #define CMD33 (33) /* ERASE_ER_BLK_END */
45 #define CMD33 (33) /* ERASE_ER_BLK_END */
46 #define CMD38 (38) /* ERASE */
46 #define CMD38 (38) /* ERASE */
47 #define CMD55 (55) /* APP_CMD */
47 #define CMD55 (55) /* APP_CMD */
48 #define CMD58 (58) /* READ_OCR */
48 #define CMD58 (58) /* READ_OCR */
49
49
50 /* Card type flags (CardType) */
50 /* Card type flags (CardType) */
51 #define CT_MMC 0x01 /* MMC ver 3 */
51 #define CT_MMC 0x01 /* MMC ver 3 */
52 #define CT_SD1 0x02 /* SD ver 1 */
52 #define CT_SD1 0x02 /* SD ver 1 */
53 #define CT_SD2 0x04 /* SD ver 2 */
53 #define CT_SD2 0x04 /* SD ver 2 */
54 #define CT_SDC (CT_SD1|CT_SD2) /* SD */
54 #define CT_SDC (CT_SD1|CT_SD2) /* SD */
55 #define CT_BLOCK 0x08 /* Block addressing */
55 #define CT_BLOCK 0x08 /* Block addressing */
56
56
57 struct sdcard_str
57 struct sdcard_str
58 {
58 {
59 UHANDLE phy;
59 UHANDLE phy;
60 int (*rcvr_mmc) (UHANDLE phy,char *buff,uint32_t bc);
60 int (*rcvr_mmc) (UHANDLE phy,char *buff,uint32_t bc);
61 int (*xmit_mmc) (UHANDLE phy,const char *buff,uint32_t bc);
61 int (*xmit_mmc) (UHANDLE phy,const char *buff,uint32_t bc);
62 int (*setspeed) (UHANDLE phy,uint32_t speed);
62 int (*setspeed) (UHANDLE phy,uint32_t speed);
63 uint32_t (*getspeed) (UHANDLE phy);
63 uint32_t (*getspeed) (UHANDLE phy);
64 DSTATUS Stat;
64 DSTATUS Stat;
65 char CardType;
65 char CardType;
66 };
66 };
67
67
68 typedef volatile struct sdcard_str sdcardDev;
68 typedef volatile struct sdcard_str sdcardDev;
69
69
70 //extern void sdcardmake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy));
70 //extern void sdcardmake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy));
71 //extern void sdcardmakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected);
71 //extern void sdcardmakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected);
72
72
73
73
74 #endif
74 #endif
75
75
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
88
88
89
89
90
90
91
91
92
92
93
93
94
94
95
95
96
96
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
104
105
105
106
106
@@ -1,150 +1,150
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 /*
22 /*
23 TODO:
23 TODO:
24 Add SPI slave mode
24 Add SPI slave mode
25 Add interrupt interface
25 Add interrupt interface
26 */
26 */
27
27
28 #ifndef SPI_H
28 #ifndef SPI_H
29 #define SPI_H
29 #define SPI_H
30 #include <stdint.h>
30 #include <stdint.h>
31 #include <uhandle.h>
31 #include <uhandle.h>
32
32
33 #ifdef __cplusplus
33 #ifdef __cplusplus
34 extern "C" {
34 extern "C" {
35 #endif
35 #endif
36
36
37 /*
37 /*
38 typedef struct spi_t
38 typedef struct spi_t
39 {
39 {
40 void* _dev;
40 void* _dev;
41 int cfg;
41 int cfg;
42 int speed;
42 int speed;
43 }spi_t;*/
43 }spi_t;*/
44
44
45 typedef int spi_t;
45 typedef int spi_t;
46
46
47 #define spi1 ((spi_t)0)
47 #define spi1 ((spi_t)0)
48 #define spi2 ((spi_t)1)
48 #define spi2 ((spi_t)1)
49 #define spi3 ((spi_t)2)
49 #define spi3 ((spi_t)2)
50 #define spi4 ((spi_t)3)
50 #define spi4 ((spi_t)3)
51 #define spi5 ((spi_t)4)
51 #define spi5 ((spi_t)4)
52 #define spi6 ((spi_t)5)
52 #define spi6 ((spi_t)5)
53 #define spi7 ((spi_t)6)
53 #define spi7 ((spi_t)6)
54 #define spi8 ((spi_t)7)
54 #define spi8 ((spi_t)7)
55 #define spi9 ((spi_t)8)
55 #define spi9 ((spi_t)8)
56
56
57
57
58 typedef enum
58 typedef enum
59 {
59 {
60 spi4bits = 0x3,
60 spi4bits = 0x3,
61 spi5bits = 0x4,
61 spi5bits = 0x4,
62 spi6bits = 0x5,
62 spi6bits = 0x5,
63 spi7bits = 0x6,
63 spi7bits = 0x6,
64 spi8bits = 0x7,
64 spi8bits = 0x7,
65 spi9bits = 0x8,
65 spi9bits = 0x8,
66 spi10bits = 0x9,
66 spi10bits = 0x9,
67 spi11bits = 0xA,
67 spi11bits = 0xA,
68 spi12bits = 0xB,
68 spi12bits = 0xB,
69 spi13bits = 0xC,
69 spi13bits = 0xC,
70 spi14bits = 0xD,
70 spi14bits = 0xD,
71 spi15bits = 0xE,
71 spi15bits = 0xE,
72 spi16bits = 0xF
72 spi16bits = 0xF
73 }spibits_t;
73 }spibits_t;
74
74
75 #define SPIBITSMASK 0xF
75 #define SPIBITSMASK 0xF
76
76
77 typedef enum
77 typedef enum
78 {
78 {
79 spislave = 0x00,
79 spislave = 0x00,
80 spimaster = 0x10
80 spimaster = 0x10
81 }spimode_t;
81 }spimode_t;
82
82
83 #define SPIMODEMASK 0x10
83 #define SPIMODEMASK 0x10
84
84
85 typedef enum
85 typedef enum
86 {
86 {
87 spiclkinhlow = 0x00,
87 spiclkinhlow = 0x00,
88 spiclkinhhigh = 0x20
88 spiclkinhhigh = 0x20
89 }spiclkinhlvl_t;
89 }spiclkinhlvl_t;
90
90
91 #define SPICLKINHLVLMASK 0x20
91 #define SPICLKINHLVLMASK 0x20
92
92
93
93
94 typedef enum
94 typedef enum
95 {
95 {
96 spiclkfirstedge = 0x00,
96 spiclkfirstedge = 0x00,
97 spiclksecondedge = 0x40
97 spiclksecondedge = 0x40
98 }spiclkphase_t;
98 }spiclkphase_t;
99
99
100 #define SPICLKPHASEMASK 0x40
100 #define SPICLKPHASEMASK 0x40
101
101
102 typedef enum
102 typedef enum
103 {
103 {
104 spimsbfirst = 0x00,
104 spimsbfirst = 0x00,
105 spilsbfirst = 0x80
105 spilsbfirst = 0x80
106 }spibitorder_t;
106 }spibitorder_t;
107
107
108 #define SPIBITORDERMASK 0x80
108 #define SPIBITORDERMASK 0x80
109
109
110
110
111 extern spi_t spiopen(int count);
111 extern spi_t spiopen(int count);
112 extern spi_t spiopenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin);
112 extern spi_t spiopenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin);
113 extern int spiclose(spi_t spidev);
113 extern int spiclose(spi_t spidev);
114 extern int spisetpins(spi_t spidev,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin);
114 extern int spisetpins(spi_t spidev,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin);
115 extern int spienable(spi_t spidev);
115 extern int spienable(spi_t spidev);
116 extern int spidisable(spi_t spidev);
116 extern int spidisable(spi_t spidev);
117 extern int spitransactionfinished(spi_t spidev);
117 extern int spitransactionfinished(spi_t spidev);
118 extern int spisetconfig(spi_t spidev,uint32_t config,uint32_t speed);
118 extern int spisetconfig(spi_t spidev,uint32_t config,uint32_t speed);
119 extern int spisetspeed(spi_t spidev, uint32_t speed);
119 extern int spisetspeed(spi_t spidev, uint32_t speed);
120 extern uint32_t spigetspeed(spi_t spidev);
120 extern uint32_t spigetspeed(spi_t spidev);
121 extern int spisetbitorder(spi_t spidev,spibitorder_t order);
121 extern int spisetbitorder(spi_t spidev,spibitorder_t order);
122 extern int spisetdatabits(spi_t spidev,spibits_t bitscnt);
122 extern int spisetdatabits(spi_t spidev,spibits_t bitscnt);
123 extern int spisetclkinhlevel(spi_t spidev,spiclkinhlvl_t level);
123 extern int spisetclkinhlevel(spi_t spidev,spiclkinhlvl_t level);
124 extern int spisetclkphase(spi_t spidev,spiclkphase_t phase);
124 extern int spisetclkphase(spi_t spidev,spiclkphase_t phase);
125 extern int spiputw(spi_t spidev,uint16_t data);
125 extern int spiputw(spi_t spidev,uint16_t data);
126 extern uint16_t spigetw(spi_t spidev);
126 extern uint16_t spigetw(spi_t spidev);
127 extern int spiputs(spi_t spidev,char* s);
127 extern int spiputs(spi_t spidev,char* s);
128 extern int spigets(spi_t spidev,char* s);
128 extern int spigets(spi_t spidev,char* s);
129 extern int spiputnw(spi_t spidev,uint16_t* w,int n);
129 extern int spiputnw(spi_t spidev,uint16_t* w,int n);
130 extern int spigetnw(spi_t spidev,uint16_t* w,int n);
130 extern int spigetnw(spi_t spidev,uint16_t* w,int n);
131 extern int spiputnc(spi_t spidev,char* c,int n);
131 extern int spiputnc(spi_t spidev,char* c,int n);
132 extern int spigetnc(spi_t spidev,char* c,int n);
132 extern int spigetnc(spi_t spidev,char* c,int n);
133 extern int spiavailiabledata(spi_t spidev);
133 extern int spiavailiabledata(spi_t spidev);
134
134
135 #ifdef __cplusplus
135 #ifdef __cplusplus
136 }
136 }
137 #endif
137 #endif
138 #endif //SPI_H
138 #endif //SPI_H
139
139
140
140
141
141
142
142
143
143
144
144
145
145
146
146
147
147
148
148
149
149
150
150
@@ -1,71 +1,71
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #ifndef THREAD_H
22 #ifndef THREAD_H
23 #define THREAD_H
23 #define THREAD_H
24 #include <stdint.h>
24 #include <stdint.h>
25 #include <uhandle.h>
25 #include <uhandle.h>
26 #include <streamdevices.h>
26 #include <streamdevices.h>
27
27
28 #ifdef __cplusplus
28 #ifdef __cplusplus
29 extern "C" {
29 extern "C" {
30 #endif
30 #endif
31
31
32 /*
32 /*
33 This structure holds the thread context. To do so, you need to keep a track of the programm counter,
33 This structure holds the thread context. To do so, you need to keep a track of the programm counter,
34 to change the stack pointer for each thread and to save all registers needing to be saved. Since the
34 to change the stack pointer for each thread and to save all registers needing to be saved. Since the
35 number of regiter to be saved vary from one processor to an other, it's easier to save them in the
35 number of regiter to be saved vary from one processor to an other, it's easier to save them in the
36 owner thread stack;
36 owner thread stack;
37 */
37 */
38 typedef struct thread_t
38 typedef struct thread_t
39 {
39 {
40 int (*func)(void*);
40 int (*func)(void*);
41 void* __stack__;
41 void* __stack__;
42 void* __programmCounter__;
42 void* __programmCounter__;
43 void* __registers__;
43 void* __registers__;
44 }thread_t;
44 }thread_t;
45
45
46
46
47 extern int threadcreate(thread_t* thread,void* stack,int stackSize);
47 extern int threadcreate(thread_t* thread,void* stack,int stackSize);
48 extern int threadstart(thread_t* thread);
48 extern int threadstart(thread_t* thread);
49 extern int threadstop(thread_t* thread);
49 extern int threadstop(thread_t* thread);
50
50
51 #ifdef __THREAD_PRIVATE__
51 #ifdef __THREAD_PRIVATE__
52 extern void __cpusavecontext(void* dataspace);
52 extern void __cpusavecontext(void* dataspace);
53 extern void __cpurestorecontext(void* dataspace);
53 extern void __cpurestorecontext(void* dataspace);
54 #endif
54 #endif
55
55
56 #ifdef __cplusplus
56 #ifdef __cplusplus
57 }
57 }
58 #endif
58 #endif
59 #endif //THREAD_H
59 #endif //THREAD_H
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
@@ -1,126 +1,126
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <core.h>
22 #include <core.h>
23 #include <stdint.h>
23 #include <stdint.h>
24 #include <stdlib.h>
24 #include <stdlib.h>
25 #include <stdio.h>
25 #include <stdio.h>
26 #include <gpio.h>
26 #include <gpio.h>
27 #include <unistd.h>
27 #include <unistd.h>
28
28
29 extern uint32_t OSC0;
29 extern uint32_t OSC0;
30 extern uint32_t INTOSC;
30 extern uint32_t INTOSC;
31 extern uint32_t RTCOSC;
31 extern uint32_t RTCOSC;
32
32
33 volatile uint32_t tickCounter=0;
33 volatile uint32_t tickCounter=0;
34
34
35
35
36 void SysTick_Handler(void)
36 void SysTick_Handler(void)
37 {
37 {
38 tickCounter+=1;
38 tickCounter+=1;
39 // if((tickCounter&0xFFF)==0x800)
39 // if((tickCounter&0xFFF)==0x800)
40 // gpiosetval(PC15,!gpiogetval(PC15));
40 // gpiosetval(PC15,!gpiogetval(PC15));
41 }
41 }
42
42
43 void delay_us(uint32_t value)
43 void delay_us(uint32_t value)
44 {
44 {
45 usleep(value);
45 usleep(value);
46 }
46 }
47
47
48 void delay_100us(uint32_t value)
48 void delay_100us(uint32_t value)
49 {
49 {
50 usleep(value*100);
50 usleep(value*100);
51 }
51 }
52
52
53 uint32_t getAPB1Freq()
53 uint32_t getAPB1Freq()
54 {
54 {
55 return 0;
55 return 0;
56 }
56 }
57
57
58 uint32_t getAPB2Freq()
58 uint32_t getAPB2Freq()
59 {
59 {
60 return 0;
60 return 0;
61 }
61 }
62
62
63
63
64 uint32_t getCpuFreq()
64 uint32_t getCpuFreq()
65 {
65 {
66 return 0;
66 return 0;
67 }
67 }
68
68
69 void reset_AHB1()
69 void reset_AHB1()
70 {
70 {
71 }
71 }
72
72
73 void reset_AHB2()
73 void reset_AHB2()
74 {
74 {
75
75
76 }
76 }
77
77
78 void reset_APB1()
78 void reset_APB1()
79 {
79 {
80
80
81 }
81 }
82
82
83 void reset_APB2()
83 void reset_APB2()
84 {
84 {
85
85
86 }
86 }
87
87
88
88
89
89
90
90
91
91
92 int optimizePLLcfg(uint32_t freq, uint32_t srcfreq,uint32_t PLLM,uint32_t* PLLP, uint32_t* PLLN,uint8_t* AHBPRindx)
92 int optimizePLLcfg(uint32_t freq, uint32_t srcfreq,uint32_t PLLM,uint32_t* PLLP, uint32_t* PLLN,uint8_t* AHBPRindx)
93 {
93 {
94
94
95 return 1;
95 return 1;
96 }
96 }
97
97
98
98
99 int setPll(uint32_t freq)
99 int setPll(uint32_t freq)
100 {
100 {
101
101
102 return freq;
102 return freq;
103 }
103 }
104
104
105 void configureSysTick()
105 void configureSysTick()
106 {
106 {
107
107
108 }
108 }
109
109
110 int setCpuFreq(uint32_t freq)
110 int setCpuFreq(uint32_t freq)
111 {
111 {
112
112
113 return 0;
113 return 0;
114 }
114 }
115
115
116
116
117 void enable_FPU()
117 void enable_FPU()
118 {
118 {
119
119
120 }
120 }
121
121
122
122
123
123
124
124
125
125
126
126
@@ -1,81 +1,81
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23
23
24 #define __THREAD_PRIVATE__
24 #define __THREAD_PRIVATE__
25 #include <thread.h>
25 #include <thread.h>
26
26
27 /*
27 /*
28 For CM4 cf lazy Stacking and context switching form ARM
28 For CM4 cf lazy Stacking and context switching form ARM
29 List of automatically saved registers:
29 List of automatically saved registers:
30 R0
30 R0
31 R1
31 R1
32 R2
32 R2
33 R3
33 R3
34 R4
34 R4
35 R5
35 R5
36 R6
36 R6
37 R7
37 R7
38 R8
38 R8
39 R9
39 R9
40 R10
40 R10
41 R11
41 R11
42 R12
42 R12
43 R13(SP)
43 R13(SP)
44 R14(LR)
44 R14(LR)
45 R15(PC)
45 R15(PC)
46 xPSR
46 xPSR
47 S0 to S15 (if enabled)
47 S0 to S15 (if enabled)
48
48
49 List of registers to save:
49 List of registers to save:
50 S16 to S31
50 S16 to S31
51 */
51 */
52
52
53
53
54 void __cpusavecontext(void* dataspace)
54 void __cpusavecontext(void* dataspace)
55 {
55 {
56
56
57 }
57 }
58
58
59 void __cpurestorecontext(void* dataspace)
59 void __cpurestorecontext(void* dataspace)
60 {
60 {
61
61
62 }
62 }
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
@@ -1,119 +1,119
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <gpio.h>
22 #include <gpio.h>
23
23
24
24
25
25
26 gpio_t gpioopen(uint32_t gpio)
26 gpio_t gpioopen(uint32_t gpio)
27 {
27 {
28 gpio &= -1^GPIOSPEEDMASK;
28 gpio &= -1^GPIOSPEEDMASK;
29 gpio |= gpiolowspeed;
29 gpio |= gpiolowspeed;
30 gpio &= -1^GPIODIRMASK;
30 gpio &= -1^GPIODIRMASK;
31 gpio |= gpioindir;
31 gpio |= gpioindir;
32 gpio &= -1^GPIOOUTTYPEMASK;
32 gpio &= -1^GPIOOUTTYPEMASK;
33 gpio |= gpiopushpulltype;
33 gpio |= gpiopushpulltype;
34 gpio &= -1^GPIOPULLTYPEMASK;
34 gpio &= -1^GPIOPULLTYPEMASK;
35 gpio |= gpionopulltype;
35 gpio |= gpionopulltype;
36 return gpio;
36 return gpio;
37 }
37 }
38
38
39
39
40 void gpioclose(gpio_t gpio)
40 void gpioclose(gpio_t gpio)
41 {
41 {
42 }
42 }
43
43
44 void gpiosetconfig(gpio_t* gpio)
44 void gpiosetconfig(gpio_t* gpio)
45 {
45 {
46 gpiosetdir(gpio, (*gpio & GPIODIRMASK));
46 gpiosetdir(gpio, (*gpio & GPIODIRMASK));
47 gpiosetspeed(gpio, (*gpio & GPIOSPEEDMASK));
47 gpiosetspeed(gpio, (*gpio & GPIOSPEEDMASK));
48 gpiosetouttype(gpio, (*gpio & GPIOOUTTYPEMASK));
48 gpiosetouttype(gpio, (*gpio & GPIOOUTTYPEMASK));
49 gpiosetpulltype(gpio, (*gpio & GPIOPULLTYPEMASK));
49 gpiosetpulltype(gpio, (*gpio & GPIOPULLTYPEMASK));
50 }
50 }
51
51
52 extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed)
52 extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed)
53 {
53 {
54
54
55 }
55 }
56
56
57
57
58 void gpiosetdir(gpio_t* gpio,gpiodir_t dir)
58 void gpiosetdir(gpio_t* gpio,gpiodir_t dir)
59 {
59 {
60
60
61
61
62 }
62 }
63
63
64
64
65 void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype)
65 void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype)
66 {
66 {
67
67
68 }
68 }
69
69
70
70
71 void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype)
71 void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype)
72 {
72 {
73
73
74 }
74 }
75
75
76 void gpioset(gpio_t gpio)
76 void gpioset(gpio_t gpio)
77 {
77 {
78
78
79 }
79 }
80
80
81
81
82 void gpioclr(gpio_t gpio)
82 void gpioclr(gpio_t gpio)
83 {
83 {
84
84
85 }
85 }
86
86
87 void gpiosetval(gpio_t gpio,int val)
87 void gpiosetval(gpio_t gpio,int val)
88 {
88 {
89
89
90 }
90 }
91
91
92 int gpiogetval(gpio_t gpio)
92 int gpiogetval(gpio_t gpio)
93 {
93 {
94 return 0;
94 return 0;
95 }
95 }
96
96
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
104
105
105
106
106
107
107
108
108
109
109
110
110
111
111
112
112
113
113
114
114
115
115
116
116
117
117
118
118
119
119
@@ -1,132 +1,132
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <i2c.h>
23 #include <i2c.h>
24 #include <gpio.h>
24 #include <gpio.h>
25
25
26
26
27 int i2ctimeout=1000*1000;
27 int i2ctimeout=1000*1000;
28
28
29
29
30 i2c_t i2copen(int count)
30 i2c_t i2copen(int count)
31 {
31 {
32 return -1;
32 return -1;
33 }
33 }
34
34
35 i2c_t i2copenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t SDA,uint32_t SCL)
35 i2c_t i2copenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t SDA,uint32_t SCL)
36 {
36 {
37 i2c_t dev = i2copen(count);
37 i2c_t dev = i2copen(count);
38 if(dev!=-1)
38 if(dev!=-1)
39 {
39 {
40 i2cclose(dev);
40 i2cclose(dev);
41 i2csetpins(dev,SDA,SCL);
41 i2csetpins(dev,SDA,SCL);
42 i2copen(count);
42 i2copen(count);
43 i2csetspeed(dev,speed);
43 i2csetspeed(dev,speed);
44 i2cenable(count);
44 i2cenable(count);
45 }
45 }
46 return dev;
46 return dev;
47 }
47 }
48
48
49 int i2cclose(i2c_t dev)
49 int i2cclose(i2c_t dev)
50 {
50 {
51 return 1;
51 return 1;
52 }
52 }
53
53
54 int i2csetpins(i2c_t dev, uint32_t SDA, uint32_t SCL)
54 int i2csetpins(i2c_t dev, uint32_t SDA, uint32_t SCL)
55 {
55 {
56 if((dev<i2c4)&&(dev>=i2c1))
56 if((dev<i2c4)&&(dev>=i2c1))
57 {
57 {
58 return 0;
58 return 0;
59 }
59 }
60 return -1;
60 return -1;
61 }
61 }
62
62
63 int i2cenable(i2c_t dev)
63 int i2cenable(i2c_t dev)
64 {
64 {
65 if((dev<i2c4)&&(dev>=i2c1))
65 if((dev<i2c4)&&(dev>=i2c1))
66 {
66 {
67
67
68 return 0;
68 return 0;
69 }
69 }
70 return -1;
70 return -1;
71 }
71 }
72
72
73 int i2cdisable(i2c_t dev)
73 int i2cdisable(i2c_t dev)
74 {
74 {
75 if((dev<i2c4)&&(dev>=i2c1))
75 if((dev<i2c4)&&(dev>=i2c1))
76 {
76 {
77
77
78 return 0;
78 return 0;
79 }
79 }
80 return -1;
80 return -1;
81 }
81 }
82
82
83
83
84 int i2csetspeed(i2c_t dev,uint32_t speed)
84 int i2csetspeed(i2c_t dev,uint32_t speed)
85 {
85 {
86 if((dev<i2c4)&&(dev>=i2c1))
86 if((dev<i2c4)&&(dev>=i2c1))
87 {
87 {
88 return 0;
88 return 0;
89 }
89 }
90 return -1;
90 return -1;
91 }
91 }
92
92
93 int i2cbusy(i2c_t dev)
93 int i2cbusy(i2c_t dev)
94 {
94 {
95 if((dev<i2c4)&&(dev>=i2c1))
95 if((dev<i2c4)&&(dev>=i2c1))
96 {
96 {
97 return 0; /* Dev isn't busy */
97 return 0; /* Dev isn't busy */
98 }
98 }
99 return -1; /* Error, dev is out of range */
99 return -1; /* Error, dev is out of range */
100 }
100 }
101
101
102 int i2cwrite(i2c_t dev,char address,char* data,int count)
102 int i2cwrite(i2c_t dev,char address,char* data,int count)
103 {
103 {
104 if((dev<i2c4)&&(dev>=i2c1))
104 if((dev<i2c4)&&(dev>=i2c1))
105 {
105 {
106
106
107 return 0;
107 return 0;
108 }
108 }
109 return -1;
109 return -1;
110 }
110 }
111
111
112 int i2cread(i2c_t dev,char address,char* data,int count)
112 int i2cread(i2c_t dev,char address,char* data,int count)
113 {
113 {
114 if((dev<i2c4)&&(dev>=i2c1))
114 if((dev<i2c4)&&(dev>=i2c1))
115 {
115 {
116 return 0;
116 return 0;
117 }
117 }
118 return -1;
118 return -1;
119 }
119 }
120
120
121
121
122 int i2cStatusCheck(i2c_t dev,int32_t flagMask)
122 int i2cStatusCheck(i2c_t dev,int32_t flagMask)
123 {
123 {
124 int32_t flag;
124 int32_t flag;
125 if((dev<i2c4)&&(dev>=i2c1))
125 if((dev<i2c4)&&(dev>=i2c1))
126 {
126 {
127 return 0;
127 return 0;
128 }
128 }
129 return -1;
129 return -1;
130 }
130 }
131
131
132
132
@@ -1,237 +1,304
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <SDL.h>
23 #include <SDL.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include "SDLCD.h"
25 #include "SDLCD.h"
26
26
27 SDL_Surface *screen;
27 SDL_Surface *screen;
28 SDL_Overlay *bmp;
28 SDL_Overlay *bmp;
29
29
30 int SDLCD_Xpos=0;
30 int SDLCD_Xpos=0;
31 int SDLCD_Ypos=0;
31 int SDLCD_Ypos=0;
32 int SDLCD_XWinStrt=0;
32 int SDLCD_XWinStrt=0;
33 int SDLCD_YWinStrt=0;
33 int SDLCD_YWinStrt=0;
34 int SDLCD_XWinEnd=0;
34 int SDLCD_XWinEnd=0;
35 int SDLCD_YWinEnd=0;
35 int SDLCD_YWinEnd=0;
36
36
37 void* SDLCD_buffer;
37 void* SDLCD_buffer;
38 int SDLCD_bpp;
38 int SDLCD_bpp;
39 void SDLCD_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
39 void SDLCD_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
40
40
41 void SDLCD_mkscreen(int resx,int resy,int bpp,int lcdtype)
41 void SDLCD_mkscreen(int resx,int resy,int bpp,int lcdtype)
42 {
42 {
43 int i=0;
43 int i=0;
44 if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)) {
44 if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)) {
45 fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
45 fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
46 exit(1);
46 exit(1);
47 }
47 }
48 screen = SDL_SetVideoMode(resx, resy, bpp, 0);
48 screen = SDL_SetVideoMode(resx, resy, bpp, 0);
49 if(!screen) {
49 if(!screen) {
50 fprintf(stderr, "SDL: could not set video mode - exiting\n");
50 fprintf(stderr, "SDL: could not set video mode - exiting\n");
51 exit(1);
51 exit(1);
52 }
52 }
53 if ( SDL_MUSTLOCK(screen) ) {
53 if ( SDL_MUSTLOCK(screen) ) {
54 if ( SDL_LockSurface(screen) < 0 ) {
54 if ( SDL_LockSurface(screen) < 0 ) {
55 fprintf(stderr, "Can’t lock screen: %s\n", SDL_GetError());
55 fprintf(stderr, "Can’t lock screen: %s\n", SDL_GetError());
56 return;
56 return;
57 }
57 }
58 }
58 }
59 if ( SDL_MUSTLOCK(screen) ) {
59 if ( SDL_MUSTLOCK(screen) ) {
60 SDL_UnlockSurface(screen);
60 SDL_UnlockSurface(screen);
61 }
61 }
62 SDL_UpdateRect(screen, 0, 0, resx, resy);
62 SDL_UpdateRect(screen, 0, 0, resx, resy);
63 SDLCD_buffer = malloc(resx*resy*bpp/8);
63 SDLCD_buffer = malloc(resx*resy*bpp/8);
64 SDLCD_bpp = bpp;
64 SDLCD_bpp = bpp;
65 for(i=0;i<(resx*resy);i++)
65 for(i=0;i<(resx*resy);i++)
66 {
66 {
67 SDLCD_putpixel(screen, i%resx, (i/resx), 0xFFFF);
67 SDLCD_putpixel(screen, i%resx, (i/resx), 0xFFFF);
68 }
68 }
69 }
69 }
70
70
71
71
72
72
73 int SDLCD_init()
73 int SDLCD_init()
74 {
74 {
75
75
76 }
76 }
77
77
78 void SDLCD_writereg(uint32_t reg,uint32_t data)
78 void SDLCD_writereg(uint32_t reg,uint32_t data)
79 {
79 {
80 switch (reg) {
80 switch (reg) {
81 case ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET:
81 case ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET:
82 SDLCD_Xpos = data;
82 SDLCD_Xpos = data;
83 break;
83 break;
84 case ILI9328_REGISTER_VERTICALGRAMADDRESSSET:
84 case ILI9328_REGISTER_VERTICALGRAMADDRESSSET:
85 SDLCD_Ypos = data;
85 SDLCD_Ypos = data;
86 break;
86 break;
87 case ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION:
87 case ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION:
88 SDLCD_XWinStrt = data;
88 SDLCD_XWinStrt = data;
89 break;
89 break;
90 case ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION:
90 case ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION:
91 SDLCD_XWinEnd = data;
91 SDLCD_XWinEnd = data;
92 break;
92 break;
93 case ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION:
93 case ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION:
94 SDLCD_YWinStrt = data;
94 SDLCD_YWinStrt = data;
95 break;
95 break;
96 case ILI9328_REGISTER_VERTICALADDRESSENDPOSITION:
96 case ILI9328_REGISTER_VERTICALADDRESSENDPOSITION:
97 SDLCD_YWinEnd = data;
97 SDLCD_YWinEnd = data;
98 break;
98 break;
99 default:
99 default:
100 break;
100 break;
101 }
101 }
102 }
102 }
103
103
104 uint32_t SDLCD_readreg(uint32_t reg)
104 uint32_t SDLCD_readreg(uint32_t reg)
105 {
105 {
106 return 0;
106 return 0;
107 }
107 }
108
108
109
109
110 void SDLCD_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
110 void SDLCD_putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
111 {
111 {
112 int bpp = surface->format->BytesPerPixel;
112 int bpp = surface->format->BytesPerPixel;
113 /* Here p is the address to the pixel we want to set */
113 /* Here p is the address to the pixel we want to set */
114 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
114 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
115 switch(bpp) {
115 switch(bpp) {
116 case 1:
116 case 1:
117 *p = pixel;
117 *p = pixel;
118 break;
118 break;
119 case 2:
119 case 2:
120 *(Uint16 *)p = pixel;
120 *(Uint16 *)p = pixel;
121 break;
121 break;
122 case 3:
122 case 3:
123 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
123 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
124 p[0] = (pixel >> 16) & 0xff;
124 p[0] = (pixel >> 16) & 0xff;
125 p[1] = (pixel >> 8) & 0xff;
125 p[1] = (pixel >> 8) & 0xff;
126 p[2] = pixel & 0xff;
126 p[2] = pixel & 0xff;
127 } else {
127 } else {
128 p[0] = pixel & 0xff;
128 p[0] = pixel & 0xff;
129 p[1] = (pixel >> 8) & 0xff;
129 p[1] = (pixel >> 8) & 0xff;
130 p[2] = (pixel >> 16) & 0xff;
130 p[2] = (pixel >> 16) & 0xff;
131 }
131 }
132 break;
132 break;
133 case 4:
133 case 4:
134 *(Uint32 *)p = pixel;
134 *(Uint32 *)p = pixel;
135 break;
135 break;
136 }
136 }
137 }
137 }
138
138
139 void SDLCD_putpixel_16bpp(SDL_Surface *surface, int x, int y, Uint32 pixel)
140 {
141 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * surface->format->BytesPerPixel;
142 *(Uint16 *)p = pixel;
143 }
144
145 Uint32 SDLCD_getpixel_16bpp(SDL_Surface *surface, int x, int y)
146 {
147 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * surface->format->BytesPerPixel;
148 return *(Uint16 *)p;
149 }
150
139 Uint32 SDLCD_getpixel(SDL_Surface *surface, int x, int y)
151 Uint32 SDLCD_getpixel(SDL_Surface *surface, int x, int y)
140 {
152 {
141 int bpp = surface->format->BytesPerPixel;
153 int bpp = surface->format->BytesPerPixel;
142 /* Here p is the address to the pixel we want to retrieve */
154 /* Here p is the address to the pixel we want to retrieve */
143 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
155 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
144 switch(bpp) {
156 switch(bpp) {
145 case 1:
157 case 1:
146 return *p;
158 return *p;
147 case 2:
159 case 2:
148 return *(Uint16 *)p;
160 return *(Uint16 *)p;
149 case 3:
161 case 3:
150 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
162 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
151 return p[0] << 16 | p[1] << 8 | p[2];
163 return p[0] << 16 | p[1] << 8 | p[2];
152 else
164 else
153 return p[0] | p[1] << 8 | p[2] << 16;
165 return p[0] | p[1] << 8 | p[2] << 16;
154 case 4:
166 case 4:
155 return *(Uint32 *)p;
167 return *(Uint32 *)p;
156 default:
168 default:
157 return 0;
169 return 0;
158 }
170 }
159 /* shouldn’t happen, but avoids warnings */
171 /* shouldn’t happen, but avoids warnings */
160 }
172 }
161
173
162 void SDLCD_writeGRAM(void* buffer,uint32_t count)
174 void SDLCD_writeGRAM(void* buffer,uint32_t count)
163 {
175 {
164 int i=0;
176 int i=0;
165 u_int16_t* ptr=(u_int16_t*)SDLCD_buffer;
177 u_int16_t* ptr=(u_int16_t*)SDLCD_buffer;
166 u_int16_t* inptr=(u_int16_t*)buffer;
178 u_int16_t* inptr=(u_int16_t*)buffer;
167 if ( SDL_MUSTLOCK(screen) ) {
179 if ( SDL_MUSTLOCK(screen) ) {
168 if ( SDL_LockSurface(screen) < 0 ) {
180 if ( SDL_LockSurface(screen) < 0 ) {
169 fprintf(stderr, "Can’t lock screen: %s\n", SDL_GetError());
181 fprintf(stderr, "Can’t lock screen: %s\n", SDL_GetError());
170 return;
182 return;
171 }
183 }
172 }
184 }
173 for(i=0;i<count;i++)
185 for(i=0;i<count;i++)
174 {
186 {
175 SDLCD_putpixel(screen,SDLCD_Xpos,SDLCD_Ypos,inptr[i]);
187 SDLCD_putpixel_16bpp(screen,SDLCD_Xpos,SDLCD_Ypos,inptr[i]);
176 SDLCD_Xpos+=1;
188 SDLCD_Xpos+=1;
177 ptr[i]=inptr[i];
189 ptr[i]=inptr[i];
178 if(SDLCD_Xpos>=SDLCD_XWinEnd)
190 if(SDLCD_Xpos>=SDLCD_XWinEnd)
179 {
191 {
180 SDLCD_Xpos=SDLCD_XWinStrt;
192 SDLCD_Xpos=SDLCD_XWinStrt;
181 SDLCD_Ypos+=1;
193 SDLCD_Ypos+=1;
182 }
194 }
183 if(SDLCD_Ypos>=SDLCD_YWinEnd)
195 if(SDLCD_Ypos>=SDLCD_YWinEnd)
184 {
196 {
185 SDLCD_Ypos=SDLCD_YWinStrt;
197 SDLCD_Ypos=SDLCD_YWinStrt;
186 }
198 }
187 }
199 }
188 if ( SDL_MUSTLOCK(screen) ) {
200 if ( SDL_MUSTLOCK(screen) ) {
189 SDL_UnlockSurface(screen);
201 SDL_UnlockSurface(screen);
190 }
202 }
203 // SDL_UpdateRect(screen, SDLCD_XWinStrt, SDLCD_YWinStrt, SDLCD_XWinEnd-SDLCD_XWinStrt, SDLCD_YWinEnd-SDLCD_YWinStrt);
191 SDL_UpdateRect(screen, 0, 0, screen->w, screen->h);
204 SDL_UpdateRect(screen, 0, 0, screen->w, screen->h);
192 }
205 }
193
206
207 void SDLCD_writeGRAM_16bpp(void* buffer,uint32_t count)
208 {
209 int i=0;
210 u_int16_t* inptr=(u_int16_t*)buffer;
211 if ( SDL_MUSTLOCK(screen) ) {
212 if ( SDL_LockSurface(screen) < 0 ) {
213 fprintf(stderr, "Can’t lock screen: %s\n", SDL_GetError());
214 return;
215 }
216 }
217 for(i=0;i<count;i++)
218 {
219 *(( Uint16 * ) screen->pixels + SDLCD_Ypos * screen->pitch / 2 + SDLCD_Xpos)=inptr[i];
220 SDLCD_Xpos+=1;
221 if(SDLCD_Xpos>=SDLCD_XWinEnd)
222 {
223 SDLCD_Xpos=SDLCD_XWinStrt;
224 SDLCD_Ypos+=1;
225 }
226 if(SDLCD_Ypos>=SDLCD_YWinEnd)
227 {
228 SDLCD_Ypos=SDLCD_YWinStrt;
229 }
230 }
231 if ( SDL_MUSTLOCK(screen) ) {
232 SDL_UnlockSurface(screen);
233 }
234 // SDL_UpdateRect(screen, SDLCD_XWinStrt, SDLCD_YWinStrt, SDLCD_XWinEnd-SDLCD_XWinStrt, SDLCD_YWinEnd-SDLCD_YWinStrt);
235 SDL_UpdateRect(screen, 0, 0, screen->w, screen->h);
236 }
237
238 void SDLCD_readGRAM_16bpp(void* buffer,uint32_t count)
239 {
240 int i=0;
241 u_int16_t* ptr=(u_int16_t*)SDLCD_buffer;
242 u_int16_t* inptr=(u_int16_t*)buffer;
243 for(i=0;i<count;i++)
244 {
245 inptr[i]=*(( Uint16 * ) screen->pixels + SDLCD_Ypos * screen->pitch / 2 + SDLCD_Xpos);
246 SDLCD_Xpos+=1;
247 ptr[i]=inptr[i];
248 if(SDLCD_Xpos>=SDLCD_XWinEnd)
249 {
250 SDLCD_Xpos=SDLCD_XWinStrt;
251 SDLCD_Ypos+=1;
252 }
253 if(SDLCD_Ypos>=SDLCD_YWinEnd)
254 {
255 SDLCD_Ypos=SDLCD_YWinStrt;
256 }
257 }
258
259 }
260
194 void SDLCD_readGRAM(void* buffer,uint32_t count)
261 void SDLCD_readGRAM(void* buffer,uint32_t count)
195 {
262 {
196 int i=0;
263 int i=0;
197 u_int16_t* ptr=(u_int16_t*)SDLCD_buffer;
264 u_int16_t* ptr=(u_int16_t*)SDLCD_buffer;
198 u_int16_t* inptr=(u_int16_t*)buffer;
265 u_int16_t* inptr=(u_int16_t*)buffer;
199 for(i=0;i<count;i++)
266 for(i=0;i<count;i++)
200 {
267 {
201 inptr[i]=SDLCD_getpixel(screen,SDLCD_Xpos,SDLCD_Ypos);
268 inptr[i]=SDLCD_getpixel_16bpp(screen,SDLCD_Xpos,SDLCD_Ypos);
202 SDLCD_Xpos+=1;
269 SDLCD_Xpos+=1;
203 ptr[i]=inptr[i];
270 ptr[i]=inptr[i];
204 if(SDLCD_Xpos>=SDLCD_XWinEnd)
271 if(SDLCD_Xpos>=SDLCD_XWinEnd)
205 {
272 {
206 SDLCD_Xpos=SDLCD_XWinStrt;
273 SDLCD_Xpos=SDLCD_XWinStrt;
207 SDLCD_Ypos+=1;
274 SDLCD_Ypos+=1;
208 }
275 }
209 if(SDLCD_Ypos>=SDLCD_YWinEnd)
276 if(SDLCD_Ypos>=SDLCD_YWinEnd)
210 {
277 {
211 SDLCD_Ypos=SDLCD_YWinStrt;
278 SDLCD_Ypos=SDLCD_YWinStrt;
212 }
279 }
213 }
280 }
214
281
215 }
282 }
216
283
217
284
218
285
219
286
220
287
221
288
222
289
223
290
224
291
225
292
226
293
227
294
228
295
229
296
230
297
231
298
232
299
233
300
234
301
235
302
236
303
237
304
@@ -1,46 +1,48
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <SDL.h>
23 #include <SDL.h>
24 #include <ili9328.h>
24 #include <ili9328.h>
25 #include <stdint.h>
25 #include <stdint.h>
26
26
27 #define LCDILI9328 9328
27 #define LCDILI9328 9328
28
28
29 extern SDL_Surface *screen;
29 extern SDL_Surface *screen;
30 extern SDL_Overlay *bmp;
30 extern SDL_Overlay *bmp;
31
31
32 extern void SDLCD_mkscreen(int resx,int resy,int bbp,int lcdtype);
32 extern void SDLCD_mkscreen(int resx,int resy,int bbp,int lcdtype);
33 extern int SDLCD_init();
33 extern int SDLCD_init();
34 extern void SDLCD_writereg(uint32_t reg,uint32_t data);
34 extern void SDLCD_writereg(uint32_t reg,uint32_t data);
35 extern uint32_t SDLCD_readreg(uint32_t reg);
35 extern uint32_t SDLCD_readreg(uint32_t reg);
36 extern void SDLCD_writeGRAM(void* buffer,uint32_t count);
36 extern void SDLCD_writeGRAM(void* buffer,uint32_t count);
37 extern void SDLCD_writeGRAM_16bpp(void* buffer,uint32_t count);
37 extern void SDLCD_readGRAM(void* buffer,uint32_t count);
38 extern void SDLCD_readGRAM(void* buffer,uint32_t count);
39 extern void SDLCD_readGRAM_16bpp(void* buffer,uint32_t count);
38
40
39
41
40
42
41
43
42
44
43
45
44
46
45
47
46
48
@@ -1,255 +1,255
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <spi.h>
23 #include <spi.h>
24 #include <gpio.h>
24 #include <gpio.h>
25
25
26
26
27
27
28 spi_t spiopen(int count)
28 spi_t spiopen(int count)
29 {
29 {
30
30
31 return -1;
31 return -1;
32 }
32 }
33
33
34 spi_t spiopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t MOSIpin, uint32_t MISOpin, uint32_t SCKpin, uint32_t SCSpin)
34 spi_t spiopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t MOSIpin, uint32_t MISOpin, uint32_t SCKpin, uint32_t SCSpin)
35 {
35 {
36 spi_t dev = spiopen(count);
36 spi_t dev = spiopen(count);
37 if(dev!=-1)
37 if(dev!=-1)
38 {
38 {
39 spidisable(dev);
39 spidisable(dev);
40 spisetpins(dev,MOSIpin, MISOpin, SCKpin, SCSpin);
40 spisetpins(dev,MOSIpin, MISOpin, SCKpin, SCSpin);
41 spienable(dev);
41 spienable(dev);
42 spisetconfig(dev,cfg,speed);
42 spisetconfig(dev,cfg,speed);
43 }
43 }
44 return dev;
44 return dev;
45 }
45 }
46
46
47
47
48 int spiclose(spi_t spidev)
48 int spiclose(spi_t spidev)
49 {
49 {
50 if((spidev<3)&&(spidev>=0))
50 if((spidev<3)&&(spidev>=0))
51 {
51 {
52
52
53 return 1;
53 return 1;
54 }
54 }
55 return -1;
55 return -1;
56 }
56 }
57
57
58 int spisetpins(spi_t spidev,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin)
58 int spisetpins(spi_t spidev,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin)
59 {
59 {
60 if((spidev<3)&&(spidev>=0))
60 if((spidev<3)&&(spidev>=0))
61 {
61 {
62
62
63 return 1;
63 return 1;
64 }
64 }
65 return -1;
65 return -1;
66 }
66 }
67
67
68
68
69 int spienable(spi_t spidev)
69 int spienable(spi_t spidev)
70 {
70 {
71 if((spidev<3)&&(spidev>=0))
71 if((spidev<3)&&(spidev>=0))
72 {
72 {
73 return 1;
73 return 1;
74 }
74 }
75 return -1;
75 return -1;
76 }
76 }
77
77
78
78
79 int spidisable(spi_t spidev)
79 int spidisable(spi_t spidev)
80 {
80 {
81 if((spidev<3)&&(spidev>=0))
81 if((spidev<3)&&(spidev>=0))
82 {
82 {
83 return 1;
83 return 1;
84 }
84 }
85 return -1;
85 return -1;
86 }
86 }
87
87
88 int spisetconfig(spi_t spidev, uint32_t config, uint32_t speed)
88 int spisetconfig(spi_t spidev, uint32_t config, uint32_t speed)
89 {
89 {
90 if((spidev<3)&&(spidev>=0))
90 if((spidev<3)&&(spidev>=0))
91 {
91 {
92 return 0;
92 return 0;
93 }
93 }
94 return 1;
94 return 1;
95 }
95 }
96
96
97 int spisetspeed(spi_t spidev, uint32_t speed)
97 int spisetspeed(spi_t spidev, uint32_t speed)
98 {
98 {
99 if((spidev<3)&&(spidev>=0))
99 if((spidev<3)&&(spidev>=0))
100 {
100 {
101 return 1;
101 return 1;
102 }
102 }
103 return -1;
103 return -1;
104 }
104 }
105
105
106 uint32_t spigetspeed(spi_t spidev)
106 uint32_t spigetspeed(spi_t spidev)
107 {
107 {
108 if((spidev<3)&&(spidev>=0))
108 if((spidev<3)&&(spidev>=0))
109 {
109 {
110
110
111 return 0;
111 return 0;
112 }
112 }
113 return -1;
113 return -1;
114 }
114 }
115
115
116 int spisetdatabits(spi_t spidev,spibits_t bitscnt)
116 int spisetdatabits(spi_t spidev,spibits_t bitscnt)
117 {
117 {
118 if((spidev<3)&&(spidev>=0))
118 if((spidev<3)&&(spidev>=0))
119 {
119 {
120 return 0;
120 return 0;
121 }
121 }
122 return -1;
122 return -1;
123 }
123 }
124
124
125 int spisetbitorder(spi_t spidev,spibitorder_t order)
125 int spisetbitorder(spi_t spidev,spibitorder_t order)
126 {
126 {
127 if((spidev<3)&&(spidev>=0))
127 if((spidev<3)&&(spidev>=0))
128 {
128 {
129 return 1;
129 return 1;
130 }
130 }
131 return -1;
131 return -1;
132 }
132 }
133
133
134 int spisetclkinhlevel(spi_t spidev,spiclkinhlvl_t level)
134 int spisetclkinhlevel(spi_t spidev,spiclkinhlvl_t level)
135 {
135 {
136 if((spidev<3)&&(spidev>=0))
136 if((spidev<3)&&(spidev>=0))
137 {
137 {
138 return 1;
138 return 1;
139 }
139 }
140 return -1;
140 return -1;
141 }
141 }
142
142
143 int spisetclkphase(spi_t spidev,spiclkphase_t phase)
143 int spisetclkphase(spi_t spidev,spiclkphase_t phase)
144 {
144 {
145 if((spidev<3)&&(spidev>=0))
145 if((spidev<3)&&(spidev>=0))
146 {
146 {
147 return 1;
147 return 1;
148 }
148 }
149 return -1;
149 return -1;
150 }
150 }
151
151
152 int spiputw(spi_t spidev,uint16_t data)
152 int spiputw(spi_t spidev,uint16_t data)
153 {
153 {
154 if((spidev<3)&&(spidev>=0))
154 if((spidev<3)&&(spidev>=0))
155 {
155 {
156 return 0;
156 return 0;
157 }
157 }
158 return -1;
158 return -1;
159 }
159 }
160 uint16_t spigetw(spi_t spidev)
160 uint16_t spigetw(spi_t spidev)
161 {
161 {
162 if((spidev<3)&&(spidev>=0))
162 if((spidev<3)&&(spidev>=0))
163 {
163 {
164 return 0;
164 return 0;
165 }
165 }
166 return -1;
166 return -1;
167 }
167 }
168
168
169 int spiputs(spi_t spidev,char* s)
169 int spiputs(spi_t spidev,char* s)
170 {
170 {
171 while (*s) spiputw(spidev,*s++);
171 while (*s) spiputw(spidev,*s++);
172 return 1;
172 return 1;
173 }
173 }
174
174
175 int spigets(spi_t spidev,char* s)
175 int spigets(spi_t spidev,char* s)
176 {
176 {
177 do
177 do
178 {
178 {
179 (*s) = spigetw(spidev);
179 (*s) = spigetw(spidev);
180 }
180 }
181 while(*s++);
181 while(*s++);
182 return 1;
182 return 1;
183 }
183 }
184
184
185 int spiputnw(spi_t spidev,uint16_t* w,int n)
185 int spiputnw(spi_t spidev,uint16_t* w,int n)
186 {
186 {
187 while(n!=0)
187 while(n!=0)
188 {
188 {
189 spiputw(spidev,*w++);
189 spiputw(spidev,*w++);
190 n--;
190 n--;
191 }
191 }
192 return 1;
192 return 1;
193 }
193 }
194
194
195 int spigetnw(spi_t spidev,uint16_t* w,int n)
195 int spigetnw(spi_t spidev,uint16_t* w,int n)
196 {
196 {
197 while(n!=0)
197 while(n!=0)
198 {
198 {
199 *w++=spigetw(spidev);
199 *w++=spigetw(spidev);
200 n--;
200 n--;
201 }
201 }
202 return 1;
202 return 1;
203 }
203 }
204
204
205 int spiputnc(spi_t spidev,char* c,int n)
205 int spiputnc(spi_t spidev,char* c,int n)
206 {
206 {
207 while(n!=0)
207 while(n!=0)
208 {
208 {
209 spiputw(spidev,*c++);
209 spiputw(spidev,*c++);
210 n--;
210 n--;
211 }
211 }
212 return 1;
212 return 1;
213 }
213 }
214
214
215 int spigetnc(spi_t spidev,char* c,int n)
215 int spigetnc(spi_t spidev,char* c,int n)
216 {
216 {
217 while(n!=0)
217 while(n!=0)
218 {
218 {
219 *c++=spigetw(spidev);
219 *c++=spigetw(spidev);
220 n--;
220 n--;
221 }
221 }
222 return 1;
222 return 1;
223 }
223 }
224
224
225 int spiavailiabledata(spi_t spidev)
225 int spiavailiabledata(spi_t spidev)
226 {
226 {
227 return 0;
227 return 0;
228 }
228 }
229
229
230
230
231 int spitransactionfinished(spi_t spidev)
231 int spitransactionfinished(spi_t spidev)
232 {
232 {
233 if((spidev<3)&&(spidev>=0))
233 if((spidev<3)&&(spidev>=0))
234 {
234 {
235 return 1;
235 return 1;
236 }
236 }
237 return 0;
237 return 0;
238 }
238 }
239
239
240
240
241
241
242
242
243
243
244
244
245
245
246
246
247
247
248
248
249
249
250
250
251
251
252
252
253
253
254
254
255
255
@@ -1,226 +1,226
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <uart.h>
23 #include <uart.h>
24 #include <gpio.h>
24 #include <gpio.h>
25 #include <stdio.h>
25 #include <stdio.h>
26
26
27
27
28
28
29 int _uartstrsetpos(streamdevice* device,int pos);
29 int _uartstrsetpos(streamdevice* device,int pos);
30 int _uartstrread(streamdevice* device,void* data,int size, int n);
30 int _uartstrread(streamdevice* device,void* data,int size, int n);
31 int _uartstrwrite(streamdevice* device,void* data,int size, int n);
31 int _uartstrwrite(streamdevice* device,void* data,int size, int n);
32
32
33 streamdevice_ops UART_OPS=
33 streamdevice_ops UART_OPS=
34 {
34 {
35 .write = &_uartstrwrite,
35 .write = &_uartstrwrite,
36 .read = &_uartstrread,
36 .read = &_uartstrread,
37 .setpos= &_uartstrsetpos,
37 .setpos= &_uartstrsetpos,
38 .close = NULL
38 .close = NULL
39 };
39 };
40
40
41 uart_t uartopen(int count)
41 uart_t uartopen(int count)
42 {
42 {
43 return -1;
43 return -1;
44 }
44 }
45
45
46 uart_t uartopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t TXpin, uint32_t RXpin, uint32_t RTSpin, uint32_t CTSpin)
46 uart_t uartopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t TXpin, uint32_t RXpin, uint32_t RTSpin, uint32_t CTSpin)
47 {
47 {
48 uart_t dev= uartopen(count);
48 uart_t dev= uartopen(count);
49 uartsetconfig(dev,cfg,speed);
49 uartsetconfig(dev,cfg,speed);
50 uartsetpins(dev,TXpin,RXpin,RTSpin,CTSpin);
50 uartsetpins(dev,TXpin,RXpin,RTSpin,CTSpin);
51 return dev;
51 return dev;
52 }
52 }
53
53
54
54
55 int uartclose(uart_t uart)
55 int uartclose(uart_t uart)
56 {
56 {
57 return 1;
57 return 1;
58 }
58 }
59
59
60 int uartsetpins(uart_t uart,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin)
60 int uartsetpins(uart_t uart,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin)
61 {
61 {
62 if(uart >5)return -1;
62 if(uart >5)return -1;
63 if(uart <0)return -1;
63 if(uart <0)return -1;
64 return 1;
64 return 1;
65 }
65 }
66
66
67 int uartsetconfig(uart_t uart, uint32_t cfg, uint32_t speed)
67 int uartsetconfig(uart_t uart, uint32_t cfg, uint32_t speed)
68 {
68 {
69 int res=1;
69 int res=1;
70 uartdisable(uart);
70 uartdisable(uart);
71 uartsetspeed(uart,speed);
71 uartsetspeed(uart,speed);
72 uartsetparity(uart,cfg & UARTPARITYMASK);
72 uartsetparity(uart,cfg & UARTPARITYMASK);
73 uartsetdatabits(uart,cfg & UARTBITSMASK);
73 uartsetdatabits(uart,cfg & UARTBITSMASK);
74 uartsetstopbits(uart,cfg & UARTSTOPBITSMASK);
74 uartsetstopbits(uart,cfg & UARTSTOPBITSMASK);
75 uartenable(uart);
75 uartenable(uart);
76 return res;
76 return res;
77 }
77 }
78
78
79 int uartenable(uart_t uart)
79 int uartenable(uart_t uart)
80 {
80 {
81 if((uart<6)&&(uart>=0))
81 if((uart<6)&&(uart>=0))
82 {
82 {
83 return 1;
83 return 1;
84 }
84 }
85 return -1;
85 return -1;
86 }
86 }
87
87
88 int uartdisable(uart_t uart)
88 int uartdisable(uart_t uart)
89 {
89 {
90 if((uart<6)&&(uart>=0))
90 if((uart<6)&&(uart>=0))
91 {
91 {
92 return 1;
92 return 1;
93 }
93 }
94 return -1;
94 return -1;
95 }
95 }
96
96
97 int uartsetspeed(uart_t uart,uint32_t speed)
97 int uartsetspeed(uart_t uart,uint32_t speed)
98 {
98 {
99 if((uart<6)&&(uart>=0))
99 if((uart<6)&&(uart>=0))
100 {
100 {
101 return 1;
101 return 1;
102 }
102 }
103 return -1;
103 return -1;
104 }
104 }
105
105
106 int uartsetparity(uart_t uart,uartparity_t parity)
106 int uartsetparity(uart_t uart,uartparity_t parity)
107 {
107 {
108 if((uart<6)&&(uart>=0))
108 if((uart<6)&&(uart>=0))
109 {
109 {
110 return 1;
110 return 1;
111 }
111 }
112 return -1;
112 return -1;
113 }
113 }
114
114
115 int uartsetdatabits(uart_t uart,uartbits_t databits)
115 int uartsetdatabits(uart_t uart,uartbits_t databits)
116 {
116 {
117 if((uart<6)&&(uart>=0))
117 if((uart<6)&&(uart>=0))
118 {
118 {
119 return 1;
119 return 1;
120 }
120 }
121 return -1;
121 return -1;
122 }
122 }
123
123
124 int uartsetstopbits(uart_t uart,uartstopbits_t stopbits)
124 int uartsetstopbits(uart_t uart,uartstopbits_t stopbits)
125 {
125 {
126 if((uart<6)&&(uart>=0))
126 if((uart<6)&&(uart>=0))
127 {
127 {
128 return 1;
128 return 1;
129 }
129 }
130 return -1;
130 return -1;
131 }
131 }
132
132
133 int uartputc(uart_t uart,char c)
133 int uartputc(uart_t uart,char c)
134 {
134 {
135 if((uart<6)&&(uart>=0))
135 if((uart<6)&&(uart>=0))
136 {
136 {
137 return 1;
137 return 1;
138 }
138 }
139 return -1;
139 return -1;
140 }
140 }
141
141
142 char uartgetc(uart_t uart)
142 char uartgetc(uart_t uart)
143 {
143 {
144 if((uart<6)&&(uart>=0))
144 if((uart<6)&&(uart>=0))
145 {
145 {
146 return 0;
146 return 0;
147 }
147 }
148 return -1;
148 return -1;
149 }
149 }
150
150
151 int uartputs(uart_t uart,char* s)
151 int uartputs(uart_t uart,char* s)
152 {
152 {
153 while (*s) uartputc(uart,*s++);
153 while (*s) uartputc(uart,*s++);
154 return 1;
154 return 1;
155 }
155 }
156
156
157 int uartgets(uart_t uart,char* s)
157 int uartgets(uart_t uart,char* s)
158 {
158 {
159 do
159 do
160 {
160 {
161 (*s) = uartgetc(uart);
161 (*s) = uartgetc(uart);
162 }
162 }
163 while(*s++);
163 while(*s++);
164 return 1;
164 return 1;
165 }
165 }
166
166
167 int uartputnc(uart_t uart,char* c,int n)
167 int uartputnc(uart_t uart,char* c,int n)
168 {
168 {
169 int l=0;
169 int l=0;
170 while(l<n)
170 while(l<n)
171 {
171 {
172 uartputc(uart,*c++);
172 uartputc(uart,*c++);
173 l++;
173 l++;
174 }
174 }
175 return n;
175 return n;
176 }
176 }
177
177
178 int uartgetnc(uart_t uart,char* c,int n)
178 int uartgetnc(uart_t uart,char* c,int n)
179 {
179 {
180 int l=0;
180 int l=0;
181 while(l<n)
181 while(l<n)
182 {
182 {
183 *c++=uartgetc(uart);
183 *c++=uartgetc(uart);
184 l++;
184 l++;
185 }
185 }
186 return n;
186 return n;
187 }
187 }
188
188
189 int uartavailiabledata(uart_t uart)
189 int uartavailiabledata(uart_t uart)
190 {
190 {
191 if((uart<6)&&(uart>=0))
191 if((uart<6)&&(uart>=0))
192 {
192 {
193 return 1;
193 return 1;
194 }
194 }
195 return -1;
195 return -1;
196 }
196 }
197
197
198
198
199 int _uartstrwrite(streamdevice* device,void* data,int size, int n)
199 int _uartstrwrite(streamdevice* device,void* data,int size, int n)
200 {
200 {
201 return uartputnc((uart_t) device->_stream,(char*) data,size*n);
201 return uartputnc((uart_t) device->_stream,(char*) data,size*n);
202 }
202 }
203
203
204 int _uartstrread(streamdevice* device,void* data,int size, int n)
204 int _uartstrread(streamdevice* device,void* data,int size, int n)
205 {
205 {
206 return uartgetnc((uart_t) device->_stream,(char*) data,size*n);
206 return uartgetnc((uart_t) device->_stream,(char*) data,size*n);
207 }
207 }
208
208
209 int _uartstrsetpos(streamdevice* device,int pos)
209 int _uartstrsetpos(streamdevice* device,int pos)
210 {
210 {
211 return 1;
211 return 1;
212 }
212 }
213
213
214 int uartmkstreamdev(uart_t uart,streamdevice* strdev)
214 int uartmkstreamdev(uart_t uart,streamdevice* strdev)
215 {
215 {
216 strdev->_stream = (UHANDLE)uart;
216 strdev->_stream = (UHANDLE)uart;
217 strdev->ops = &UART_OPS;
217 strdev->ops = &UART_OPS;
218 strdev->streamPt = 0;
218 strdev->streamPt = 0;
219 return 1;
219 return 1;
220 }
220 }
221
221
222
222
223
223
224
224
225
225
226
226
@@ -1,378 +1,378
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <core.h>
22 #include <core.h>
23 #include <stm32f4xx_rcc.h>
23 #include <stm32f4xx_rcc.h>
24 #include <stdint.h>
24 #include <stdint.h>
25 #include <stdlib.h>
25 #include <stdlib.h>
26 #include <stdio.h>
26 #include <stdio.h>
27 #include <core_cm4.h>
27 #include <core_cm4.h>
28 #include <gpio.h>
28 #include <gpio.h>
29
29
30 extern uint32_t OSC0;
30 extern uint32_t OSC0;
31 extern uint32_t INTOSC;
31 extern uint32_t INTOSC;
32 extern uint32_t RTCOSC;
32 extern uint32_t RTCOSC;
33
33
34 volatile uint32_t tickCounter=0;
34 volatile uint32_t tickCounter=0;
35
35
36
36
37 void SysTick_Handler(void)
37 void SysTick_Handler(void)
38 {
38 {
39 tickCounter+=1;
39 tickCounter+=1;
40 if((tickCounter&0xFFF)==0x800)
40 if((tickCounter&0xFFF)==0x800)
41 gpiosetval(PC15,!gpiogetval(PC15));
41 gpiosetval(PC15,!gpiogetval(PC15));
42 }
42 }
43
43
44 void delay_us(uint32_t value)
44 void delay_us(uint32_t value)
45 {
45 {
46 extern uint32_t currentCpuFreq;
46 extern uint32_t currentCpuFreq;
47 if(value)
47 if(value)
48 {
48 {
49 uint32_t tickperus=currentCpuFreq/(1000*10);
49 uint32_t tickperus=currentCpuFreq/(1000*10);
50 uint32_t tickCounterSnap = SysTick->VAL+((value%100)*tickperus);
50 uint32_t tickCounterSnap = SysTick->VAL+((value%100)*tickperus);
51 uint32_t targetVal=tickCounterSnap +(value/100);
51 uint32_t targetVal=tickCounterSnap +(value/100);
52 if(targetVal < tickCounterSnap)
52 if(targetVal < tickCounterSnap)
53 {
53 {
54 while(tickCounter > targetVal);
54 while(tickCounter > targetVal);
55 }
55 }
56 while((tickCounter < targetVal) | (SysTick->VAL<tickCounterSnap));
56 while((tickCounter < targetVal) | (SysTick->VAL<tickCounterSnap));
57 }
57 }
58 }
58 }
59
59
60 void delay_100us(uint32_t value)
60 void delay_100us(uint32_t value)
61 {
61 {
62 if(value)
62 if(value)
63 {
63 {
64 uint32_t tickCounterSnap = tickCounter;
64 uint32_t tickCounterSnap = tickCounter;
65 uint32_t SysTickSnap = SysTick->VAL;
65 uint32_t SysTickSnap = SysTick->VAL;
66 uint32_t targetVal=tickCounterSnap +(value);
66 uint32_t targetVal=tickCounterSnap +(value);
67 if(targetVal < tickCounterSnap)
67 if(targetVal < tickCounterSnap)
68 {
68 {
69 while(tickCounter > targetVal);
69 while(tickCounter > targetVal);
70 }
70 }
71 while((tickCounter < targetVal) | (SysTick->VAL<SysTickSnap));
71 while((tickCounter < targetVal) | (SysTick->VAL<SysTickSnap));
72 }
72 }
73 }
73 }
74
74
75 uint32_t getAPB1Freq()
75 uint32_t getAPB1Freq()
76 {
76 {
77 RCC_ClocksTypeDef RCC_ClocksStatus;
77 RCC_ClocksTypeDef RCC_ClocksStatus;
78 RCC_GetClocksFreq(&RCC_ClocksStatus);
78 RCC_GetClocksFreq(&RCC_ClocksStatus);
79 return RCC_ClocksStatus.PCLK1_Frequency;
79 return RCC_ClocksStatus.PCLK1_Frequency;
80 }
80 }
81
81
82 uint32_t getAPB2Freq()
82 uint32_t getAPB2Freq()
83 {
83 {
84 RCC_ClocksTypeDef RCC_ClocksStatus;
84 RCC_ClocksTypeDef RCC_ClocksStatus;
85 RCC_GetClocksFreq(&RCC_ClocksStatus);
85 RCC_GetClocksFreq(&RCC_ClocksStatus);
86 return RCC_ClocksStatus.PCLK2_Frequency;
86 return RCC_ClocksStatus.PCLK2_Frequency;
87 }
87 }
88
88
89
89
90 uint32_t getCpuFreq()
90 uint32_t getCpuFreq()
91 {
91 {
92 uint32_t cpufreq = OSC0;
92 uint32_t cpufreq = OSC0;
93 uint32_t PLLN,PLLM,PLLP;
93 uint32_t PLLN,PLLM,PLLP;
94
94
95 if((RCC->CFGR & 0xC) == 8) //PLL used as sys clk
95 if((RCC->CFGR & 0xC) == 8) //PLL used as sys clk
96 {
96 {
97 uint32_t pllinput=INTOSC;
97 uint32_t pllinput=INTOSC;
98 if((RCC->PLLCFGR & (1<<22)) == (1<<22))
98 if((RCC->PLLCFGR & (1<<22)) == (1<<22))
99 {
99 {
100 pllinput=OSC0;
100 pllinput=OSC0;
101 }
101 }
102 PLLN = (RCC->PLLCFGR>>6) & 0x1FF;
102 PLLN = (RCC->PLLCFGR>>6) & 0x1FF;
103 PLLM = RCC->PLLCFGR & 0x3F;
103 PLLM = RCC->PLLCFGR & 0x3F;
104 PLLP = 1<<(((RCC->PLLCFGR>>16) & 3 )+1);
104 PLLP = 1<<(((RCC->PLLCFGR>>16) & 3 )+1);
105 cpufreq = (pllinput * PLLN )/(PLLM*PLLP);
105 cpufreq = (pllinput * PLLN )/(PLLM*PLLP);
106 }
106 }
107 else if((RCC->CFGR & 0xC) == 0) //HSI used as sys clk
107 else if((RCC->CFGR & 0xC) == 0) //HSI used as sys clk
108 {
108 {
109 cpufreq=INTOSC;
109 cpufreq=INTOSC;
110 }
110 }
111 if((RCC->CFGR & (1<<7))==1<<7)
111 if((RCC->CFGR & (1<<7))==1<<7)
112 {
112 {
113 return cpufreq>>((RCC->CFGR & (7<<4))>>4);
113 return cpufreq>>((RCC->CFGR & (7<<4))>>4);
114 }
114 }
115 return cpufreq;
115 return cpufreq;
116 }
116 }
117
117
118 void reset_AHB1()
118 void reset_AHB1()
119 {
119 {
120 RCC->AHB1RSTR = -1;
120 RCC->AHB1RSTR = -1;
121 RCC->AHB1RSTR = 0;
121 RCC->AHB1RSTR = 0;
122 }
122 }
123
123
124 void reset_AHB2()
124 void reset_AHB2()
125 {
125 {
126 RCC->AHB2RSTR = -1;
126 RCC->AHB2RSTR = -1;
127 RCC->AHB2RSTR = 0;
127 RCC->AHB2RSTR = 0;
128 }
128 }
129
129
130 void reset_APB1()
130 void reset_APB1()
131 {
131 {
132 RCC->APB1RSTR = -1;
132 RCC->APB1RSTR = -1;
133 RCC->APB1RSTR = 0;
133 RCC->APB1RSTR = 0;
134 }
134 }
135
135
136 void reset_APB2()
136 void reset_APB2()
137 {
137 {
138 RCC->APB2RSTR = -1;
138 RCC->APB2RSTR = -1;
139 RCC->APB2RSTR = 0;
139 RCC->APB2RSTR = 0;
140 }
140 }
141
141
142
142
143
143
144 /*
144 /*
145 | 2.7->3.6V
145 | 2.7->3.6V
146 -------------------------
146 -------------------------
147 0WS | 0<HCLK<=30
147 0WS | 0<HCLK<=30
148 1WS | 30<HCLK<=60
148 1WS | 30<HCLK<=60
149 2WS | 60<HCLK<=90
149 2WS | 60<HCLK<=90
150 3WS | 90<HCLK<=120
150 3WS | 90<HCLK<=120
151 4WS | 120<HCLK<=150
151 4WS | 120<HCLK<=150
152 5WS | 150<HCLK<=168
152 5WS | 150<HCLK<=168
153
153
154 f(VCO clock) = f(PLL clock input) × (PLLN / PLLM) [1]
154 f(VCO clock) = f(PLL clock input) × (PLLN / PLLM) [1]
155 64MHz <= f(VCO clock) <= 432MHz [2]
155 64MHz <= f(VCO clock) <= 432MHz [2]
156
156
157 f(VCO clock input) must be between 1MHz and 2MHz and as close to 2MHz as possible!! [3]
157 f(VCO clock input) must be between 1MHz and 2MHz and as close to 2MHz as possible!! [3]
158
158
159 f(PLL general clock output) = f(VCO clock) / PLLP [4]
159 f(PLL general clock output) = f(VCO clock) / PLLP [4]
160
160
161 CPU<168MHz AHB1<168MHz AHB2<168MHz APB1<42MHz APB2<84MHz [5]
161 CPU<168MHz AHB1<168MHz AHB2<168MHz APB1<42MHz APB2<84MHz [5]
162
162
163 ! 63<=PLLN<=432 [6]
163 ! 63<=PLLN<=432 [6]
164 ! 2<=PLLM<=63 [7]
164 ! 2<=PLLM<=63 [7]
165 ! PLLP=2,4,6,8 [8]
165 ! PLLP=2,4,6,8 [8]
166 4<=PLLM*PLLP<=504
166 4<=PLLM*PLLP<=504
167
167
168 F= f(PLL clock input) * A/B with
168 F= f(PLL clock input) * A/B with
169 63<=A<=432
169 63<=A<=432
170 4<=B<=504
170 4<=B<=504
171
171
172 */
172 */
173
173
174
174
175 int optimizePLLcfg(uint32_t freq, uint32_t srcfreq,uint32_t PLLM,uint32_t* PLLP, uint32_t* PLLN,uint8_t* AHBPRindx)
175 int optimizePLLcfg(uint32_t freq, uint32_t srcfreq,uint32_t PLLM,uint32_t* PLLP, uint32_t* PLLN,uint8_t* AHBPRindx)
176 {
176 {
177 uint32_t AHBPRtbl[9]={1,2,4,8,16,64,128,256,512};
177 uint32_t AHBPRtbl[9]={1,2,4,8,16,64,128,256,512};
178 uint32_t AHBPR=0,AHBPR_r=0,PLLN_r=0,PLLP_r=0;
178 uint32_t AHBPR=0,AHBPR_r=0,PLLN_r=0,PLLP_r=0;
179 uint32_t Fplli=0;
179 uint32_t Fplli=0;
180 int32_t f_error=100000000;
180 int32_t f_error=100000000;
181 int32_t f_errornw=100000000;
181 int32_t f_errornw=100000000;
182 Fplli = srcfreq / PLLM;
182 Fplli = srcfreq / PLLM;
183 //not efficient but should find the best parameters
183 //not efficient but should find the best parameters
184 for((*AHBPRindx)=0;(*AHBPRindx)<9;(*AHBPRindx)++) //lowest priority
184 for((*AHBPRindx)=0;(*AHBPRindx)<9;(*AHBPRindx)++) //lowest priority
185 {
185 {
186 AHBPR = AHBPRtbl[(*AHBPRindx)];
186 AHBPR = AHBPRtbl[(*AHBPRindx)];
187 for(*PLLP=2;*PLLP<9;*PLLP+=2)
187 for(*PLLP=2;*PLLP<9;*PLLP+=2)
188 {
188 {
189 *PLLN = (freq*(*PLLP)*AHBPR)/Fplli;
189 *PLLN = (freq*(*PLLP)*AHBPR)/Fplli;
190 if(((*PLLN)>62) && ((*PLLN)<433) && ((Fplli * (*PLLN)) < 433000000))
190 if(((*PLLN)>62) && ((*PLLN)<433) && ((Fplli * (*PLLN)) < 433000000))
191 {
191 {
192 f_errornw = abs((int32_t)((int32_t)((Fplli*(*PLLN))/((*PLLP)*AHBPR))-freq));
192 f_errornw = abs((int32_t)((int32_t)((Fplli*(*PLLN))/((*PLLP)*AHBPR))-freq));
193 if( ( (f_error)>(f_errornw) ) || ( (*AHBPRindx==0)&&(*PLLP==2)&&(*PLLN==63) ) )
193 if( ( (f_error)>(f_errornw) ) || ( (*AHBPRindx==0)&&(*PLLP==2)&&(*PLLN==63) ) )
194 {
194 {
195 f_error=f_errornw;
195 f_error=f_errornw;
196 PLLN_r = *PLLN;
196 PLLN_r = *PLLN;
197 PLLP_r = *PLLP;
197 PLLP_r = *PLLP;
198 AHBPR_r=*AHBPRindx;
198 AHBPR_r=*AHBPRindx;
199 if(f_error==0)
199 if(f_error==0)
200 {
200 {
201 *PLLN = PLLN_r;
201 *PLLN = PLLN_r;
202 *PLLP = PLLP_r;
202 *PLLP = PLLP_r;
203 *AHBPRindx = AHBPR_r;
203 *AHBPRindx = AHBPR_r;
204 return 1;
204 return 1;
205 }
205 }
206 }
206 }
207 }
207 }
208 }
208 }
209 }
209 }
210 *PLLN = PLLN_r;
210 *PLLN = PLLN_r;
211 *PLLP = PLLP_r;
211 *PLLP = PLLP_r;
212 *AHBPRindx = AHBPR_r;
212 *AHBPRindx = AHBPR_r;
213 return 1;
213 return 1;
214 }
214 }
215
215
216
216
217 int setPll(uint32_t freq)
217 int setPll(uint32_t freq)
218 {
218 {
219 extern uint32_t OSC0;
219 extern uint32_t OSC0;
220 extern uint32_t INTOSC;
220 extern uint32_t INTOSC;
221 uint32_t srcfreq = INTOSC;
221 uint32_t srcfreq = INTOSC;
222 uint8_t AHBPRindx;
222 uint8_t AHBPRindx;
223 uint32_t AHBPRtbl[9]={1,2,4,8,16,64,128,256,512};
223 uint32_t AHBPRtbl[9]={1,2,4,8,16,64,128,256,512};
224 uint32_t PLLN=0,PLLM=0,PLLP=0,AHBPR=0;
224 uint32_t PLLN=0,PLLM=0,PLLP=0,AHBPR=0;
225 uint32_t Fplli=0;
225 uint32_t Fplli=0;
226 if((RCC->PLLCFGR & (1<<22))==(1<<22))
226 if((RCC->PLLCFGR & (1<<22))==(1<<22))
227 {
227 {
228 srcfreq = OSC0;
228 srcfreq = OSC0;
229 }
229 }
230 PLLM = srcfreq / 1500000; // [3]
230 PLLM = srcfreq / 1500000; // [3]
231 Fplli = srcfreq / PLLM;
231 Fplli = srcfreq / PLLM;
232 optimizePLLcfg(freq,srcfreq,PLLM,&PLLP,&PLLN,&AHBPRindx);
232 optimizePLLcfg(freq,srcfreq,PLLM,&PLLP,&PLLN,&AHBPRindx);
233 srcfreq = (Fplli*PLLN)/(PLLP*AHBPRtbl[AHBPRindx]); //Put real clk freq in srcfreq for return value
233 srcfreq = (Fplli*PLLN)/(PLLP*AHBPRtbl[AHBPRindx]); //Put real clk freq in srcfreq for return value
234 //now switch to HSIs
234 //now switch to HSIs
235 if((RCC->CR & 1)==0)RCC->CR |= 1; //turn ON HSI
235 if((RCC->CR & 1)==0)RCC->CR |= 1; //turn ON HSI
236 while((RCC->CR & 2)!=2); //wait for HSI Ready
236 while((RCC->CR & 2)!=2); //wait for HSI Ready
237 RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
237 RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
238 RCC->CFGR |= RCC_CFGR_SW_HSI; //set HSI as main clk
238 RCC->CFGR |= RCC_CFGR_SW_HSI; //set HSI as main clk
239 while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_HSI);
239 while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_HSI);
240 RCC->CR &= ~(1<<24); //Turn OFF PLL
240 RCC->CR &= ~(1<<24); //Turn OFF PLL
241 RCC->PLLCFGR &= ~0x37FFF; //clear PLLP PLLM PLLN
241 RCC->PLLCFGR &= ~0x37FFF; //clear PLLP PLLM PLLN
242 RCC->PLLCFGR |= PLLM + (PLLN<<6) + (((PLLP>>1) -1)<<16);
242 RCC->PLLCFGR |= PLLM + (PLLN<<6) + (((PLLP>>1) -1)<<16);
243 RCC->CR |= RCC_CR_PLLON; //Turn ON PLL
243 RCC->CR |= RCC_CR_PLLON; //Turn ON PLL
244 while((RCC->CR & (1<<25))!=(1<<25)); //wait for PLL Ready
244 while((RCC->CR & (1<<25))!=(1<<25)); //wait for PLL Ready
245 if(AHBPRindx!=0)AHBPRindx|=0x8;
245 if(AHBPRindx!=0)AHBPRindx|=0x8;
246 RCC->CFGR &= ~(0xF<<4);
246 RCC->CFGR &= ~(0xF<<4);
247 RCC->CFGR |= (uint32_t)(AHBPRindx<<4);
247 RCC->CFGR |= (uint32_t)(AHBPRindx<<4);
248 AHBPR=0;
248 AHBPR=0;
249 while((srcfreq>>AHBPR)>42000000)AHBPR++; //[5] //Thune APB1 prescaler to keep APB1 CLK below 42MHz
249 while((srcfreq>>AHBPR)>42000000)AHBPR++; //[5] //Thune APB1 prescaler to keep APB1 CLK below 42MHz
250 if(AHBPR!=0)
250 if(AHBPR!=0)
251 {
251 {
252 AHBPR-=1;
252 AHBPR-=1;
253 AHBPR|=0x4;
253 AHBPR|=0x4;
254 }
254 }
255 RCC->CFGR &= ~(0x7<<10);
255 RCC->CFGR &= ~(0x7<<10);
256 RCC->CFGR |= (uint32_t)(AHBPR<<10);
256 RCC->CFGR |= (uint32_t)(AHBPR<<10);
257 AHBPR=0;
257 AHBPR=0;
258 while((srcfreq>>AHBPR)>84000000)AHBPR++; //[5] //Thune APB2 prescaler to keep APB2 CLK below 42MHz
258 while((srcfreq>>AHBPR)>84000000)AHBPR++; //[5] //Thune APB2 prescaler to keep APB2 CLK below 42MHz
259 if(AHBPR!=0)
259 if(AHBPR!=0)
260 {
260 {
261 AHBPR-=1;
261 AHBPR-=1;
262 AHBPR|=0x4;
262 AHBPR|=0x4;
263 }
263 }
264 RCC->CFGR &= ~(0x7<<13);
264 RCC->CFGR &= ~(0x7<<13);
265 RCC->CFGR |= (uint32_t)(AHBPR<<13);
265 RCC->CFGR |= (uint32_t)(AHBPR<<13);
266 FLASH->ACR |= FLASH_ACR_LATENCY_7WS;
266 FLASH->ACR |= FLASH_ACR_LATENCY_7WS;
267 RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));//Switch to PLL as main clk source
267 RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));//Switch to PLL as main clk source
268 RCC->CFGR |= RCC_CFGR_SW_PLL;
268 RCC->CFGR |= RCC_CFGR_SW_PLL;
269 /* Wait untill the main PLL is used as system clock source */
269 /* Wait untill the main PLL is used as system clock source */
270 while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
270 while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
271 if(srcfreq>150000000)
271 if(srcfreq>150000000)
272 {
272 {
273 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_5WS;
273 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_5WS;
274 }
274 }
275 if((srcfreq<150000000) && (srcfreq>=120000000))
275 if((srcfreq<150000000) && (srcfreq>=120000000))
276 {
276 {
277 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_4WS;
277 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_4WS;
278 }
278 }
279 if((srcfreq<120000000) && (srcfreq>=90000000))
279 if((srcfreq<120000000) && (srcfreq>=90000000))
280 {
280 {
281 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_3WS;
281 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_3WS;
282 }
282 }
283 if((srcfreq<90000000) && (srcfreq>=60000000))
283 if((srcfreq<90000000) && (srcfreq>=60000000))
284 {
284 {
285 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_2WS;
285 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_2WS;
286 }
286 }
287 if((srcfreq<60000000) && (srcfreq>=30000000))
287 if((srcfreq<60000000) && (srcfreq>=30000000))
288 {
288 {
289 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_1WS;
289 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_1WS;
290 }
290 }
291 if(srcfreq<30000000)
291 if(srcfreq<30000000)
292 {
292 {
293 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_0WS;
293 FLASH->ACR &= (~7)|FLASH_ACR_LATENCY_0WS;
294 }
294 }
295 return srcfreq;
295 return srcfreq;
296 }
296 }
297
297
298 void configureSysTick()
298 void configureSysTick()
299 {
299 {
300 extern uint32_t currentCpuFreq;
300 extern uint32_t currentCpuFreq;
301 uint32_t us=currentCpuFreq/(1000*10);
301 uint32_t us=currentCpuFreq/(1000*10);
302 SysTick_Config(us);
302 SysTick_Config(us);
303 }
303 }
304
304
305 int setCpuFreq(uint32_t freq)
305 int setCpuFreq(uint32_t freq)
306 {
306 {
307 extern uint32_t OSC0;
307 extern uint32_t OSC0;
308 extern uint32_t INTOSC;
308 extern uint32_t INTOSC;
309 uint8_t i=0;
309 uint8_t i=0;
310 uint32_t curentFeq = getCpuFreq();
310 uint32_t curentFeq = getCpuFreq();
311 if(curentFeq==freq)return curentFeq;
311 if(curentFeq==freq)return curentFeq;
312 if((freq>2000000) && (freq<=250000000)) //be carefull with 250MHz!!!
312 if((freq>2000000) && (freq<=250000000)) //be carefull with 250MHz!!!
313 {
313 {
314 if((RCC->CFGR & 0xC) == 8) //PLL used as sys clk
314 if((RCC->CFGR & 0xC) == 8) //PLL used as sys clk
315 {
315 {
316 return setPll(freq);
316 return setPll(freq);
317 }
317 }
318 else if((RCC->CFGR & 0xC) == 0) //HSI used as sys clk
318 else if((RCC->CFGR & 0xC) == 0) //HSI used as sys clk
319 {
319 {
320 if((INTOSC%freq)==0) //now check if we can directly divide HSI
320 if((INTOSC%freq)==0) //now check if we can directly divide HSI
321 {
321 {
322 if(freq==INTOSC)
322 if(freq==INTOSC)
323 {
323 {
324 RCC->CFGR &= ~(0xF<<4);
324 RCC->CFGR &= ~(0xF<<4);
325 return freq;
325 return freq;
326 }
326 }
327 for(i=1;i<8;i++)
327 for(i=1;i<8;i++)
328 {
328 {
329 if((freq<<i)==INTOSC)
329 if((freq<<i)==INTOSC)
330 {
330 {
331 RCC->CFGR &= ~(0xF<<4);
331 RCC->CFGR &= ~(0xF<<4);
332 RCC->CFGR |= ((0x8|i)<<4);
332 RCC->CFGR |= ((0x8|i)<<4);
333 return freq;
333 return freq;
334 }
334 }
335 }
335 }
336 }
336 }
337 else
337 else
338 return setPll(freq);
338 return setPll(freq);
339 }
339 }
340 else //HSE used as sys clk
340 else //HSE used as sys clk
341 {
341 {
342 if((OSC0%freq)==0) //now check if we can directly divide HSI
342 if((OSC0%freq)==0) //now check if we can directly divide HSI
343 {
343 {
344 if(freq==OSC0)
344 if(freq==OSC0)
345 {
345 {
346 RCC->CFGR &= ~(0xF<<4);
346 RCC->CFGR &= ~(0xF<<4);
347 return freq;
347 return freq;
348 }
348 }
349 for(i=1;i<8;i++)
349 for(i=1;i<8;i++)
350 {
350 {
351 if((freq<<i)==OSC0)
351 if((freq<<i)==OSC0)
352 {
352 {
353 RCC->CFGR &= ~(0xF<<4);
353 RCC->CFGR &= ~(0xF<<4);
354 RCC->CFGR |= ((0x8|i)<<4);
354 RCC->CFGR |= ((0x8|i)<<4);
355 return freq;
355 return freq;
356 }
356 }
357 }
357 }
358 }
358 }
359 else
359 else
360 return setPll(freq);
360 return setPll(freq);
361 }
361 }
362 }
362 }
363 return 0;
363 return 0;
364 }
364 }
365
365
366
366
367 void enable_FPU()
367 void enable_FPU()
368 {
368 {
369 SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
369 SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
370 __asm__("dsb");
370 __asm__("dsb");
371 __asm__("isb");
371 __asm__("isb");
372 }
372 }
373
373
374
374
375
375
376
376
377
377
378
378
@@ -1,81 +1,81
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23
23
24 #define __THREAD_PRIVATE__
24 #define __THREAD_PRIVATE__
25 #include <thread.h>
25 #include <thread.h>
26
26
27 /*
27 /*
28 For CM4 cf lazy Stacking and context switching form ARM
28 For CM4 cf lazy Stacking and context switching form ARM
29 List of automatically saved registers:
29 List of automatically saved registers:
30 R0
30 R0
31 R1
31 R1
32 R2
32 R2
33 R3
33 R3
34 R4
34 R4
35 R5
35 R5
36 R6
36 R6
37 R7
37 R7
38 R8
38 R8
39 R9
39 R9
40 R10
40 R10
41 R11
41 R11
42 R12
42 R12
43 R13(SP)
43 R13(SP)
44 R14(LR)
44 R14(LR)
45 R15(PC)
45 R15(PC)
46 xPSR
46 xPSR
47 S0 to S15 (if enabled)
47 S0 to S15 (if enabled)
48
48
49 List of registers to save:
49 List of registers to save:
50 S16 to S31
50 S16 to S31
51 */
51 */
52
52
53
53
54 void __cpusavecontext(void* dataspace)
54 void __cpusavecontext(void* dataspace)
55 {
55 {
56
56
57 }
57 }
58
58
59 void __cpurestorecontext(void* dataspace)
59 void __cpurestorecontext(void* dataspace)
60 {
60 {
61
61
62 }
62 }
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
@@ -1,392 +1,392
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include <gpio.h>
22 #include <gpio.h>
23 #include <stm32f4xx_gpio.h>
23 #include <stm32f4xx_gpio.h>
24 #include <stm32f4xx_rcc.h>
24 #include <stm32f4xx_rcc.h>
25
25
26 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
26 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
27 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
27 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
28
28
29
29
30 gpio_t gpioopen(uint32_t gpio)
30 gpio_t gpioopen(uint32_t gpio)
31 {
31 {
32 gpio &= -1^GPIOSPEEDMASK;
32 gpio &= -1^GPIOSPEEDMASK;
33 gpio |= gpiolowspeed;
33 gpio |= gpiolowspeed;
34 gpio &= -1^GPIODIRMASK;
34 gpio &= -1^GPIODIRMASK;
35 gpio |= gpioindir;
35 gpio |= gpioindir;
36 gpio &= -1^GPIOOUTTYPEMASK;
36 gpio &= -1^GPIOOUTTYPEMASK;
37 gpio |= gpiopushpulltype;
37 gpio |= gpiopushpulltype;
38 gpio &= -1^GPIOPULLTYPEMASK;
38 gpio &= -1^GPIOPULLTYPEMASK;
39 gpio |= gpionopulltype;
39 gpio |= gpionopulltype;
40 gpiosetconfig(&gpio);
40 gpiosetconfig(&gpio);
41 RCC_AHB1PeriphClockCmd(((uint32_t)0x00000001<<GPIOPORTNUM(gpio)), ENABLE);
41 RCC_AHB1PeriphClockCmd(((uint32_t)0x00000001<<GPIOPORTNUM(gpio)), ENABLE);
42 return gpio;
42 return gpio;
43 }
43 }
44
44
45
45
46 void gpioclose(gpio_t gpio)
46 void gpioclose(gpio_t gpio)
47 {
47 {
48 }
48 }
49
49
50 void gpiosetconfig(gpio_t* gpio)
50 void gpiosetconfig(gpio_t* gpio)
51 {
51 {
52 gpiosetdir(gpio, (*gpio & GPIODIRMASK));
52 gpiosetdir(gpio, (*gpio & GPIODIRMASK));
53 gpiosetspeed(gpio, (*gpio & GPIOSPEEDMASK));
53 gpiosetspeed(gpio, (*gpio & GPIOSPEEDMASK));
54 gpiosetouttype(gpio, (*gpio & GPIOOUTTYPEMASK));
54 gpiosetouttype(gpio, (*gpio & GPIOOUTTYPEMASK));
55 gpiosetpulltype(gpio, (*gpio & GPIOPULLTYPEMASK));
55 gpiosetpulltype(gpio, (*gpio & GPIOPULLTYPEMASK));
56 }
56 }
57
57
58 extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed)
58 extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed)
59 {
59 {
60 GPIO_TypeDef* GPIOx = GPIOGETPORT((*gpio));
60 GPIO_TypeDef* GPIOx = GPIOGETPORT((*gpio));
61 switch(speed)
61 switch(speed)
62 {
62 {
63 case gpiolowspeed :
63 case gpiolowspeed :
64 if((*gpio & 0xFF)==0xFF)
64 if((*gpio & 0xFF)==0xFF)
65 {
65 {
66 for(int i=0;i<16;i++)
66 for(int i=0;i<16;i++)
67 {
67 {
68 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
68 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
69 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_2MHz) << (i * 2));
69 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_2MHz) << (i * 2));
70 }
70 }
71 }
71 }
72 else
72 else
73 {
73 {
74 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
74 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
75 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_2MHz) << ((*gpio & 0xFF) * 2));
75 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_2MHz) << ((*gpio & 0xFF) * 2));
76 }
76 }
77 *gpio &= ~GPIOSPEEDMASK;
77 *gpio &= ~GPIOSPEEDMASK;
78 *gpio |= gpiolowspeed;
78 *gpio |= gpiolowspeed;
79 break;
79 break;
80 case gpiomediumspeed :
80 case gpiomediumspeed :
81 if((*gpio & 0xFF)==0xFF)
81 if((*gpio & 0xFF)==0xFF)
82 {
82 {
83 for(int i=0;i<16;i++)
83 for(int i=0;i<16;i++)
84 {
84 {
85 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
85 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
86 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_25MHz) << (i * 2));
86 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_25MHz) << (i * 2));
87 }
87 }
88 }
88 }
89 else
89 else
90 {
90 {
91 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
91 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
92 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_25MHz) << ((*gpio & 0xFF) * 2));
92 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_25MHz) << ((*gpio & 0xFF) * 2));
93 }
93 }
94 *gpio &= ~GPIOSPEEDMASK;
94 *gpio &= ~GPIOSPEEDMASK;
95 *gpio |= gpiomediumspeed;
95 *gpio |= gpiomediumspeed;
96 break;
96 break;
97 case gpiofastspeed :
97 case gpiofastspeed :
98 if((*gpio & 0xFF)==0xFF)
98 if((*gpio & 0xFF)==0xFF)
99 {
99 {
100 for(int i=0;i<16;i++)
100 for(int i=0;i<16;i++)
101 {
101 {
102 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
102 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
103 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << (i * 2));
103 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << (i * 2));
104 }
104 }
105 }
105 }
106 else
106 else
107 {
107 {
108 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
108 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
109 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << ((*gpio & 0xFF) * 2));
109 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << ((*gpio & 0xFF) * 2));
110 }
110 }
111 *gpio &= ~GPIOSPEEDMASK;
111 *gpio &= ~GPIOSPEEDMASK;
112 *gpio |= gpiofastspeed;
112 *gpio |= gpiofastspeed;
113 break;
113 break;
114 case gpiohighspeed :
114 case gpiohighspeed :
115 if((*gpio & 0xFF)==0xFF)
115 if((*gpio & 0xFF)==0xFF)
116 {
116 {
117 for(int i=0;i<16;i++)
117 for(int i=0;i<16;i++)
118 {
118 {
119 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
119 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (i * 2));
120 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_100MHz) << (i * 2));
120 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_100MHz) << (i * 2));
121 }
121 }
122 }
122 }
123 else
123 else
124 {
124 {
125 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
125 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << ((*gpio & 0xFF) * 2));
126 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_100MHz) << ((*gpio & 0xFF) * 2));
126 GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_100MHz) << ((*gpio & 0xFF) * 2));
127 }
127 }
128 *gpio &= ~GPIOSPEEDMASK;
128 *gpio &= ~GPIOSPEEDMASK;
129 *gpio |= gpiohighspeed;
129 *gpio |= gpiohighspeed;
130 break;
130 break;
131 }
131 }
132 }
132 }
133
133
134
134
135 void gpiosetdir(gpio_t* gpio,gpiodir_t dir)
135 void gpiosetdir(gpio_t* gpio,gpiodir_t dir)
136 {
136 {
137 GPIO_TypeDef* GPIOx = GPIOGETPORT((*gpio));
137 GPIO_TypeDef* GPIOx = GPIOGETPORT((*gpio));
138 switch(dir)
138 switch(dir)
139 {
139 {
140 case gpiooutdir:
140 case gpiooutdir:
141 if((*gpio & 0xFF)==0xFF)
141 if((*gpio & 0xFF)==0xFF)
142 {
142 {
143 for(int i=0;i<16;i++)
143 for(int i=0;i<16;i++)
144 {
144 {
145 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
145 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
146 GPIOx->MODER |= (GPIO_Mode_OUT << (i * 2));
146 GPIOx->MODER |= (GPIO_Mode_OUT << (i * 2));
147 }
147 }
148 }
148 }
149 else
149 else
150 {
150 {
151 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
151 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
152 GPIOx->MODER |= (GPIO_Mode_OUT << ((*gpio & 0xFF) * 2));
152 GPIOx->MODER |= (GPIO_Mode_OUT << ((*gpio & 0xFF) * 2));
153 }
153 }
154 *gpio &= ~GPIODIRMASK;
154 *gpio &= ~GPIODIRMASK;
155 *gpio |= gpiooutdir;
155 *gpio |= gpiooutdir;
156 break;
156 break;
157 case gpioaf:
157 case gpioaf:
158 if((*gpio & 0xFF)==0xFF)
158 if((*gpio & 0xFF)==0xFF)
159 {
159 {
160 for(int i=0;i<16;i++)
160 for(int i=0;i<16;i++)
161 {
161 {
162 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
162 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
163 GPIOx->MODER |= (GPIO_Mode_AF << (i * 2));
163 GPIOx->MODER |= (GPIO_Mode_AF << (i * 2));
164 }
164 }
165 }
165 }
166 else
166 else
167 {
167 {
168 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
168 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
169 GPIOx->MODER |= (GPIO_Mode_AF << ((*gpio & 0xFF) * 2));
169 GPIOx->MODER |= (GPIO_Mode_AF << ((*gpio & 0xFF) * 2));
170 }
170 }
171 *gpio &= ~GPIODIRMASK;
171 *gpio &= ~GPIODIRMASK;
172 *gpio |= gpioaf;
172 *gpio |= gpioaf;
173 break;
173 break;
174 case gpioan:
174 case gpioan:
175 if((*gpio & 0xFF)==0xFF)
175 if((*gpio & 0xFF)==0xFF)
176 {
176 {
177 for(int i=0;i<16;i++)
177 for(int i=0;i<16;i++)
178 {
178 {
179 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
179 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
180 GPIOx->MODER |= (GPIO_Mode_AN << (i * 2));
180 GPIOx->MODER |= (GPIO_Mode_AN << (i * 2));
181 }
181 }
182 }
182 }
183 else
183 else
184 {
184 {
185 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
185 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
186 GPIOx->MODER |= (GPIO_Mode_AN << ((*gpio & 0xFF) * 2));
186 GPIOx->MODER |= (GPIO_Mode_AN << ((*gpio & 0xFF) * 2));
187 }
187 }
188 *gpio &= ~GPIODIRMASK;
188 *gpio &= ~GPIODIRMASK;
189 *gpio |= gpioan;
189 *gpio |= gpioan;
190 break;
190 break;
191 default :
191 default :
192 if((*gpio & 0xFF)==0xFF)
192 if((*gpio & 0xFF)==0xFF)
193 {
193 {
194 for(int i=0;i<16;i++)
194 for(int i=0;i<16;i++)
195 {
195 {
196 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
196 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (i * 2));
197 GPIOx->MODER |= (GPIO_Mode_IN << (i * 2));
197 GPIOx->MODER |= (GPIO_Mode_IN << (i * 2));
198 }
198 }
199 }
199 }
200 else
200 else
201 {
201 {
202 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
202 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << ((*gpio & 0xFF) * 2));
203 GPIOx->MODER |= (GPIO_Mode_IN << ((*gpio & 0xFF) * 2));
203 GPIOx->MODER |= (GPIO_Mode_IN << ((*gpio & 0xFF) * 2));
204 }
204 }
205 *gpio &= ~GPIODIRMASK;
205 *gpio &= ~GPIODIRMASK;
206 *gpio |= gpioindir;
206 *gpio |= gpioindir;
207 break;
207 break;
208 }
208 }
209
209
210 }
210 }
211
211
212
212
213 void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype)
213 void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype)
214 {
214 {
215 GPIO_TypeDef* GPIOx = GPIOGETPORT((*gpio));
215 GPIO_TypeDef* GPIOx = GPIOGETPORT((*gpio));
216 if(outtype == gpioopendraintype)
216 if(outtype == gpioopendraintype)
217 {
217 {
218 if((*gpio & 0xFF)==0xFF)
218 if((*gpio & 0xFF)==0xFF)
219 {
219 {
220 for(int i=0;i<16;i++)
220 for(int i=0;i<16;i++)
221 {
221 {
222 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)i));
222 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)i));
223 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_OD<<((uint16_t)i));
223 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_OD<<((uint16_t)i));
224 }
224 }
225 }
225 }
226 else
226 else
227 {
227 {
228 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)(*gpio & 0xFF)));
228 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)(*gpio & 0xFF)));
229 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_OD<<((uint16_t)(*gpio & 0xFF)));
229 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_OD<<((uint16_t)(*gpio & 0xFF)));
230 }
230 }
231 *gpio &= ~GPIOOUTTYPEMASK;
231 *gpio &= ~GPIOOUTTYPEMASK;
232 *gpio |= gpioopendraintype;
232 *gpio |= gpioopendraintype;
233 }
233 }
234 else
234 else
235 {
235 {
236 if((*gpio & 0xFF)==0xFF)
236 if((*gpio & 0xFF)==0xFF)
237 {
237 {
238 for(int i=0;i<16;i++)
238 for(int i=0;i<16;i++)
239 {
239 {
240 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)i));
240 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)i));
241 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_PP<<((uint16_t)i));
241 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_PP<<((uint16_t)i));
242 }
242 }
243 }
243 }
244 else
244 else
245 {
245 {
246 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)(*gpio & 0xFF)));
246 GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)(*gpio & 0xFF)));
247 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_PP<<((uint16_t)(*gpio & 0xFF)));
247 GPIOx->OTYPER |= (uint16_t)(GPIO_OType_PP<<((uint16_t)(*gpio & 0xFF)));
248 }
248 }
249 *gpio &= ~GPIOOUTTYPEMASK;
249 *gpio &= ~GPIOOUTTYPEMASK;
250 *gpio |= gpiopushpulltype;
250 *gpio |= gpiopushpulltype;
251 }
251 }
252 }
252 }
253
253
254
254
255 void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype)
255 void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype)
256 {
256 {
257 GPIO_TypeDef* GPIOx = GPIOGETPORT(*gpio);
257 GPIO_TypeDef* GPIOx = GPIOGETPORT(*gpio);
258 switch(pulltype)
258 switch(pulltype)
259 {
259 {
260 case gpiopulluptype:
260 case gpiopulluptype:
261 if((*gpio & 0xFF)==0xFF)
261 if((*gpio & 0xFF)==0xFF)
262 {
262 {
263 for(int i=0;i<16;i++)
263 for(int i=0;i<16;i++)
264 {
264 {
265 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)i * 2));
265 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)i * 2));
266 GPIOx->PUPDR |= (GPIO_PuPd_UP << (i * 2));
266 GPIOx->PUPDR |= (GPIO_PuPd_UP << (i * 2));
267 }
267 }
268 }
268 }
269 else
269 else
270 {
270 {
271 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)(*gpio & 0xFF) * 2));
271 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)(*gpio & 0xFF) * 2));
272 GPIOx->PUPDR |= (GPIO_PuPd_UP << ((*gpio & 0xFF) * 2));
272 GPIOx->PUPDR |= (GPIO_PuPd_UP << ((*gpio & 0xFF) * 2));
273 }
273 }
274 *gpio &= ~GPIOPULLTYPEMASK;
274 *gpio &= ~GPIOPULLTYPEMASK;
275 *gpio |= gpiopulluptype;
275 *gpio |= gpiopulluptype;
276 break;
276 break;
277 case gpiopulldowntype:
277 case gpiopulldowntype:
278 if((*gpio & 0xFF)==0xFF)
278 if((*gpio & 0xFF)==0xFF)
279 {
279 {
280 for(int i=0;i<16;i++)
280 for(int i=0;i<16;i++)
281 {
281 {
282 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)i * 2));
282 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)i * 2));
283 GPIOx->PUPDR |= (GPIO_PuPd_DOWN << (i * 2));
283 GPIOx->PUPDR |= (GPIO_PuPd_DOWN << (i * 2));
284 }
284 }
285 }
285 }
286 else
286 else
287 {
287 {
288 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)(*gpio & 0xFF) * 2));
288 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)(*gpio & 0xFF) * 2));
289 GPIOx->PUPDR |= (GPIO_PuPd_DOWN << ((*gpio & 0xFF) * 2));
289 GPIOx->PUPDR |= (GPIO_PuPd_DOWN << ((*gpio & 0xFF) * 2));
290 }
290 }
291 *gpio &= ~GPIOPULLTYPEMASK;
291 *gpio &= ~GPIOPULLTYPEMASK;
292 *gpio |= gpiopulldowntype;
292 *gpio |= gpiopulldowntype;
293 break;
293 break;
294 default :
294 default :
295 if((*gpio & 0xFF)==0xFF)
295 if((*gpio & 0xFF)==0xFF)
296 {
296 {
297 for(int i=0;i<16;i++)
297 for(int i=0;i<16;i++)
298 {
298 {
299 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)i * 2));
299 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)i * 2));
300 GPIOx->PUPDR |= (GPIO_PuPd_NOPULL << (i * 2));
300 GPIOx->PUPDR |= (GPIO_PuPd_NOPULL << (i * 2));
301 }
301 }
302 }
302 }
303 else
303 else
304 {
304 {
305 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)(*gpio & 0xFF) * 2));
305 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)(*gpio & 0xFF) * 2));
306 GPIOx->PUPDR |= (GPIO_PuPd_NOPULL << ((*gpio & 0xFF) * 2));
306 GPIOx->PUPDR |= (GPIO_PuPd_NOPULL << ((*gpio & 0xFF) * 2));
307 }
307 }
308 *gpio &= ~GPIOPULLTYPEMASK;
308 *gpio &= ~GPIOPULLTYPEMASK;
309 *gpio |= gpionopulltype;
309 *gpio |= gpionopulltype;
310 break;
310 break;
311 }
311 }
312 }
312 }
313
313
314 void gpioset(gpio_t gpio)
314 void gpioset(gpio_t gpio)
315 {
315 {
316 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
316 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
317 if((gpio & 0xFF)==0xFF)
317 if((gpio & 0xFF)==0xFF)
318 {
318 {
319 GPIOx->BSRRL = -1;
319 GPIOx->BSRRL = -1;
320 }
320 }
321 else
321 else
322 {
322 {
323 GPIOx->BSRRL = 1<<(gpio & 0xFF);
323 GPIOx->BSRRL = 1<<(gpio & 0xFF);
324 }
324 }
325 }
325 }
326
326
327
327
328 void gpioclr(gpio_t gpio)
328 void gpioclr(gpio_t gpio)
329 {
329 {
330 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
330 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
331 if((gpio & 0xFF)==0xFF)
331 if((gpio & 0xFF)==0xFF)
332 {
332 {
333 GPIOx->BSRRH = -1;
333 GPIOx->BSRRH = -1;
334 }
334 }
335 else
335 else
336 {
336 {
337 GPIOx->BSRRH = 1<<(gpio & 0xFF);
337 GPIOx->BSRRH = 1<<(gpio & 0xFF);
338 }
338 }
339 }
339 }
340
340
341 void gpiosetval(gpio_t gpio,int val)
341 void gpiosetval(gpio_t gpio,int val)
342 {
342 {
343 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
343 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
344 if((gpio & 0xFF)==0xFF)
344 if((gpio & 0xFF)==0xFF)
345 {
345 {
346 GPIOx->ODR = val;
346 GPIOx->ODR = val;
347 }
347 }
348 else
348 else
349 {
349 {
350 if(val)
350 if(val)
351 GPIOx->BSRRL = 1<<(gpio & 0xFF);
351 GPIOx->BSRRL = 1<<(gpio & 0xFF);
352 else
352 else
353 GPIOx->BSRRH = 1<<(gpio & 0xFF);
353 GPIOx->BSRRH = 1<<(gpio & 0xFF);
354 }
354 }
355 }
355 }
356
356
357 int gpiogetval(gpio_t gpio)
357 int gpiogetval(gpio_t gpio)
358 {
358 {
359 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
359 GPIO_TypeDef* GPIOx = GPIOGETPORT(gpio);
360 if((gpio & 0xFF)==0xFF)
360 if((gpio & 0xFF)==0xFF)
361 {
361 {
362 return GPIOx->IDR;
362 return GPIOx->IDR;
363 }
363 }
364 else
364 else
365 {
365 {
366 return ((GPIOx->IDR>>(gpio & 0xFF)) & 1);
366 return ((GPIOx->IDR>>(gpio & 0xFF)) & 1);
367 }
367 }
368 }
368 }
369
369
370
370
371
371
372
372
373
373
374
374
375
375
376
376
377
377
378
378
379
379
380
380
381
381
382
382
383
383
384
384
385
385
386
386
387
387
388
388
389
389
390
390
391
391
392
392
@@ -1,386 +1,386
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <i2c.h>
23 #include <i2c.h>
24 #include <stm32f4xx_usart.h>
24 #include <stm32f4xx_usart.h>
25 #include <stm32f4xx_rcc.h>
25 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_gpio.h>
27 #include <gpio.h>
27 #include <gpio.h>
28 #include <core.h>
28 #include <core.h>
29
29
30 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
30 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
31 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
31 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
32
32
33 int i2ctimeout=1000*1000;
33 int i2ctimeout=1000*1000;
34
34
35 I2C_TypeDef* _i2c_dev_table[3]={I2C1,I2C2,I2C3};
35 I2C_TypeDef* _i2c_dev_table[3]={I2C1,I2C2,I2C3};
36
36
37 i2c_t i2copen(int count)
37 i2c_t i2copen(int count)
38 {
38 {
39 #define _INIT_DEV(_RCC_) \
39 #define _INIT_DEV(_RCC_) \
40 RCC_APB1PeriphClockCmd(_RCC_, ENABLE); \
40 RCC_APB1PeriphClockCmd(_RCC_, ENABLE); \
41 RCC_APB1PeriphResetCmd(_RCC_, ENABLE); \
41 RCC_APB1PeriphResetCmd(_RCC_, ENABLE); \
42 RCC_APB1PeriphResetCmd(_RCC_, DISABLE);
42 RCC_APB1PeriphResetCmd(_RCC_, DISABLE);
43
43
44 switch(count)
44 switch(count)
45 {
45 {
46 case i2c1:
46 case i2c1:
47 _INIT_DEV(RCC_APB1Periph_I2C1);
47 _INIT_DEV(RCC_APB1Periph_I2C1);
48 return i2c1;
48 return i2c1;
49 break;
49 break;
50 case i2c2:
50 case i2c2:
51 _INIT_DEV(RCC_APB1Periph_I2C2);
51 _INIT_DEV(RCC_APB1Periph_I2C2);
52 return i2c2;
52 return i2c2;
53 break;
53 break;
54 case i2c3:
54 case i2c3:
55 _INIT_DEV(RCC_APB1Periph_I2C3);
55 _INIT_DEV(RCC_APB1Periph_I2C3);
56 return i2c3;
56 return i2c3;
57 break;
57 break;
58 default:
58 default:
59 break;
59 break;
60 }
60 }
61 return -1;
61 return -1;
62 }
62 }
63
63
64 i2c_t i2copenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t SDA,uint32_t SCL)
64 i2c_t i2copenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t SDA,uint32_t SCL)
65 {
65 {
66 i2c_t dev = i2copen(count);
66 i2c_t dev = i2copen(count);
67 if(dev!=-1)
67 if(dev!=-1)
68 {
68 {
69 i2cclose(dev);
69 i2cclose(dev);
70 i2csetpins(dev,SDA,SCL);
70 i2csetpins(dev,SDA,SCL);
71 i2copen(count);
71 i2copen(count);
72 i2csetspeed(dev,speed);
72 i2csetspeed(dev,speed);
73 i2cenable(count);
73 i2cenable(count);
74 }
74 }
75 return dev;
75 return dev;
76 }
76 }
77
77
78 int i2cclose(i2c_t dev)
78 int i2cclose(i2c_t dev)
79 {
79 {
80 switch(dev)
80 switch(dev)
81 {
81 {
82 case i2c1:
82 case i2c1:
83 RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
83 RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
84 break;
84 break;
85 case i2c2:
85 case i2c2:
86 RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
86 RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
87 break;
87 break;
88 case i2c3:
88 case i2c3:
89 RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C3, ENABLE);
89 RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C3, ENABLE);
90 break;
90 break;
91 default:
91 default:
92 break;
92 break;
93 }
93 }
94 return 1;
94 return 1;
95 }
95 }
96
96
97 int i2csetpins(i2c_t dev, uint32_t SDA, uint32_t SCL)
97 int i2csetpins(i2c_t dev, uint32_t SDA, uint32_t SCL)
98 {
98 {
99 if((dev<i2c4)&&(dev>=i2c1))
99 if((dev<i2c4)&&(dev>=i2c1))
100 {
100 {
101 gpio_t SDApin,SCLpin;
101 gpio_t SDApin,SCLpin;
102 SDApin = gpioopen(SDA);
102 SDApin = gpioopen(SDA);
103 SCLpin = gpioopen(SCL);
103 SCLpin = gpioopen(SCL);
104 SDApin |= gpiolowspeed | gpioaf | gpioopendraintype | gpionopulltype;
104 SDApin |= gpiolowspeed | gpioaf | gpioopendraintype | gpionopulltype;
105 SCLpin |= gpiolowspeed | gpiooutdir | gpioopendraintype | gpionopulltype;
105 SCLpin |= gpiolowspeed | gpiooutdir | gpioopendraintype | gpionopulltype;
106 gpiosetconfig(&SCLpin);
106 gpiosetconfig(&SCLpin);
107 for(int i=0;i<32;i++)
107 for(int i=0;i<32;i++)
108 {
108 {
109 gpioclr(SCLpin);
109 gpioclr(SCLpin);
110 for(int l=0;l<200;l++)
110 for(int l=0;l<200;l++)
111 {__asm__("nop");}
111 {__asm__("nop");}
112 gpioset(SCLpin);
112 gpioset(SCLpin);
113 for(int l=0;l<200;l++)
113 for(int l=0;l<200;l++)
114 {__asm__("nop");}
114 {__asm__("nop");}
115 }
115 }
116 SCLpin = gpioopen(SCL);
116 SCLpin = gpioopen(SCL);
117 SCLpin |= gpiolowspeed | gpioaf | gpioopendraintype | gpionopulltype;
117 SCLpin |= gpiolowspeed | gpioaf | gpioopendraintype | gpionopulltype;
118 gpiosetconfig(&SDApin);
118 gpiosetconfig(&SDApin);
119 gpiosetconfig(&SCLpin);
119 gpiosetconfig(&SCLpin);
120 uint8_t gpioAFi2cx = GPIO_AF_I2C1;
120 uint8_t gpioAFi2cx = GPIO_AF_I2C1;
121 switch(dev)
121 switch(dev)
122 {
122 {
123 case i2c1:
123 case i2c1:
124 gpioAFi2cx = GPIO_AF_I2C1;
124 gpioAFi2cx = GPIO_AF_I2C1;
125 break;
125 break;
126 case i2c2:
126 case i2c2:
127 gpioAFi2cx = GPIO_AF_I2C2;
127 gpioAFi2cx = GPIO_AF_I2C2;
128 break;
128 break;
129 case i2c3:
129 case i2c3:
130 gpioAFi2cx = GPIO_AF_I2C3;
130 gpioAFi2cx = GPIO_AF_I2C3;
131 break;
131 break;
132 default:
132 default:
133 break;
133 break;
134 }
134 }
135 GPIO_PinAFConfig(GPIOGETPORT(SDApin), (uint8_t)(SDApin & 0xF), gpioAFi2cx);
135 GPIO_PinAFConfig(GPIOGETPORT(SDApin), (uint8_t)(SDApin & 0xF), gpioAFi2cx);
136 GPIO_PinAFConfig(GPIOGETPORT(SCLpin), (uint8_t)(SCLpin & 0xF), gpioAFi2cx);
136 GPIO_PinAFConfig(GPIOGETPORT(SCLpin), (uint8_t)(SCLpin & 0xF), gpioAFi2cx);
137 return 0;
137 return 0;
138 }
138 }
139 return -1;
139 return -1;
140 }
140 }
141
141
142 int i2cenable(i2c_t dev)
142 int i2cenable(i2c_t dev)
143 {
143 {
144 if((dev<i2c4)&&(dev>=i2c1))
144 if((dev<i2c4)&&(dev>=i2c1))
145 {
145 {
146 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
146 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
147 _dev_->CR1 |=1 ;
147 _dev_->CR1 |=1 ;
148 return 0;
148 return 0;
149 }
149 }
150 return -1;
150 return -1;
151 }
151 }
152
152
153 int i2cdisable(i2c_t dev)
153 int i2cdisable(i2c_t dev)
154 {
154 {
155 if((dev<i2c4)&&(dev>=i2c1))
155 if((dev<i2c4)&&(dev>=i2c1))
156 {
156 {
157 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
157 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
158 _dev_->CR1 &= ~1;
158 _dev_->CR1 &= ~1;
159 return 0;
159 return 0;
160 }
160 }
161 return -1;
161 return -1;
162 }
162 }
163
163
164
164
165 int i2csetspeed(i2c_t dev,uint32_t speed)
165 int i2csetspeed(i2c_t dev,uint32_t speed)
166 {
166 {
167 if((dev<i2c4)&&(dev>=i2c1))
167 if((dev<i2c4)&&(dev>=i2c1))
168 {
168 {
169 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
169 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
170 int32_t APB1Freq=getAPB1Freq()/1000000;
170 int32_t APB1Freq=getAPB1Freq()/1000000;
171 if((APB1Freq>1)&&(APB1Freq<43))
171 if((APB1Freq>1)&&(APB1Freq<43))
172 {
172 {
173
173
174 uint16_t tmpreg=_dev_->CR2;
174 uint16_t tmpreg=_dev_->CR2;
175 tmpreg &= ~(0x1f);
175 tmpreg &= ~(0x1f);
176 tmpreg |= APB1Freq;
176 tmpreg |= APB1Freq;
177 _dev_->CR2=tmpreg;
177 _dev_->CR2=tmpreg;
178 i2cdisable(dev);
178 i2cdisable(dev);
179 tmpreg=_dev_->CCR;
179 tmpreg=_dev_->CCR;
180 APB1Freq=getAPB1Freq();
180 APB1Freq=getAPB1Freq();
181 if(speed>100000) //100kHz= standard mode, 400kHz= fast mode
181 if(speed>100000) //100kHz= standard mode, 400kHz= fast mode
182 {
182 {
183 if(speed<=400000)
183 if(speed<=400000)
184 {
184 {
185 tmpreg |= 1<<15;
185 tmpreg |= 1<<15;
186 tmpreg &= ~(1<<14);
186 tmpreg &= ~(1<<14);
187 tmpreg &= ~(0xfff);
187 tmpreg &= ~(0xfff);
188 tmpreg |= 0xfff & (APB1Freq/(3*speed));
188 tmpreg |= 0xfff & (APB1Freq/(3*speed));
189 }
189 }
190 }
190 }
191 else
191 else
192 {
192 {
193 tmpreg &= ~(1<<15);
193 tmpreg &= ~(1<<15);
194 tmpreg &= ~(0xfff);
194 tmpreg &= ~(0xfff);
195 tmpreg |= 0xfff & (APB1Freq/(2*speed));
195 tmpreg |= 0xfff & (APB1Freq/(2*speed));
196 }
196 }
197 _dev_->CCR=tmpreg;
197 _dev_->CCR=tmpreg;
198 tmpreg=_dev_->TRISE;
198 tmpreg=_dev_->TRISE;
199 tmpreg &= ~(0x3f);
199 tmpreg &= ~(0x3f);
200 tmpreg |= (APB1Freq/1000000)+1;
200 tmpreg |= (APB1Freq/1000000)+1;
201 _dev_->TRISE = tmpreg;
201 _dev_->TRISE = tmpreg;
202 i2cenable(dev);
202 i2cenable(dev);
203 return 0;
203 return 0;
204 }
204 }
205 }
205 }
206 return -1;
206 return -1;
207 }
207 }
208
208
209 int i2cbusy(i2c_t dev)
209 int i2cbusy(i2c_t dev)
210 {
210 {
211 if((dev<i2c4)&&(dev>=i2c1))
211 if((dev<i2c4)&&(dev>=i2c1))
212 {
212 {
213 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
213 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
214 if((_dev_->SR2 & 2) ==2) return 1; /* Dev is busy */
214 if((_dev_->SR2 & 2) ==2) return 1; /* Dev is busy */
215 return 0; /* Dev isn't busy */
215 return 0; /* Dev isn't busy */
216 }
216 }
217 return -1; /* Error, dev is out of range */
217 return -1; /* Error, dev is out of range */
218 }
218 }
219
219
220 int i2cwrite(i2c_t dev,char address,char* data,int count)
220 int i2cwrite(i2c_t dev,char address,char* data,int count)
221 {
221 {
222 if((dev<i2c4)&&(dev>=i2c1))
222 if((dev<i2c4)&&(dev>=i2c1))
223 {
223 {
224 int timeout=i2ctimeout;
224 int timeout=i2ctimeout;
225 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
225 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
226 while(i2cbusy(dev))
226 while(i2cbusy(dev))
227 {
227 {
228 if(0==(timeout--))
228 if(0==(timeout--))
229 {
229 {
230 printf("Exited on timeout @ line %d\n\r",__LINE__);
230 printf("Exited on timeout @ line %d\n\r",__LINE__);
231 return -1;
231 return -1;
232 }
232 }
233 }
233 }
234 _dev_->CR1 |= 1<<8;
234 _dev_->CR1 |= 1<<8;
235 timeout=i2ctimeout;
235 timeout=i2ctimeout;
236 while(!i2cStatusCheck(dev,((uint32_t)0x00030001)))
236 while(!i2cStatusCheck(dev,((uint32_t)0x00030001)))
237 {
237 {
238 if(0==(timeout--))
238 if(0==(timeout--))
239 {
239 {
240 printf("Exited on timeout @ line %d\n\r",__LINE__);
240 printf("Exited on timeout @ line %d\n\r",__LINE__);
241 return -1;
241 return -1;
242 }
242 }
243 }
243 }
244 _dev_->DR= address<<1;
244 _dev_->DR= address<<1;
245 timeout=i2ctimeout;
245 timeout=i2ctimeout;
246 while(!i2cStatusCheck(dev, ((uint32_t)0x00070082)))
246 while(!i2cStatusCheck(dev, ((uint32_t)0x00070082)))
247 {
247 {
248 if(0==(timeout--))
248 if(0==(timeout--))
249 {
249 {
250 printf("Exited on timeout @ line %d\n\r",__LINE__);
250 printf("Exited on timeout @ line %d\n\r",__LINE__);
251 return -1;
251 return -1;
252 }
252 }
253 }
253 }
254 address=_dev_->SR2;
254 address=_dev_->SR2;
255 for(int i=0;i<count;i++)
255 for(int i=0;i<count;i++)
256 {
256 {
257 timeout=i2ctimeout;
257 timeout=i2ctimeout;
258 while(!i2cStatusCheck(dev,((uint32_t)0x00070080)))
258 while(!i2cStatusCheck(dev,((uint32_t)0x00070080)))
259 {
259 {
260 if(0==(timeout--))
260 if(0==(timeout--))
261 {
261 {
262 printf("Exited on timeout @ line %d\n\r",__LINE__);
262 printf("Exited on timeout @ line %d\n\r",__LINE__);
263 return -1;
263 return -1;
264 }
264 }
265 }
265 }
266 _dev_->DR= data[i];
266 _dev_->DR= data[i];
267 }
267 }
268 timeout=i2ctimeout;
268 timeout=i2ctimeout;
269 while(!i2cStatusCheck(dev,1<<7))
269 while(!i2cStatusCheck(dev,1<<7))
270 {
270 {
271 if(0==(timeout--))
271 if(0==(timeout--))
272 {
272 {
273 printf("Exited on timeout @ line %d\n\r",__LINE__);
273 printf("Exited on timeout @ line %d\n\r",__LINE__);
274 return -1;
274 return -1;
275 }
275 }
276 }
276 }
277 timeout=i2ctimeout;
277 timeout=i2ctimeout;
278 while(!i2cStatusCheck(dev,1<<2))
278 while(!i2cStatusCheck(dev,1<<2))
279 {
279 {
280 if(0==(timeout--))
280 if(0==(timeout--))
281 {
281 {
282 printf("Exited on timeout @ line %d\n\r",__LINE__);
282 printf("Exited on timeout @ line %d\n\r",__LINE__);
283 return -1;
283 return -1;
284 }
284 }
285 }
285 }
286 _dev_->CR1 |= 1<<9;
286 _dev_->CR1 |= 1<<9;
287 return count;
287 return count;
288 }
288 }
289 return -1;
289 return -1;
290 }
290 }
291
291
292 int i2cread(i2c_t dev,char address,char* data,int count)
292 int i2cread(i2c_t dev,char address,char* data,int count)
293 {
293 {
294 if((dev<i2c4)&&(dev>=i2c1))
294 if((dev<i2c4)&&(dev>=i2c1))
295 {
295 {
296 int i=0;
296 int i=0;
297 int timeout=i2ctimeout;
297 int timeout=i2ctimeout;
298 while(i2cbusy(dev))
298 while(i2cbusy(dev))
299 {
299 {
300 if(0==(timeout--))
300 if(0==(timeout--))
301 {
301 {
302 printf("Exited on timeout @ line %d\n\r",__LINE__);
302 printf("Exited on timeout @ line %d\n\r",__LINE__);
303 return -1;
303 return -1;
304 }
304 }
305 }
305 }
306 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
306 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
307 _dev_->CR1 |= (1<<8) + (1<<10);
307 _dev_->CR1 |= (1<<8) + (1<<10);
308 timeout=i2ctimeout;
308 timeout=i2ctimeout;
309 while(!i2cStatusCheck(dev,0x00030001))
309 while(!i2cStatusCheck(dev,0x00030001))
310 {
310 {
311 if(0==(timeout--))
311 if(0==(timeout--))
312 {
312 {
313 printf("Exited on timeout @ line %d\n\r",__LINE__);
313 printf("Exited on timeout @ line %d\n\r",__LINE__);
314 return -1;
314 return -1;
315 }
315 }
316 }
316 }
317 _dev_->DR= (address<<1) + 1;
317 _dev_->DR= (address<<1) + 1;
318 while(!i2cStatusCheck(dev,0x000002))
318 while(!i2cStatusCheck(dev,0x000002))
319 {
319 {
320 if(0==(timeout--))
320 if(0==(timeout--))
321 {
321 {
322 printf("Exited on timeout @ line %d\n\r",__LINE__);
322 printf("Exited on timeout @ line %d\n\r",__LINE__);
323 return -1;
323 return -1;
324 }
324 }
325 }
325 }
326 if(count==1)
326 if(count==1)
327 {
327 {
328 _dev_->CR1 &= ~(1<<10);
328 _dev_->CR1 &= ~(1<<10);
329 }
329 }
330 address=_dev_->SR2;
330 address=_dev_->SR2;
331 for(i=0;i<(count-1);i++)
331 for(i=0;i<(count-1);i++)
332 {
332 {
333 timeout=i2ctimeout;
333 timeout=i2ctimeout;
334 while(!i2cStatusCheck(dev,0x0000040))
334 while(!i2cStatusCheck(dev,0x0000040))
335 {
335 {
336 if(0==(timeout--))
336 if(0==(timeout--))
337 {
337 {
338 printf("Exited on timeout @ line %d\n\r",__LINE__);
338 printf("Exited on timeout @ line %d\n\r",__LINE__);
339 return -1;
339 return -1;
340 }
340 }
341 }
341 }
342 data[i]=_dev_->DR;
342 data[i]=_dev_->DR;
343 }
343 }
344 _dev_->CR1 &= ~(1<<10);
344 _dev_->CR1 &= ~(1<<10);
345 _dev_->CR1 |= 1<<9;
345 _dev_->CR1 |= 1<<9;
346 timeout=i2ctimeout;
346 timeout=i2ctimeout;
347 while(!i2cStatusCheck(dev,0x0000040))
347 while(!i2cStatusCheck(dev,0x0000040))
348 {
348 {
349 if(0==(timeout--))
349 if(0==(timeout--))
350 {
350 {
351 printf("Exited on timeout @ line %d\n\r",__LINE__);
351 printf("Exited on timeout @ line %d\n\r",__LINE__);
352 return -1;
352 return -1;
353 }
353 }
354 }
354 }
355 data[i]=_dev_->DR;
355 data[i]=_dev_->DR;
356 timeout=i2ctimeout;
356 timeout=i2ctimeout;
357 while(_dev_->CR1 & ((uint16_t)0x0200))
357 while(_dev_->CR1 & ((uint16_t)0x0200))
358 {
358 {
359 if(0==(timeout--))
359 if(0==(timeout--))
360 {
360 {
361 printf("Exited on timeout @ line %d\n\r",__LINE__);
361 printf("Exited on timeout @ line %d\n\r",__LINE__);
362 return -1;
362 return -1;
363 }
363 }
364 }
364 }
365 _dev_->CR1 |= 1<<10;
365 _dev_->CR1 |= 1<<10;
366 return count;
366 return count;
367 }
367 }
368 return -1;
368 return -1;
369 }
369 }
370
370
371
371
372 int i2cStatusCheck(i2c_t dev,int32_t flagMask)
372 int i2cStatusCheck(i2c_t dev,int32_t flagMask)
373 {
373 {
374 int32_t flag;
374 int32_t flag;
375 if((dev<i2c4)&&(dev>=i2c1))
375 if((dev<i2c4)&&(dev>=i2c1))
376 {
376 {
377 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
377 I2C_TypeDef* _dev_ = _i2c_dev_table[(int)dev];
378 flag= _dev_->SR1 + (_dev_->SR2<<16);
378 flag= _dev_->SR1 + (_dev_->SR2<<16);
379 if(flagMask==(flag & flagMask))
379 if(flagMask==(flag & flagMask))
380 return 1;
380 return 1;
381 return 0;
381 return 0;
382 }
382 }
383 return -1;
383 return -1;
384 }
384 }
385
385
386
386
@@ -1,121 +1,121
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2012, Alexis Jeandet
3 -- Copyright (C) 2012, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <i2c.h>
23 #include <i2c.h>
24 #include <stm32f4xx_usart.h>
24 #include <stm32f4xx_usart.h>
25 #include <stm32f4xx_rcc.h>
25 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_gpio.h>
27 #include <stm32f4xx_sdio.h>
27 #include <stm32f4xx_sdio.h>
28 #include <gpio.h>
28 #include <gpio.h>
29 #include <core.h>
29 #include <core.h>
30 #include <sdcard.h>
30 #include <sdcard.h>
31 #include <sdcard-sdio.h>
31 #include <sdcard-sdio.h>
32
32
33 void sdcardsdiomake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy))
33 void sdcardsdiomake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy))
34 {
34 {
35 sdcard->phy = phy;
35 sdcard->phy = phy;
36 sdcard->rcvr_mmc = rcvr_mmc;
36 sdcard->rcvr_mmc = rcvr_mmc;
37 sdcard->xmit_mmc = xmit_mmc;
37 sdcard->xmit_mmc = xmit_mmc;
38 sdcard->setspeed = setspeed;
38 sdcard->setspeed = setspeed;
39 sdcard->getspeed = getspeed;
39 sdcard->getspeed = getspeed;
40 }
40 }
41
41
42 void sdcardsdiomakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected)
42 void sdcardsdiomakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected)
43 {
43 {
44 dev->phy=sdcard;
44 dev->phy=sdcard;
45 dev->select=select;
45 dev->select=select;
46 dev->power = power;
46 dev->power = power;
47 dev->detect = detect;
47 dev->detect = detect;
48 dev->writeprotected = writeprotected;
48 dev->writeprotected = writeprotected;
49 /*dev->write = sdcarddisk_write;
49 /*dev->write = sdcarddisk_write;
50 dev->read = sdcarddisk_read;
50 dev->read = sdcarddisk_read;
51 dev->ioctl = sdcarddisk_ioctl;
51 dev->ioctl = sdcarddisk_ioctl;
52 dev->initialize = sdcarddisk_initialize;
52 dev->initialize = sdcarddisk_initialize;
53 dev->status = sdcarddisk_status;*/
53 dev->status = sdcarddisk_status;*/
54 }
54 }
55
55
56 int sdcardselect (blkdeviceptr _this)
56 int sdcardselect (blkdeviceptr _this)
57 {
57 {
58
58
59 }
59 }
60
60
61 void sdcarddeselect (blkdeviceptr _this)
61 void sdcarddeselect (blkdeviceptr _this)
62 {
62 {
63
63
64 }
64 }
65
65
66 int sdcardwait_ready (sdcardDev* sdcard)
66 int sdcardwait_ready (sdcardDev* sdcard)
67 {
67 {
68
68
69 }
69 }
70
70
71 int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token)
71 int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token)
72 {
72 {
73
73
74 }
74 }
75
75
76 int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr)
76 int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr)
77 {
77 {
78
78
79 }
79 }
80
80
81 char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg)
81 char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg)
82 {
82 {
83
83
84 }
84 }
85
85
86 DSTATUS sdcarddisk_status (blkdeviceptr _this)
86 DSTATUS sdcarddisk_status (blkdeviceptr _this)
87 {
87 {
88 return RES_OK;
88 return RES_OK;
89 }
89 }
90
90
91 DSTATUS sdcarddisk_initialize (blkdeviceptr _this)
91 DSTATUS sdcarddisk_initialize (blkdeviceptr _this)
92 {
92 {
93 return RES_OK;
93 return RES_OK;
94 }
94 }
95
95
96 DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count)
96 DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count)
97 {
97 {
98 return RES_OK;
98 return RES_OK;
99 }
99 }
100
100
101 DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count)
101 DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count)
102 {
102 {
103
103
104 }
104 }
105
105
106 DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff)
106 DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff)
107 {
107 {
108 return RES_OK;
108 return RES_OK;
109 }
109 }
110
110
111
111
112
112
113
113
114
114
115
115
116
116
117
117
118
118
119
119
120
120
121
121
@@ -1,470 +1,470
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <spi.h>
23 #include <spi.h>
24 #include <stm32f4xx_rcc.h>
24 #include <stm32f4xx_rcc.h>
25 #include <stm32f4xx_gpio.h>
25 #include <stm32f4xx_gpio.h>
26 #include <gpio.h>
26 #include <gpio.h>
27 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
27 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
28 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
28 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
29
29
30
30
31 SPI_TypeDef* _spi_dev_table[3]={SPI1,SPI2,SPI3};
31 SPI_TypeDef* _spi_dev_table[3]={SPI1,SPI2,SPI3};
32
32
33 spi_t spiopen(int count)
33 spi_t spiopen(int count)
34 {
34 {
35 #define _INIT_DEV(_RCC_) \
35 #define _INIT_DEV(_RCC_) \
36 RCC_APB1PeriphClockCmd(_RCC_, ENABLE); \
36 RCC_APB1PeriphClockCmd(_RCC_, ENABLE); \
37 RCC_APB1PeriphResetCmd(_RCC_, ENABLE); \
37 RCC_APB1PeriphResetCmd(_RCC_, ENABLE); \
38 RCC_APB1PeriphResetCmd(_RCC_, DISABLE); \
38 RCC_APB1PeriphResetCmd(_RCC_, DISABLE); \
39 RCC_APB1PeriphClockCmd(_RCC_, ENABLE);
39 RCC_APB1PeriphClockCmd(_RCC_, ENABLE);
40
40
41 switch(count)
41 switch(count)
42 {
42 {
43 case spi1:
43 case spi1:
44 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
44 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
45 RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
45 RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
46 RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
46 RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
47 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
47 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
48 return spi1;
48 return spi1;
49 break;
49 break;
50 case spi2:
50 case spi2:
51 _INIT_DEV(RCC_APB1Periph_SPI2);
51 _INIT_DEV(RCC_APB1Periph_SPI2);
52 return spi2;
52 return spi2;
53 break;
53 break;
54 case spi3:
54 case spi3:
55 _INIT_DEV(RCC_APB1Periph_SPI3);
55 _INIT_DEV(RCC_APB1Periph_SPI3);
56 return spi3;
56 return spi3;
57 break;
57 break;
58 default:
58 default:
59 break;
59 break;
60 }
60 }
61 return -1;
61 return -1;
62 }
62 }
63
63
64 spi_t spiopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t MOSIpin, uint32_t MISOpin, uint32_t SCKpin, uint32_t SCSpin)
64 spi_t spiopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t MOSIpin, uint32_t MISOpin, uint32_t SCKpin, uint32_t SCSpin)
65 {
65 {
66 spi_t dev = spiopen(count);
66 spi_t dev = spiopen(count);
67 if(dev!=-1)
67 if(dev!=-1)
68 {
68 {
69 spidisable(dev);
69 spidisable(dev);
70 spisetpins(dev,MOSIpin, MISOpin, SCKpin, SCSpin);
70 spisetpins(dev,MOSIpin, MISOpin, SCKpin, SCSpin);
71 spienable(dev);
71 spienable(dev);
72 spisetconfig(dev,cfg,speed);
72 spisetconfig(dev,cfg,speed);
73 }
73 }
74 return dev;
74 return dev;
75 }
75 }
76
76
77
77
78 int spiclose(spi_t spidev)
78 int spiclose(spi_t spidev)
79 {
79 {
80 if((spidev<3)&&(spidev>=0))
80 if((spidev<3)&&(spidev>=0))
81 {
81 {
82 switch(spidev)
82 switch(spidev)
83 {
83 {
84 case spi1:
84 case spi1:
85 RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
85 RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
86 break;
86 break;
87 case spi2:
87 case spi2:
88 RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
88 RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
89 break;
89 break;
90 case spi3:
90 case spi3:
91 RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
91 RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
92 break;
92 break;
93 default:
93 default:
94 return -1;
94 return -1;
95 break;
95 break;
96 }
96 }
97 return 1;
97 return 1;
98 }
98 }
99 return -1;
99 return -1;
100 }
100 }
101
101
102 int spisetpins(spi_t spidev,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin)
102 int spisetpins(spi_t spidev,uint32_t MOSIpin,uint32_t MISOpin,uint32_t SCKpin,uint32_t SCSpin)
103 {
103 {
104 if((spidev<3)&&(spidev>=0))
104 if((spidev<3)&&(spidev>=0))
105 {
105 {
106 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
106 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
107 gpio_t MISO,MOSI,SCK,SCS;
107 gpio_t MISO,MOSI,SCK,SCS;
108 uint8_t gpioAFspix = GPIO_AF_SPI1;
108 uint8_t gpioAFspix = GPIO_AF_SPI1;
109 switch(spidev)
109 switch(spidev)
110 {
110 {
111 case spi1:
111 case spi1:
112 gpioAFspix = GPIO_AF_SPI1;
112 gpioAFspix = GPIO_AF_SPI1;
113 break;
113 break;
114 case spi2:
114 case spi2:
115 gpioAFspix = GPIO_AF_SPI2;
115 gpioAFspix = GPIO_AF_SPI2;
116 break;
116 break;
117 case spi3:
117 case spi3:
118 gpioAFspix = GPIO_AF_SPI3;
118 gpioAFspix = GPIO_AF_SPI3;
119 break;
119 break;
120 default:
120 default:
121 break;
121 break;
122 }
122 }
123 if(MISOpin!=-1)
123 if(MISOpin!=-1)
124 {
124 {
125 MISO = gpioopen(MISOpin);
125 MISO = gpioopen(MISOpin);
126 MISO |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
126 MISO |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
127 gpiosetconfig(&MISO);
127 gpiosetconfig(&MISO);
128 GPIO_PinAFConfig(GPIOGETPORT(MISO), (uint8_t)(MISO & 0xF), gpioAFspix);
128 GPIO_PinAFConfig(GPIOGETPORT(MISO), (uint8_t)(MISO & 0xF), gpioAFspix);
129 }
129 }
130 if(MOSIpin!=-1)
130 if(MOSIpin!=-1)
131 {
131 {
132 MOSI = gpioopen(MOSIpin);
132 MOSI = gpioopen(MOSIpin);
133 MOSI |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
133 MOSI |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
134 gpiosetconfig(&MOSI);
134 gpiosetconfig(&MOSI);
135 GPIO_PinAFConfig(GPIOGETPORT(MOSI), (uint8_t)(MOSI & 0xF), gpioAFspix);
135 GPIO_PinAFConfig(GPIOGETPORT(MOSI), (uint8_t)(MOSI & 0xF), gpioAFspix);
136 }
136 }
137
137
138 if(SCKpin!=-1)
138 if(SCKpin!=-1)
139 {
139 {
140 SCK = gpioopen(SCKpin);
140 SCK = gpioopen(SCKpin);
141 SCK |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
141 SCK |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
142 gpiosetconfig(&SCK);
142 gpiosetconfig(&SCK);
143 GPIO_PinAFConfig(GPIOGETPORT(SCK), (uint8_t)(SCK & 0xF), gpioAFspix);
143 GPIO_PinAFConfig(GPIOGETPORT(SCK), (uint8_t)(SCK & 0xF), gpioAFspix);
144 }
144 }
145
145
146 if(SCSpin!=-1)
146 if(SCSpin!=-1)
147 {
147 {
148 SCS = gpioopen(SCSpin);
148 SCS = gpioopen(SCSpin);
149 SCS |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
149 SCS |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype;
150 gpiosetconfig(&SCS);
150 gpiosetconfig(&SCS);
151 GPIO_PinAFConfig(GPIOGETPORT(SCS), (uint8_t)(SCS & 0xF), gpioAFspix);
151 GPIO_PinAFConfig(GPIOGETPORT(SCS), (uint8_t)(SCS & 0xF), gpioAFspix);
152 _dev_->CR2 |= (1<<2);
152 _dev_->CR2 |= (1<<2);
153 }
153 }
154 else
154 else
155 {
155 {
156 _dev_->CR2 &= ~(1<<2);
156 _dev_->CR2 &= ~(1<<2);
157 }
157 }
158 return 1;
158 return 1;
159 }
159 }
160 return -1;
160 return -1;
161 }
161 }
162
162
163
163
164 int spienable(spi_t spidev)
164 int spienable(spi_t spidev)
165 {
165 {
166 if((spidev<3)&&(spidev>=0))
166 if((spidev<3)&&(spidev>=0))
167 {
167 {
168 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
168 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
169 _dev_->CR1 |= (1<<6);
169 _dev_->CR1 |= (1<<6);
170 return 1;
170 return 1;
171 }
171 }
172 return -1;
172 return -1;
173 }
173 }
174
174
175
175
176 int spidisable(spi_t spidev)
176 int spidisable(spi_t spidev)
177 {
177 {
178 if((spidev<3)&&(spidev>=0))
178 if((spidev<3)&&(spidev>=0))
179 {
179 {
180 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
180 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
181 _dev_->CR1 &= ~(1<<6);
181 _dev_->CR1 &= ~(1<<6);
182 return 1;
182 return 1;
183 }
183 }
184 return -1;
184 return -1;
185 }
185 }
186
186
187 int spisetconfig(spi_t spidev, uint32_t config, uint32_t speed)
187 int spisetconfig(spi_t spidev, uint32_t config, uint32_t speed)
188 {
188 {
189 if((spidev<3)&&(spidev>=0))
189 if((spidev<3)&&(spidev>=0))
190 {
190 {
191 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
191 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
192 _dev_->CR2 |= (1<<2);
192 _dev_->CR2 |= (1<<2);
193 _dev_->CR1 |= (1<<2);
193 _dev_->CR1 |= (1<<2);
194 spisetspeed(spidev,speed);
194 spisetspeed(spidev,speed);
195 spisetdatabits(spidev,config & SPIBITSMASK);
195 spisetdatabits(spidev,config & SPIBITSMASK);
196 spisetbitorder(spidev,config & SPIBITORDERMASK);
196 spisetbitorder(spidev,config & SPIBITORDERMASK);
197 spisetclkinhlevel(spidev,config & SPICLKINHLVLMASK);
197 spisetclkinhlevel(spidev,config & SPICLKINHLVLMASK);
198 spisetclkphase(spidev,config & SPICLKPHASEMASK);
198 spisetclkphase(spidev,config & SPICLKPHASEMASK);
199 return 0;
199 return 0;
200 }
200 }
201 return 1;
201 return 1;
202 }
202 }
203
203
204 int spisetspeed(spi_t spidev, uint32_t speed)
204 int spisetspeed(spi_t spidev, uint32_t speed)
205 {
205 {
206 if((spidev<3)&&(spidev>=0))
206 if((spidev<3)&&(spidev>=0))
207 {
207 {
208 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
208 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
209 uint32_t apbclock = 0x00;
209 uint32_t apbclock = 0x00;
210 RCC_ClocksTypeDef RCC_ClocksStatus;
210 RCC_ClocksTypeDef RCC_ClocksStatus;
211 RCC_GetClocksFreq(&RCC_ClocksStatus);
211 RCC_GetClocksFreq(&RCC_ClocksStatus);
212 if (_dev_ == SPI1)
212 if (_dev_ == SPI1)
213 {
213 {
214 apbclock = RCC_ClocksStatus.PCLK2_Frequency;
214 apbclock = RCC_ClocksStatus.PCLK2_Frequency;
215 }
215 }
216 else
216 else
217 {
217 {
218 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
218 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
219 }
219 }
220 int32_t speederror = 0x7FFFFFFF; //max error
220 int32_t speederror = 0x7FFFFFFF; //max error
221 int32_t prev_speederror = 0x7FFFFFFF;
221 int32_t prev_speederror = 0x7FFFFFFF;
222 int32_t realspeed = 0;
222 int32_t realspeed = 0;
223 unsigned char divider = 0;
223 unsigned char divider = 0;
224 do
224 do
225 {
225 {
226 divider ++;
226 divider ++;
227 prev_speederror = speederror;
227 prev_speederror = speederror;
228 realspeed = apbclock>>(divider);
228 realspeed = apbclock>>(divider);
229 speederror = realspeed - speed;
229 speederror = realspeed - speed;
230 if(speederror<0)speederror=-speederror;
230 if(speederror<0)speederror=-speederror;
231 if(divider>8)break;
231 if(divider>8)break;
232 }while(speederror<prev_speederror);
232 }while(speederror<prev_speederror);
233 speed = apbclock>>(divider-1);
233 speed = apbclock>>(divider-1);
234 divider-=2;
234 divider-=2;
235 _dev_->CR1 &= 0xFFD7; // clear prescaler bits 3:5
235 _dev_->CR1 &= 0xFFD7; // clear prescaler bits 3:5
236 _dev_->CR1 |= ((0x7 & divider)<<3);
236 _dev_->CR1 |= ((0x7 & divider)<<3);
237 return 1;
237 return 1;
238 }
238 }
239 return -1;
239 return -1;
240 }
240 }
241
241
242 uint32_t spigetspeed(spi_t spidev)
242 uint32_t spigetspeed(spi_t spidev)
243 {
243 {
244 if((spidev<3)&&(spidev>=0))
244 if((spidev<3)&&(spidev>=0))
245 {
245 {
246 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
246 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
247 uint32_t apbclock = 0x00;
247 uint32_t apbclock = 0x00;
248 RCC_ClocksTypeDef RCC_ClocksStatus;
248 RCC_ClocksTypeDef RCC_ClocksStatus;
249 RCC_GetClocksFreq(&RCC_ClocksStatus);
249 RCC_GetClocksFreq(&RCC_ClocksStatus);
250 if (_dev_ == SPI1)
250 if (_dev_ == SPI1)
251 {
251 {
252 apbclock = RCC_ClocksStatus.PCLK2_Frequency;
252 apbclock = RCC_ClocksStatus.PCLK2_Frequency;
253 }
253 }
254 else
254 else
255 {
255 {
256 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
256 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
257 }
257 }
258 int BR= (_dev_->CR1>>3)&0x7;
258 int BR= (_dev_->CR1>>3)&0x7;
259 return apbclock>>(BR+1);
259 return apbclock>>(BR+1);
260 }
260 }
261 return -1;
261 return -1;
262 }
262 }
263
263
264 int spisetdatabits(spi_t spidev,spibits_t bitscnt)
264 int spisetdatabits(spi_t spidev,spibits_t bitscnt)
265 {
265 {
266 if((spidev<3)&&(spidev>=0))
266 if((spidev<3)&&(spidev>=0))
267 {
267 {
268 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
268 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
269 int result = 0;
269 int result = 0;
270 switch(bitscnt)
270 switch(bitscnt)
271 {
271 {
272 case spi8bits:
272 case spi8bits:
273 _dev_->CR1 &= ~(1<<11);
273 _dev_->CR1 &= ~(1<<11);
274 result = 1;
274 result = 1;
275 break;
275 break;
276 case spi16bits:
276 case spi16bits:
277 _dev_->CR1 |= (1<<11);
277 _dev_->CR1 |= (1<<11);
278 result = 1;
278 result = 1;
279 break;
279 break;
280 default:
280 default:
281 result =-1;
281 result =-1;
282 break;
282 break;
283 }
283 }
284 return result;
284 return result;
285 }
285 }
286 return -1;
286 return -1;
287 }
287 }
288
288
289 int spisetbitorder(spi_t spidev,spibitorder_t order)
289 int spisetbitorder(spi_t spidev,spibitorder_t order)
290 {
290 {
291 if((spidev<3)&&(spidev>=0))
291 if((spidev<3)&&(spidev>=0))
292 {
292 {
293 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
293 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
294 if(order==spimsbfirst)
294 if(order==spimsbfirst)
295 {
295 {
296 _dev_->CR1 &= ~(1<<7);
296 _dev_->CR1 &= ~(1<<7);
297 return 1;
297 return 1;
298 }
298 }
299 else
299 else
300 {
300 {
301 if(order==spilsbfirst)
301 if(order==spilsbfirst)
302 {
302 {
303 _dev_->CR1 |= (1<<7);
303 _dev_->CR1 |= (1<<7);
304 return 1;
304 return 1;
305 }
305 }
306 else return -1;
306 else return -1;
307 }
307 }
308 }
308 }
309 return -1;
309 return -1;
310 }
310 }
311
311
312 int spisetclkinhlevel(spi_t spidev,spiclkinhlvl_t level)
312 int spisetclkinhlevel(spi_t spidev,spiclkinhlvl_t level)
313 {
313 {
314 if((spidev<3)&&(spidev>=0))
314 if((spidev<3)&&(spidev>=0))
315 {
315 {
316 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
316 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
317 if(level==spiclkinhlow)
317 if(level==spiclkinhlow)
318 {
318 {
319 _dev_->CR1 &= ~(1<<1);
319 _dev_->CR1 &= ~(1<<1);
320 return 1;
320 return 1;
321 }
321 }
322 else
322 else
323 {
323 {
324 if(level==spiclkinhhigh)
324 if(level==spiclkinhhigh)
325 {
325 {
326 _dev_->CR1 |= (1<<1);
326 _dev_->CR1 |= (1<<1);
327 return 1;
327 return 1;
328 }
328 }
329 else return -1;
329 else return -1;
330 }
330 }
331 }
331 }
332 return -1;
332 return -1;
333 }
333 }
334
334
335 int spisetclkphase(spi_t spidev,spiclkphase_t phase)
335 int spisetclkphase(spi_t spidev,spiclkphase_t phase)
336 {
336 {
337 if((spidev<3)&&(spidev>=0))
337 if((spidev<3)&&(spidev>=0))
338 {
338 {
339 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
339 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
340 if(phase==spiclkfirstedge)
340 if(phase==spiclkfirstedge)
341 {
341 {
342 _dev_->CR1 &= ~1;
342 _dev_->CR1 &= ~1;
343 return 1;
343 return 1;
344 }
344 }
345 else
345 else
346 {
346 {
347 if(phase==spiclksecondedge)
347 if(phase==spiclksecondedge)
348 {
348 {
349 _dev_->CR1 |= 1;
349 _dev_->CR1 |= 1;
350 return 1;
350 return 1;
351 }
351 }
352 else return -1;
352 else return -1;
353 }
353 }
354 }
354 }
355 return -1;
355 return -1;
356 }
356 }
357
357
358 int spiputw(spi_t spidev,uint16_t data)
358 int spiputw(spi_t spidev,uint16_t data)
359 {
359 {
360 if((spidev<3)&&(spidev>=0))
360 if((spidev<3)&&(spidev>=0))
361 {
361 {
362 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
362 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
363 while(((_dev_->SR & (1<<1)) == 0) );
363 while(((_dev_->SR & (1<<1)) == 0) );
364 _dev_->DR = data;
364 _dev_->DR = data;
365 while(((_dev_->SR & (1<<0)) == 0) );
365 while(((_dev_->SR & (1<<0)) == 0) );
366 return _dev_->DR;
366 return _dev_->DR;
367 }
367 }
368 return -1;
368 return -1;
369 }
369 }
370 uint16_t spigetw(spi_t spidev)
370 uint16_t spigetw(spi_t spidev)
371 {
371 {
372 if((spidev<3)&&(spidev>=0))
372 if((spidev<3)&&(spidev>=0))
373 {
373 {
374 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
374 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
375 while(((_dev_->SR & (1<<1)) == 0) );
375 while(((_dev_->SR & (1<<1)) == 0) );
376 _dev_->DR = 0xFFFF;
376 _dev_->DR = 0xFFFF;
377 while(((_dev_->SR & (1<<0)) == 0) );
377 while(((_dev_->SR & (1<<0)) == 0) );
378 return _dev_->DR;
378 return _dev_->DR;
379 }
379 }
380 return -1;
380 return -1;
381 }
381 }
382
382
383 int spiputs(spi_t spidev,char* s)
383 int spiputs(spi_t spidev,char* s)
384 {
384 {
385 while (*s) spiputw(spidev,*s++);
385 while (*s) spiputw(spidev,*s++);
386 return 1;
386 return 1;
387 }
387 }
388
388
389 int spigets(spi_t spidev,char* s)
389 int spigets(spi_t spidev,char* s)
390 {
390 {
391 do
391 do
392 {
392 {
393 (*s) = spigetw(spidev);
393 (*s) = spigetw(spidev);
394 }
394 }
395 while(*s++);
395 while(*s++);
396 return 1;
396 return 1;
397 }
397 }
398
398
399 int spiputnw(spi_t spidev,uint16_t* w,int n)
399 int spiputnw(spi_t spidev,uint16_t* w,int n)
400 {
400 {
401 while(n!=0)
401 while(n!=0)
402 {
402 {
403 spiputw(spidev,*w++);
403 spiputw(spidev,*w++);
404 n--;
404 n--;
405 }
405 }
406 return 1;
406 return 1;
407 }
407 }
408
408
409 int spigetnw(spi_t spidev,uint16_t* w,int n)
409 int spigetnw(spi_t spidev,uint16_t* w,int n)
410 {
410 {
411 while(n!=0)
411 while(n!=0)
412 {
412 {
413 *w++=spigetw(spidev);
413 *w++=spigetw(spidev);
414 n--;
414 n--;
415 }
415 }
416 return 1;
416 return 1;
417 }
417 }
418
418
419 int spiputnc(spi_t spidev,char* c,int n)
419 int spiputnc(spi_t spidev,char* c,int n)
420 {
420 {
421 while(n!=0)
421 while(n!=0)
422 {
422 {
423 spiputw(spidev,*c++);
423 spiputw(spidev,*c++);
424 n--;
424 n--;
425 }
425 }
426 return 1;
426 return 1;
427 }
427 }
428
428
429 int spigetnc(spi_t spidev,char* c,int n)
429 int spigetnc(spi_t spidev,char* c,int n)
430 {
430 {
431 while(n!=0)
431 while(n!=0)
432 {
432 {
433 *c++=spigetw(spidev);
433 *c++=spigetw(spidev);
434 n--;
434 n--;
435 }
435 }
436 return 1;
436 return 1;
437 }
437 }
438
438
439 int spiavailiabledata(spi_t spidev)
439 int spiavailiabledata(spi_t spidev)
440 {
440 {
441 return 0;
441 return 0;
442 }
442 }
443
443
444
444
445 int spitransactionfinished(spi_t spidev)
445 int spitransactionfinished(spi_t spidev)
446 {
446 {
447 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
447 SPI_TypeDef* _dev_ = _spi_dev_table[(int)spidev];
448 if((spidev<3)&&(spidev>=0))
448 if((spidev<3)&&(spidev>=0))
449 {
449 {
450 if((_dev_->SR & (1<<7)) == (1<<7))return 1;
450 if((_dev_->SR & (1<<7)) == (1<<7))return 1;
451 }
451 }
452 return 0;
452 return 0;
453 }
453 }
454
454
455
455
456
456
457
457
458
458
459
459
460
460
461
461
462
462
463
463
464
464
465
465
466
466
467
467
468
468
469
469
470
470
@@ -1,465 +1,465
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@gmail.com
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22
22
23 #include <uart.h>
23 #include <uart.h>
24 #include <stm32f4xx_usart.h>
24 #include <stm32f4xx_usart.h>
25 #include <stm32f4xx_rcc.h>
25 #include <stm32f4xx_rcc.h>
26 #include <stm32f4xx_gpio.h>
26 #include <stm32f4xx_gpio.h>
27 #include <gpio.h>
27 #include <gpio.h>
28 #include <stdio.h>
28 #include <stdio.h>
29
29
30 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
30 #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA))
31 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
31 #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8)
32
32
33 USART_TypeDef* _uart_dev_table[6]={USART1,USART2,USART3,UART4,UART5,USART6};
33 USART_TypeDef* _uart_dev_table[6]={USART1,USART2,USART3,UART4,UART5,USART6};
34
34
35
35
36 int _uartstrsetpos(streamdevice* device,int pos);
36 int _uartstrsetpos(streamdevice* device,int pos);
37 int _uartstrread(streamdevice* device,void* data,int size, int n);
37 int _uartstrread(streamdevice* device,void* data,int size, int n);
38 int _uartstrwrite(streamdevice* device,void* data,int size, int n);
38 int _uartstrwrite(streamdevice* device,void* data,int size, int n);
39
39
40 streamdevice_ops UART_OPS=
40 streamdevice_ops UART_OPS=
41 {
41 {
42 .write = &_uartstrwrite,
42 .write = &_uartstrwrite,
43 .read = &_uartstrread,
43 .read = &_uartstrread,
44 .setpos= &_uartstrsetpos,
44 .setpos= &_uartstrsetpos,
45 .close = NULL
45 .close = NULL
46 };
46 };
47
47
48 uart_t uartopen(int count)
48 uart_t uartopen(int count)
49 {
49 {
50
50
51 switch(count)
51 switch(count)
52 {
52 {
53 case uart1:
53 case uart1:
54 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
54 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
55 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
55 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
56 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE);
56 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE);
57 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
57 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
58 USART1->CR3 &= ~((1<<8) + (1<<9));
58 USART1->CR3 &= ~((1<<8) + (1<<9));
59 return uart1;
59 return uart1;
60 break;
60 break;
61 case uart2:
61 case uart2:
62 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
62 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
63 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
63 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
64 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE);
64 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE);
65 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
65 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
66 USART2->CR3 &= ~((1<<8) + (1<<9));
66 USART2->CR3 &= ~((1<<8) + (1<<9));
67 return uart2;
67 return uart2;
68 break;
68 break;
69 case uart3:
69 case uart3:
70 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
70 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
71 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, ENABLE);
71 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, ENABLE);
72 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, DISABLE);
72 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, DISABLE);
73 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
73 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
74 USART3->CR3 &= ~((1<<8) + (1<<9));
74 USART3->CR3 &= ~((1<<8) + (1<<9));
75 return uart3;
75 return uart3;
76 break;
76 break;
77 case uart4:
77 case uart4:
78 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART4, ENABLE);
78 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART4, ENABLE);
79 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART4, DISABLE);
79 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART4, DISABLE);
80 RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART4, ENABLE);
80 RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART4, ENABLE);
81 UART4->CR3 &= ~((1<<8) + (1<<9));
81 UART4->CR3 &= ~((1<<8) + (1<<9));
82 return uart4;
82 return uart4;
83 break;
83 break;
84 case uart5:
84 case uart5:
85 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, ENABLE);
85 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, ENABLE);
86 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, DISABLE);
86 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, DISABLE);
87 RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART5, ENABLE);
87 RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART5, ENABLE);
88 return uart5;
88 return uart5;
89 break;
89 break;
90 case uart6:
90 case uart6:
91 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, ENABLE);
91 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, ENABLE);
92 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, DISABLE);
92 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, DISABLE);
93 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);
93 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);
94 return uart6;
94 return uart6;
95 break;
95 break;
96 default:
96 default:
97 break;
97 break;
98 }
98 }
99 return -1;
99 return -1;
100 }
100 }
101
101
102 uart_t uartopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t TXpin, uint32_t RXpin, uint32_t RTSpin, uint32_t CTSpin)
102 uart_t uartopenandconfig(int count, uint32_t cfg, uint32_t speed, uint32_t TXpin, uint32_t RXpin, uint32_t RTSpin, uint32_t CTSpin)
103 {
103 {
104 uart_t dev= uartopen(count);
104 uart_t dev= uartopen(count);
105 uartsetconfig(dev,cfg,speed);
105 uartsetconfig(dev,cfg,speed);
106 uartsetpins(dev,TXpin,RXpin,RTSpin,CTSpin);
106 uartsetpins(dev,TXpin,RXpin,RTSpin,CTSpin);
107 return dev;
107 return dev;
108 }
108 }
109
109
110
110
111 int uartclose(uart_t uart)
111 int uartclose(uart_t uart)
112 {
112 {
113 switch(uart)
113 switch(uart)
114 {
114 {
115 case uart1:
115 case uart1:
116 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
116 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
117 break;
117 break;
118 case uart2:
118 case uart2:
119 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
119 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
120 break;
120 break;
121 case uart3:
121 case uart3:
122 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, ENABLE);
122 RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, ENABLE);
123 break;
123 break;
124 case uart4:
124 case uart4:
125 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART4, ENABLE);
125 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART4, ENABLE);
126 break;
126 break;
127 case uart5:
127 case uart5:
128 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, ENABLE);
128 RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, ENABLE);
129 break;
129 break;
130 case uart6:
130 case uart6:
131 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, ENABLE);
131 RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, ENABLE);
132 break;
132 break;
133 default:
133 default:
134 return -1;
134 return -1;
135 break;
135 break;
136 }
136 }
137 return 1;
137 return 1;
138 }
138 }
139
139
140 int uartsetpins(uart_t uart,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin)
140 int uartsetpins(uart_t uart,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin)
141 {
141 {
142 if(uart >5)return -1;
142 if(uart >5)return -1;
143 if(uart <0)return -1;
143 if(uart <0)return -1;
144 gpio_t TX,RX,CTS,RTS;
144 gpio_t TX,RX,CTS,RTS;
145 TX = gpioopen(TXpin);
145 TX = gpioopen(TXpin);
146 RX = gpioopen(RXpin);
146 RX = gpioopen(RXpin);
147 TX |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
147 TX |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
148 RX |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
148 RX |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
149 gpiosetconfig(&TX);
149 gpiosetconfig(&TX);
150 gpiosetconfig(&RX);
150 gpiosetconfig(&RX);
151 uint8_t gpioAFuartx = GPIO_AF_USART1;
151 uint8_t gpioAFuartx = GPIO_AF_USART1;
152 switch(uart)
152 switch(uart)
153 {
153 {
154 case uart1:
154 case uart1:
155 gpioAFuartx = GPIO_AF_USART1;
155 gpioAFuartx = GPIO_AF_USART1;
156 break;
156 break;
157 case uart2:
157 case uart2:
158 gpioAFuartx = GPIO_AF_USART2;
158 gpioAFuartx = GPIO_AF_USART2;
159 break;
159 break;
160 case uart3:
160 case uart3:
161 gpioAFuartx = GPIO_AF_USART3;
161 gpioAFuartx = GPIO_AF_USART3;
162 break;
162 break;
163 case uart4:
163 case uart4:
164 gpioAFuartx = GPIO_AF_UART4;
164 gpioAFuartx = GPIO_AF_UART4;
165 break;
165 break;
166 case uart5:
166 case uart5:
167 gpioAFuartx = GPIO_AF_UART5;
167 gpioAFuartx = GPIO_AF_UART5;
168 break;
168 break;
169 case uart6:
169 case uart6:
170 gpioAFuartx = GPIO_AF_USART6;
170 gpioAFuartx = GPIO_AF_USART6;
171 break;
171 break;
172 default:
172 default:
173 return -1;
173 return -1;
174 break;
174 break;
175 }
175 }
176 GPIO_PinAFConfig(GPIOGETPORT(TX), (uint8_t)(TX & 0xF), gpioAFuartx);
176 GPIO_PinAFConfig(GPIOGETPORT(TX), (uint8_t)(TX & 0xF), gpioAFuartx);
177 GPIO_PinAFConfig(GPIOGETPORT(RX), (uint8_t)(RX & 0xF), gpioAFuartx);
177 GPIO_PinAFConfig(GPIOGETPORT(RX), (uint8_t)(RX & 0xF), gpioAFuartx);
178 if((gpioAFuartx!=GPIO_AF_UART5) && (gpioAFuartx!=GPIO_AF_UART4))
178 if((gpioAFuartx!=GPIO_AF_UART5) && (gpioAFuartx!=GPIO_AF_UART4))
179 {
179 {
180 if(CTSpin!=-1)
180 if(CTSpin!=-1)
181 {
181 {
182 CTS = gpioopen(CTSpin);
182 CTS = gpioopen(CTSpin);
183 CTS |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
183 CTS |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
184 gpiosetconfig(&CTS);
184 gpiosetconfig(&CTS);
185 GPIO_PinAFConfig(GPIOGETPORT(CTS), (uint8_t)(CTS & 0xF), gpioAFuartx);
185 GPIO_PinAFConfig(GPIOGETPORT(CTS), (uint8_t)(CTS & 0xF), gpioAFuartx);
186 }
186 }
187
187
188 if(RTSpin!=-1)
188 if(RTSpin!=-1)
189 {
189 {
190 RTS = gpioopen(RTSpin);
190 RTS = gpioopen(RTSpin);
191 RTS |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
191 RTS |= gpiolowspeed | gpioaf | gpiopushpulltype | gpionopulltype;
192 gpiosetconfig(&RTS);
192 gpiosetconfig(&RTS);
193 GPIO_PinAFConfig(GPIOGETPORT(RTS), (uint8_t)(RTS & 0xF), gpioAFuartx);
193 GPIO_PinAFConfig(GPIOGETPORT(RTS), (uint8_t)(RTS & 0xF), gpioAFuartx);
194 }
194 }
195 }
195 }
196 return 1;
196 return 1;
197 }
197 }
198
198
199 int uartsetconfig(uart_t uart, uint32_t cfg, uint32_t speed)
199 int uartsetconfig(uart_t uart, uint32_t cfg, uint32_t speed)
200 {
200 {
201 int res=1;
201 int res=1;
202 uartdisable(uart);
202 uartdisable(uart);
203 uartsetspeed(uart,speed);
203 uartsetspeed(uart,speed);
204 uartsetparity(uart,cfg & UARTPARITYMASK);
204 uartsetparity(uart,cfg & UARTPARITYMASK);
205 uartsetdatabits(uart,cfg & UARTBITSMASK);
205 uartsetdatabits(uart,cfg & UARTBITSMASK);
206 uartsetstopbits(uart,cfg & UARTSTOPBITSMASK);
206 uartsetstopbits(uart,cfg & UARTSTOPBITSMASK);
207 uartenable(uart);
207 uartenable(uart);
208 return res;
208 return res;
209 }
209 }
210
210
211 int uartenable(uart_t uart)
211 int uartenable(uart_t uart)
212 {
212 {
213 if((uart<6)&&(uart>=0))
213 if((uart<6)&&(uart>=0))
214 {
214 {
215 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
215 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
216 _dev_->CR1 |= (1<<13);
216 _dev_->CR1 |= (1<<13);
217 _dev_->CR1 |= (1<<2) + (1<<3);
217 _dev_->CR1 |= (1<<2) + (1<<3);
218 _dev_->DR = ' ';
218 _dev_->DR = ' ';
219 return 1;
219 return 1;
220 }
220 }
221 return -1;
221 return -1;
222 }
222 }
223
223
224 int uartdisable(uart_t uart)
224 int uartdisable(uart_t uart)
225 {
225 {
226 if((uart<6)&&(uart>=0))
226 if((uart<6)&&(uart>=0))
227 {
227 {
228 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
228 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
229 if((_dev_->CR1 & ((1<<3) +(1<<13)))==((1<<3) +(1<<13)))
229 if((_dev_->CR1 & ((1<<3) +(1<<13)))==((1<<3) +(1<<13)))
230 {
230 {
231 while((_dev_->SR & (uint16_t)(1<<7))!=(uint16_t)(1<<7));
231 while((_dev_->SR & (uint16_t)(1<<7))!=(uint16_t)(1<<7));
232 }
232 }
233 _dev_->CR1 &= ~((1<<2) + (1<<3) +(1<<13));
233 _dev_->CR1 &= ~((1<<2) + (1<<3) +(1<<13));
234 return 1;
234 return 1;
235 }
235 }
236 return -1;
236 return -1;
237 }
237 }
238
238
239 int uartsetspeed(uart_t uart,uint32_t speed)
239 int uartsetspeed(uart_t uart,uint32_t speed)
240 {
240 {
241 if((uart<6)&&(uart>=0))
241 if((uart<6)&&(uart>=0))
242 {
242 {
243 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
243 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
244 uint32_t tmpreg = 0x00, apbclock = 0x00;
244 uint32_t tmpreg = 0x00, apbclock = 0x00;
245 uint32_t integerdivider = 0x00;
245 uint32_t integerdivider = 0x00;
246 uint32_t fractionaldivider = 0x00;
246 uint32_t fractionaldivider = 0x00;
247 RCC_ClocksTypeDef RCC_ClocksStatus;
247 RCC_ClocksTypeDef RCC_ClocksStatus;
248 RCC_GetClocksFreq(&RCC_ClocksStatus);
248 RCC_GetClocksFreq(&RCC_ClocksStatus);
249
249
250 if ((_dev_ == USART1) || ((_dev_ == USART6)))
250 if ((_dev_ == USART1) || ((_dev_ == USART6)))
251 {
251 {
252 apbclock = RCC_ClocksStatus.PCLK2_Frequency;
252 apbclock = RCC_ClocksStatus.PCLK2_Frequency;
253 }
253 }
254 else
254 else
255 {
255 {
256 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
256 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
257 }
257 }
258 if (((_dev_->CR1) & USART_CR1_OVER8) != (uint16_t)0)
258 if (((_dev_->CR1) & USART_CR1_OVER8) != (uint16_t)0)
259 {
259 {
260 integerdivider = ((25 * apbclock) / (2 * (speed)));
260 integerdivider = ((25 * apbclock) / (2 * (speed)));
261 }
261 }
262 else
262 else
263 {
263 {
264 integerdivider = ((25 * apbclock) / (4 * (speed)));
264 integerdivider = ((25 * apbclock) / (4 * (speed)));
265 }
265 }
266 tmpreg = (integerdivider / 100) << 4;
266 tmpreg = (integerdivider / 100) << 4;
267 fractionaldivider = integerdivider - (100 * (tmpreg >> 4));
267 fractionaldivider = integerdivider - (100 * (tmpreg >> 4));
268 if ((_dev_->CR1 & USART_CR1_OVER8) != (uint16_t)0)
268 if ((_dev_->CR1 & USART_CR1_OVER8) != (uint16_t)0)
269 {
269 {
270 tmpreg |= ((((fractionaldivider * 8) + 50) / 100)) & ((uint8_t)0x07);
270 tmpreg |= ((((fractionaldivider * 8) + 50) / 100)) & ((uint8_t)0x07);
271 }
271 }
272 else
272 else
273 {
273 {
274 tmpreg |= ((((fractionaldivider * 16) + 50) / 100)) & ((uint8_t)0x0F);
274 tmpreg |= ((((fractionaldivider * 16) + 50) / 100)) & ((uint8_t)0x0F);
275 }
275 }
276 _dev_->BRR = (uint16_t)tmpreg;
276 _dev_->BRR = (uint16_t)tmpreg;
277 return 1;
277 return 1;
278 }
278 }
279 return -1;
279 return -1;
280 }
280 }
281
281
282 int uartsetparity(uart_t uart,uartparity_t parity)
282 int uartsetparity(uart_t uart,uartparity_t parity)
283 {
283 {
284 if((uart<6)&&(uart>=0))
284 if((uart<6)&&(uart>=0))
285 {
285 {
286 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
286 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
287 _dev_->CR1 &= ~(((1<<9)+(1<<10)));
287 _dev_->CR1 &= ~(((1<<9)+(1<<10)));
288 switch(parity)
288 switch(parity)
289 {
289 {
290 case uartparityeven:
290 case uartparityeven:
291 _dev_->CR1 |= (1<<10);
291 _dev_->CR1 |= (1<<10);
292 break;
292 break;
293 case uartparityodd:
293 case uartparityodd:
294 _dev_->CR1 |= (1<<10) + (1<<9);
294 _dev_->CR1 |= (1<<10) + (1<<9);
295 break;
295 break;
296 case uartparitynone:
296 case uartparitynone:
297 break;
297 break;
298 default :
298 default :
299 return 0;
299 return 0;
300 break;
300 break;
301 }
301 }
302 return 1;
302 return 1;
303 }
303 }
304 return -1;
304 return -1;
305 }
305 }
306
306
307 int uartsetdatabits(uart_t uart,uartbits_t databits)
307 int uartsetdatabits(uart_t uart,uartbits_t databits)
308 {
308 {
309 if((uart<6)&&(uart>=0))
309 if((uart<6)&&(uart>=0))
310 {
310 {
311 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
311 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
312 _dev_->CR1 &= ~(((1<<12)));
312 _dev_->CR1 &= ~(((1<<12)));
313 switch(databits)
313 switch(databits)
314 {
314 {
315 case uart7bits:
315 case uart7bits:
316 return 0;
316 return 0;
317 break;
317 break;
318 case uart8bits:
318 case uart8bits:
319 break;
319 break;
320 case uart9bits:
320 case uart9bits:
321 _dev_->CR1 |= (1<<12);
321 _dev_->CR1 |= (1<<12);
322 break;
322 break;
323 default :
323 default :
324 return 0;
324 return 0;
325 break;
325 break;
326 }
326 }
327 return 1;
327 return 1;
328 }
328 }
329 return -1;
329 return -1;
330 }
330 }
331
331
332 int uartsetstopbits(uart_t uart,uartstopbits_t stopbits)
332 int uartsetstopbits(uart_t uart,uartstopbits_t stopbits)
333 {
333 {
334 if((uart<6)&&(uart>=0))
334 if((uart<6)&&(uart>=0))
335 {
335 {
336 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
336 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
337 _dev_->CR2 &= ~(((1<<12)+(1<<13)));
337 _dev_->CR2 &= ~(((1<<12)+(1<<13)));
338 switch(stopbits)
338 switch(stopbits)
339 {
339 {
340 case uarthalfstop:
340 case uarthalfstop:
341 _dev_->CR2 |= (1<<12);
341 _dev_->CR2 |= (1<<12);
342 break;
342 break;
343 case uartonestop:
343 case uartonestop:
344 break;
344 break;
345 case uartonehalfstop:
345 case uartonehalfstop:
346 _dev_->CR2 |= (1<<12) + (1<<13);
346 _dev_->CR2 |= (1<<12) + (1<<13);
347 break;
347 break;
348 case uarttwostop:
348 case uarttwostop:
349 _dev_->CR2 |= (1<<13);
349 _dev_->CR2 |= (1<<13);
350 break;
350 break;
351 default :
351 default :
352 return 0;
352 return 0;
353 break;
353 break;
354 }
354 }
355 return 1;
355 return 1;
356 }
356 }
357 return -1;
357 return -1;
358 }
358 }
359
359
360 int uartputc(uart_t uart,char c)
360 int uartputc(uart_t uart,char c)
361 {
361 {
362 if((uart<6)&&(uart>=0))
362 if((uart<6)&&(uart>=0))
363 {
363 {
364 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
364 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
365 while((_dev_->SR & (uint16_t)(1<<7))!=(uint16_t)(1<<7));
365 while((_dev_->SR & (uint16_t)(1<<7))!=(uint16_t)(1<<7));
366 _dev_->DR = c;
366 _dev_->DR = c;
367 return 1;
367 return 1;
368 }
368 }
369 return -1;
369 return -1;
370 }
370 }
371
371
372 char uartgetc(uart_t uart)
372 char uartgetc(uart_t uart)
373 {
373 {
374 if((uart<6)&&(uart>=0))
374 if((uart<6)&&(uart>=0))
375 {
375 {
376 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
376 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
377 while(!(_dev_->SR & (1<<5)));
377 while(!(_dev_->SR & (1<<5)));
378 return (char)_dev_->DR;
378 return (char)_dev_->DR;
379 }
379 }
380 return -1;
380 return -1;
381 }
381 }
382
382
383 int uartputs(uart_t uart,char* s)
383 int uartputs(uart_t uart,char* s)
384 {
384 {
385 while (*s) uartputc(uart,*s++);
385 while (*s) uartputc(uart,*s++);
386 return 1;
386 return 1;
387 }
387 }
388
388
389 int uartgets(uart_t uart,char* s)
389 int uartgets(uart_t uart,char* s)
390 {
390 {
391 do
391 do
392 {
392 {
393 (*s) = uartgetc(uart);
393 (*s) = uartgetc(uart);
394 }
394 }
395 while(*s++);
395 while(*s++);
396 return 1;
396 return 1;
397 }
397 }
398
398
399 int uartputnc(uart_t uart,char* c,int n)
399 int uartputnc(uart_t uart,char* c,int n)
400 {
400 {
401 int l=0;
401 int l=0;
402 while(l<n)
402 while(l<n)
403 {
403 {
404 uartputc(uart,*c++);
404 uartputc(uart,*c++);
405 l++;
405 l++;
406 }
406 }
407 return n;
407 return n;
408 }
408 }
409
409
410 int uartgetnc(uart_t uart,char* c,int n)
410 int uartgetnc(uart_t uart,char* c,int n)
411 {
411 {
412 int l=0;
412 int l=0;
413 while(l<n)
413 while(l<n)
414 {
414 {
415 *c++=uartgetc(uart);
415 *c++=uartgetc(uart);
416 l++;
416 l++;
417 }
417 }
418 return n;
418 return n;
419 }
419 }
420
420
421 int uartavailiabledata(uart_t uart)
421 int uartavailiabledata(uart_t uart)
422 {
422 {
423 if((uart<6)&&(uart>=0))
423 if((uart<6)&&(uart>=0))
424 {
424 {
425 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
425 USART_TypeDef* _dev_ = _uart_dev_table[(int)uart];
426 if(!(_dev_->SR & (1<<5)))
426 if(!(_dev_->SR & (1<<5)))
427 return 0;
427 return 0;
428 else
428 else
429 return 1;
429 return 1;
430 }
430 }
431 return -1;
431 return -1;
432 }
432 }
433
433
434
434
435 int _uartstrwrite(streamdevice* device,void* data,int size, int n)
435 int _uartstrwrite(streamdevice* device,void* data,int size, int n)
436 {
436 {
437 return uartputnc((uart_t) device->_stream,(char*) data,size*n);
437 return uartputnc((uart_t) device->_stream,(char*) data,size*n);
438 }
438 }
439
439
440 int _uartstrread(streamdevice* device,void* data,int size, int n)
440 int _uartstrread(streamdevice* device,void* data,int size, int n)
441 {
441 {
442 return uartgetnc((uart_t) device->_stream,(char*) data,size*n);
442 return uartgetnc((uart_t) device->_stream,(char*) data,size*n);
443 }
443 }
444
444
445 int _uartstrsetpos(streamdevice* device,int pos)
445 int _uartstrsetpos(streamdevice* device,int pos)
446 {
446 {
447 return 1;
447 return 1;
448 }
448 }
449
449
450 int uartmkstreamdev(uart_t uart,streamdevice* strdev)
450 int uartmkstreamdev(uart_t uart,streamdevice* strdev)
451 {
451 {
452 strdev->_stream = (UHANDLE)uart;/*
452 strdev->_stream = (UHANDLE)uart;/*
453 strdev->write = (write_t)&_uartstrwrite;
453 strdev->write = (write_t)&_uartstrwrite;
454 strdev->read = (read_t)&_uartstrread;
454 strdev->read = (read_t)&_uartstrread;
455 strdev->setpos = (setpos_t)&_uartstrsetpos;*/
455 strdev->setpos = (setpos_t)&_uartstrsetpos;*/
456 strdev->ops = &UART_OPS;
456 strdev->ops = &UART_OPS;
457 strdev->streamPt = 0;
457 strdev->streamPt = 0;
458 return 1;
458 return 1;
459 }
459 }
460
460
461
461
462
462
463
463
464
464
465
465
General Comments 0
You need to be logged in to leave comments. Login now