@@ -0,0 +1,18 | |||||
|
1 | TEMPLATE = lib | |||
|
2 | ||||
|
3 | TARGET=bsp | |||
|
4 | OBJECTS_DIR = obj | |||
|
5 | ||||
|
6 | BSP=STM32F4Discovery-EXT | |||
|
7 | ||||
|
8 | UCMODEL=stm32f4 | |||
|
9 | ||||
|
10 | SOURCES += bsp.c | |||
|
11 | ||||
|
12 | HEADERS += bsp.h | |||
|
13 | ||||
|
14 | ||||
|
15 | BSPFILE = bsp.pri | |||
|
16 | ||||
|
17 | ||||
|
18 |
@@ -0,0 +1,311 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the libuc, microcontroler library | |||
|
3 | -- Copyright (C) 2011, Alexis Jeandet | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@gmail.com | |||
|
21 | -------------------------------------------------------------------------------*/ | |||
|
22 | #include "bsp.h" | |||
|
23 | #include <streamdevices.h> | |||
|
24 | #include <malloc.h> | |||
|
25 | #include <gpio.h> | |||
|
26 | #include <uart.h> | |||
|
27 | #include <stdio.h> | |||
|
28 | #include <stm32f4xx_gpio.h> | |||
|
29 | #include <stm32f4xx_fsmc.h> | |||
|
30 | #include <stm32f4xx_gpio.h> | |||
|
31 | #include <stm32f4xx_rcc.h> | |||
|
32 | #include <core.h> | |||
|
33 | ||||
|
34 | uint32_t OSC0 =8000000; | |||
|
35 | uint32_t INTOSC =16000000; | |||
|
36 | uint32_t RTCOSC =32768; | |||
|
37 | uint32_t currentCpuFreq=0; | |||
|
38 | extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__]; | |||
|
39 | ||||
|
40 | float VREF0 =(float)3.3; | |||
|
41 | ||||
|
42 | LCD_IF_t lcdIF0={ | |||
|
43 | .init = &bsp_FSMC_init, | |||
|
44 | .writereg = &bsp_lcd0_write_reg, | |||
|
45 | .readreg = &bsp_lcd0_read_reg, | |||
|
46 | .writeGRAM = &bsp_lcd0_writeGRAM, | |||
|
47 | .readGRAM = &bsp_lcd0_readGRAM | |||
|
48 | }; | |||
|
49 | ||||
|
50 | LCD_t lcd0={ | |||
|
51 | .interface = &lcdIF0, | |||
|
52 | .init = &ssd2119init, | |||
|
53 | .paint = &ssd2119paint, | |||
|
54 | .paintText = &ssd2119paintText, | |||
|
55 | .paintFilRect = &ssd2119paintFilRect, | |||
|
56 | .refreshenable = &ssd2119refreshenable, | |||
|
57 | .width= 320, | |||
|
58 | .height = 240 | |||
|
59 | }; | |||
|
60 | ||||
|
61 | ||||
|
62 | volatile int16_t* lcd0_CMD=(volatile int16_t*) 0x60000000; | |||
|
63 | volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x60FFFFF0); | |||
|
64 | ||||
|
65 | int bsp_init() | |||
|
66 | { | |||
|
67 | int i=0; | |||
|
68 | for(i=0;i<32;i++) | |||
|
69 | { | |||
|
70 | __opnfiles__[i] = NULL; | |||
|
71 | } | |||
|
72 | bsp_GPIO_init(); | |||
|
73 | bsp_uart_init(); | |||
|
74 | bsp_FSMC_init(); | |||
|
75 | printf("\r================================================================\n\r"); | |||
|
76 | printf("================================================================\n\r"); | |||
|
77 | printf(BSP); | |||
|
78 | printf(" initialised\n\r"); | |||
|
79 | printf("================================================================\n\r"); | |||
|
80 | return 1; | |||
|
81 | } | |||
|
82 | ||||
|
83 | void bsp_GPIO_init() | |||
|
84 | { | |||
|
85 | gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009 | |||
|
86 | // gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2); | |||
|
87 | gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2); | |||
|
88 | // gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2); | |||
|
89 | gpiosetspeed(&gpio1,gpiohighspeed); | |||
|
90 | //gpiosetspeed(&gpio2,gpiohighspeed); | |||
|
91 | gpiosetspeed(&gpio3,gpiohighspeed); | |||
|
92 | //gpiosetspeed(&gpio4,gpiohighspeed); | |||
|
93 | gpiosetdir(&gpio1,gpiooutdir); | |||
|
94 | gpiosetdir(&gpio3,gpiooutdir); | |||
|
95 | // gpiosetdir(&gpio2,gpiooutdir); | |||
|
96 | //gpiosetdir(&gpio4,gpiooutdir); | |||
|
97 | } | |||
|
98 | ||||
|
99 | void bsp_uart_init() | |||
|
100 | { | |||
|
101 | if(__opnfiles__[1]==NULL) | |||
|
102 | { | |||
|
103 | //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t)); | |||
|
104 | streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); | |||
|
105 | uart_t uart = uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1); | |||
|
106 | uartmkstreamdev(uart,fd1); | |||
|
107 | __opnfiles__[1] = fd1; //stdo | |||
|
108 | __opnfiles__[0] = fd1; //stdi | |||
|
109 | } | |||
|
110 | else | |||
|
111 | { | |||
|
112 | uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1); | |||
|
113 | } | |||
|
114 | } | |||
|
115 | ||||
|
116 | ||||
|
117 | /* | |||
|
118 | D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7 | |||
|
119 | D5 PE8 D6 PE9 D7 PE10 D8 PE11 D9 PE12 | |||
|
120 | D10 PE13 D11 PE14 D12 PE15 D13 PD8 D14 PD9 | |||
|
121 | D15 PD10 | |||
|
122 | A0 PF0 = RS FSMC_NE3 PG10 CS FSMC_NWE PD5 W/S | |||
|
123 | FSMC_NOE PD4 RD | |||
|
124 | */ | |||
|
125 | /*-- GPIOs Configuration -----------------------------------------------------*/ | |||
|
126 | /* | |||
|
127 | +-------------------+--------------------+------------------+------------------+ | |||
|
128 | + SRAM pins assignment + | |||
|
129 | +-------------------+--------------------+------------------+------------------+ | |||
|
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 | | |||
|
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 | | |||
|
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 | | |||
|
136 | | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | | |||
|
137 | | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+ | |||
|
138 | | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 | | |||
|
139 | | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 | | |||
|
140 | | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+ | |||
|
141 | | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 | | |||
|
142 | | | PE15 <-> FSMC_D12 | | |||
|
143 | +-------------------+--------------------+ | |||
|
144 | */ | |||
|
145 | int bsp_FSMC_init() | |||
|
146 | { | |||
|
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) | |||
|
149 | ||||
|
150 | gpio_t gpio1 = gpioopen(LCD_RESET); | |||
|
151 | gpiosetspeed(&gpio1,gpiohighspeed); | |||
|
152 | gpiosetdir(&gpio1,gpiooutdir); | |||
|
153 | gpioclr(LCD_RESET); | |||
|
154 | gpio1 = gpioopen(LCD_CS); | |||
|
155 | gpiosetspeed(&gpio1,gpiohighspeed); | |||
|
156 | gpiosetdir(&gpio1,gpiooutdir); | |||
|
157 | gpioset(LCD_CS); | |||
|
158 | gpio_t LCD_DBxList[]={ | |||
|
159 | PD0 ,PD1 ,PD4 ,PD5 ,PD8 ,PD9 ,PD10,PD14,PD15, | |||
|
160 | PE3 ,PE7 ,PE8 ,PE9 ,PE10,PE11,PE12,PE13,PE14, | |||
|
161 | PE15 }; | |||
|
162 | ||||
|
163 | for(int i=0;i<19;i++) | |||
|
164 | { | |||
|
165 | gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]); | |||
|
166 | LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype; | |||
|
167 | gpiosetconfig(&LCD_DBx); | |||
|
168 | GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC); | |||
|
169 | } | |||
|
170 | ||||
|
171 | FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; | |||
|
172 | FSMC_NORSRAMTimingInitTypeDef p; | |||
|
173 | ||||
|
174 | /* Enable FSMC clock */ | |||
|
175 | RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); | |||
|
176 | ||||
|
177 | /*-- FSMC Configuration ------------------------------------------------------*/ | |||
|
178 | /*----------------------- SRAM Bank 3 ----------------------------------------*/ | |||
|
179 | /* FSMC_Bank1_NORSRAM3 configuration */ | |||
|
180 | p.FSMC_AddressSetupTime = 1; | |||
|
181 | p.FSMC_AddressHoldTime = 0; | |||
|
182 | p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11; | |||
|
183 | p.FSMC_BusTurnAroundDuration = 0; | |||
|
184 | p.FSMC_CLKDivision = 0; | |||
|
185 | p.FSMC_DataLatency = 0; | |||
|
186 | p.FSMC_AccessMode = FSMC_AccessMode_A; | |||
|
187 | /* Color LCD configuration ------------------------------------ | |||
|
188 | LCD configured as follow: | |||
|
189 | - Data/Address MUX = Disable | |||
|
190 | - Memory Type = SRAM | |||
|
191 | - Data Width = 16bit | |||
|
192 | - Write Operation = Enable | |||
|
193 | - Extended Mode = Enable | |||
|
194 | - Asynchronous Wait = Disable */ | |||
|
195 | ||||
|
196 | FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3; | |||
|
197 | FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; | |||
|
198 | FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; | |||
|
199 | FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; | |||
|
200 | FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; | |||
|
201 | FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; | |||
|
202 | FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; | |||
|
203 | FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; | |||
|
204 | FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; | |||
|
205 | FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; | |||
|
206 | FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; | |||
|
207 | FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; | |||
|
208 | FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; | |||
|
209 | FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; | |||
|
210 | FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; | |||
|
211 | ||||
|
212 | FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); | |||
|
213 | ||||
|
214 | /* Enable FSMC NOR/SRAM Bank1 */ | |||
|
215 | FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE); | |||
|
216 | gpioset(LCD_RESET); | |||
|
217 | gpioclr(LCD_CS); | |||
|
218 | lcd0.init(&lcd0); | |||
|
219 | return 1; | |||
|
220 | } | |||
|
221 | ||||
|
222 | void bsp_spi_init() | |||
|
223 | { | |||
|
224 | ||||
|
225 | } | |||
|
226 | ||||
|
227 | ||||
|
228 | void bsp_iic_init() | |||
|
229 | { | |||
|
230 | ||||
|
231 | } | |||
|
232 | ||||
|
233 | void bsp_SD_init() | |||
|
234 | { | |||
|
235 | ||||
|
236 | } | |||
|
237 | ||||
|
238 | ||||
|
239 | void vs10XXclearXCS(){} | |||
|
240 | void vs10XXsetXCS(){} | |||
|
241 | int vs10XXDREQ() | |||
|
242 | { | |||
|
243 | return 1; | |||
|
244 | } | |||
|
245 | ||||
|
246 | ||||
|
247 | void bsppowersdcard(char onoff) //always ON | |||
|
248 | { | |||
|
249 | ||||
|
250 | } | |||
|
251 | ||||
|
252 | char bspsdcardpresent() | |||
|
253 | { | |||
|
254 | return 0; | |||
|
255 | } | |||
|
256 | ||||
|
257 | char bspsdcardwriteprotected() | |||
|
258 | { | |||
|
259 | return 0; | |||
|
260 | } | |||
|
261 | ||||
|
262 | void bspsdcardselect(char YESNO) | |||
|
263 | { | |||
|
264 | ||||
|
265 | } | |||
|
266 | ||||
|
267 | ||||
|
268 | ||||
|
269 | void bsp_lcd0_write_reg(uint32_t reg,uint32_t data) | |||
|
270 | { | |||
|
271 | gpioclr(LCD_CS); | |||
|
272 | *lcd0_CMD=(uint16_t)reg; | |||
|
273 | *lcd0_DATA=(uint16_t)data; | |||
|
274 | gpioset(LCD_CS); | |||
|
275 | } | |||
|
276 | ||||
|
277 | uint32_t bsp_lcd0_read_reg(uint32_t reg) | |||
|
278 | { | |||
|
279 | gpioclr(LCD_CS); | |||
|
280 | *lcd0_CMD=(uint16_t)reg; | |||
|
281 | uint32_t data=(uint16_t)*lcd0_DATA; | |||
|
282 | gpioset(LCD_CS); | |||
|
283 | return data; | |||
|
284 | } | |||
|
285 | ||||
|
286 | void bsp_lcd0_writeGRAM(void* buffer,uint32_t count) | |||
|
287 | { | |||
|
288 | gpioclr(LCD_CS); | |||
|
289 | *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM; | |||
|
290 | uint16_t* castedBuff=(uint16_t*)buffer; | |||
|
291 | for(int i=0;i<(int)count;i++) | |||
|
292 | { | |||
|
293 | *lcd0_DATA=castedBuff[i]; | |||
|
294 | } | |||
|
295 | gpioset(LCD_CS); | |||
|
296 | } | |||
|
297 | ||||
|
298 | void bsp_lcd0_readGRAM(void* buffer,uint32_t count) | |||
|
299 | { | |||
|
300 | gpioclr(LCD_CS); | |||
|
301 | *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM; | |||
|
302 | uint16_t* castedBuff=(uint16_t*)buffer; | |||
|
303 | castedBuff[0]=*lcd0_DATA; | |||
|
304 | for(int i=0;i<(int)count;i++) | |||
|
305 | { | |||
|
306 | castedBuff[i]=*lcd0_DATA; | |||
|
307 | } | |||
|
308 | gpioset(LCD_CS); | |||
|
309 | } | |||
|
310 | ||||
|
311 |
@@ -0,0 +1,108 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the libuc, microcontroler library | |||
|
3 | -- Copyright (C) 2011, Alexis Jeandet | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@gmail.com | |||
|
21 | -------------------------------------------------------------------------------*/ | |||
|
22 | #ifndef BSP_H | |||
|
23 | #define BSP_H | |||
|
24 | #include <stm32f4xx.h> | |||
|
25 | #include <gpio.h> | |||
|
26 | #include <ili9328.h> | |||
|
27 | #include <ssd2119.h> | |||
|
28 | #include <genericLCD_Controler.h> | |||
|
29 | /* | |||
|
30 | #ifndef PD12 | |||
|
31 | #define PD12 | |||
|
32 | #endif | |||
|
33 | #ifndef PD13 | |||
|
34 | #define PD13 | |||
|
35 | #endif | |||
|
36 | */ | |||
|
37 | #define __MAX_OPENED_FILES__ 32 | |||
|
38 | #define __FS_ROOT_SIZE__ 32 | |||
|
39 | ||||
|
40 | #define LED1 PD12 | |||
|
41 | #define LED2 PD13 | |||
|
42 | #define LCD_RESET PD3 | |||
|
43 | #define LCD_CS PD7 | |||
|
44 | #define LCD_BACKL PD13 | |||
|
45 | ||||
|
46 | #define GREENLEDON (GPIOD->BSRRL = 1<<12) | |||
|
47 | #define ORANGELEDON (GPIOD->BSRRL = 1<<13) | |||
|
48 | #define REDLEDON (GPIOD->BSRRL = 1<<14) | |||
|
49 | #define BLUELEDON (GPIOD->BSRRL = 1<<15) | |||
|
50 | ||||
|
51 | #define GREENLEDOFF (GPIOD->BSRRH = 1<<12) | |||
|
52 | #define ORANGELEDOFF (GPIOD->BSRRH = 1<<13) | |||
|
53 | #define REDLEDOFF (GPIOD->BSRRH = 1<<14) | |||
|
54 | #define BLUELEDOFF (GPIOD->BSRRH = 1<<15) | |||
|
55 | ||||
|
56 | extern float VREF0; | |||
|
57 | ||||
|
58 | extern uint32_t OSC0; | |||
|
59 | extern uint32_t currentCpuFreq; | |||
|
60 | ||||
|
61 | ||||
|
62 | ||||
|
63 | extern int bsp_init(); | |||
|
64 | ||||
|
65 | extern void bsp_GPIO_init(); | |||
|
66 | extern void bsp_uart_init(); | |||
|
67 | extern void bsp_iic_init(); | |||
|
68 | extern void bsp_spi_init(); | |||
|
69 | extern void bsp_SD_init(); | |||
|
70 | extern int bsp_FSMC_init(); | |||
|
71 | ||||
|
72 | /* VS1053 */ | |||
|
73 | extern void clearXCS(); | |||
|
74 | extern void setXCS(); | |||
|
75 | extern int vs10XXDREQ(); | |||
|
76 | ||||
|
77 | /* SD CARD */ | |||
|
78 | void bsppowersdcard(char onoff); | |||
|
79 | char bspsdcardpresent(); | |||
|
80 | void bspsdcardselect(char YESNO); | |||
|
81 | char bspsdcardwriteprotected(); | |||
|
82 | ||||
|
83 | ||||
|
84 | void bsp_lcd0_write_reg(uint32_t reg,uint32_t data); | |||
|
85 | uint32_t bsp_lcd0_read_reg(uint32_t reg); | |||
|
86 | void bsp_lcd0_writeGRAM(void *buffer, uint32_t count); | |||
|
87 | void bsp_lcd0_readGRAM(void *buffer, uint32_t count); | |||
|
88 | ||||
|
89 | #endif | |||
|
90 | ||||
|
91 | ||||
|
92 | ||||
|
93 | ||||
|
94 | ||||
|
95 | ||||
|
96 | ||||
|
97 | ||||
|
98 | ||||
|
99 | ||||
|
100 | ||||
|
101 | ||||
|
102 | ||||
|
103 | ||||
|
104 | ||||
|
105 | ||||
|
106 | ||||
|
107 | ||||
|
108 |
@@ -0,0 +1,23 | |||||
|
1 | #include <stdio.h> | |||
|
2 | #include <bsp.h> | |||
|
3 | #include <ssd2119.h> | |||
|
4 | #include <genericLCD_Controler.h> | |||
|
5 | #include <fonts.h> | |||
|
6 | ||||
|
7 | extern LCD_t lcd0; | |||
|
8 | extern void ssd2119paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); | |||
|
9 | ||||
|
10 | int main(void) | |||
|
11 | { | |||
|
12 | printf("Hello World!\n\r"); | |||
|
13 | printf("SSD2119 Device Code = 0x%x\n\r",lcd0.interface->readreg(SSD2119_REGISTER_DEVICE_CODE_READ)); | |||
|
14 | printf("SSD2119 Entry mode = 0x%x\n\r",lcd0.interface->readreg(SSD2119_REGISTER_ENTRY_MODE)); | |||
|
15 | printf("SSD2119 Display Control = 0x%x\n\r",lcd0.interface->readreg(SSD2119_REGISTER_DISPLAY_CTRL)); | |||
|
16 | gpioset(LED2); | |||
|
17 | lcd0.paintFilRect(&lcd0,0,0,lcd0.width,lcd0.height,0xFFFF,0,0xFFFF); | |||
|
18 | lcd0.paintFilRect(&lcd0,10,10,100,100,0xFFFF,5,0); | |||
|
19 | lcd0.paintText(&lcd0,"Malik Ta gueule!",50,150,&ComicSansMS_24,0); | |||
|
20 | ssd2119paintFilCirc_old(&lcd0,160,120,50,0xF0F0,3,0x0F0F); | |||
|
21 | return 0; | |||
|
22 | } | |||
|
23 |
@@ -0,0 +1,11 | |||||
|
1 | TEMPLATE = app | |||
|
2 | CONFIG += cpu | |||
|
3 | ||||
|
4 | ||||
|
5 | UCMODEL=stm32f4 | |||
|
6 | DEFINES += CPUFREQ=120000000 | |||
|
7 | ||||
|
8 | BSP = STM32F4Discovery-EXT | |||
|
9 | ||||
|
10 | SOURCES += \ | |||
|
11 | main.c |
@@ -0,0 +1,416 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the libuc, microcontroler library | |||
|
3 | -- Copyright (C) 2013, Alexis Jeandet | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@gmail.com | |||
|
21 | -------------------------------------------------------------------------------*/ | |||
|
22 | #include <ssd2119.h> | |||
|
23 | #include <stdio.h> | |||
|
24 | #include <stddef.h> | |||
|
25 | #include <core.h> | |||
|
26 | #include <math.h> | |||
|
27 | ||||
|
28 | #ifdef __OPTIMIZED_MATH | |||
|
29 | #include <optimised_math.h> | |||
|
30 | #endif | |||
|
31 | ||||
|
32 | #define _delay_(del) for(volatile int _d_e_l_=0;_d_e_l_<(del);_d_e_l_++); | |||
|
33 | ||||
|
34 | #define ilipaintLine(LCD,X,Y,W,buffer,buffsize) \ | |||
|
35 | for(int l=0;l<1;l++)\ | |||
|
36 | {\ | |||
|
37 | ssd2119setFrame(LCD,X,Y,W,1);\ | |||
|
38 | int rem=(W)%buffsize;\ | |||
|
39 | if(rem)LCD->interface->writeGRAM(buffer,rem);\ | |||
|
40 | for(int i=rem;i<(W);i+=buffsize)\ | |||
|
41 | {\ | |||
|
42 | LCD->interface->writeGRAM(buffer,buffsize);\ | |||
|
43 | }\ | |||
|
44 | } | |||
|
45 | ||||
|
46 | #define ilipaintHLineWithCont(LCD,X,Y,W,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ | |||
|
47 | for(int l=0;l<1;l++)\ | |||
|
48 | {\ | |||
|
49 | ssd2119setFrame(LCD,X,Y,W,1);\ | |||
|
50 | int rem=(ContSz)%buffContsize;\ | |||
|
51 | if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ | |||
|
52 | for(int i=rem;i<(ContSz);i+=buffContsize)\ | |||
|
53 | {\ | |||
|
54 | LCD->interface->writeGRAM(bufferCont,buffContsize);\ | |||
|
55 | }\ | |||
|
56 | if((2*ContSz)<W) \ | |||
|
57 | {\ | |||
|
58 | rem=(W-(2*ContSz))%buffIntsize;\ | |||
|
59 | if(rem)LCD->interface->writeGRAM(bufferInt,rem);\ | |||
|
60 | for(int i=rem;i<(W-(2*ContSz));i+=buffIntsize)\ | |||
|
61 | {\ | |||
|
62 | LCD->interface->writeGRAM(bufferInt,buffIntsize);\ | |||
|
63 | }\ | |||
|
64 | }\ | |||
|
65 | rem=(ContSz)%buffContsize;\ | |||
|
66 | if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ | |||
|
67 | for(int i=rem;i<(ContSz);i+=buffContsize)\ | |||
|
68 | {\ | |||
|
69 | LCD->interface->writeGRAM(bufferCont,buffContsize);\ | |||
|
70 | }\ | |||
|
71 | }\ | |||
|
72 | ||||
|
73 | ||||
|
74 | #define ilipaintVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ | |||
|
75 | for(int l=0;l<1;l++)\ | |||
|
76 | {\ | |||
|
77 | ssd2119setFrame(LCD,X,Y,1,H);\ | |||
|
78 | int rem=(ContSz)%buffContsize;\ | |||
|
79 | if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ | |||
|
80 | for(int i=rem;i<(ContSz);i+=buffContsize)\ | |||
|
81 | {\ | |||
|
82 | LCD->interface->writeGRAM(bufferCont,buffContsize);\ | |||
|
83 | }\ | |||
|
84 | if((2*ContSz)<H) \ | |||
|
85 | {\ | |||
|
86 | rem=(H-(2*ContSz))%buffIntsize;\ | |||
|
87 | if(rem)LCD->interface->writeGRAM(bufferInt,rem);\ | |||
|
88 | for(int i=rem;i<(H-(2*ContSz));i+=buffIntsize)\ | |||
|
89 | {\ | |||
|
90 | LCD->interface->writeGRAM(bufferInt,buffIntsize);\ | |||
|
91 | }\ | |||
|
92 | }\ | |||
|
93 | rem=(ContSz)%buffContsize;\ | |||
|
94 | if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ | |||
|
95 | for(int i=rem;i<(ContSz);i+=buffContsize)\ | |||
|
96 | {\ | |||
|
97 | LCD->interface->writeGRAM(bufferCont,buffContsize);\ | |||
|
98 | }\ | |||
|
99 | }\ | |||
|
100 | ||||
|
101 | ||||
|
102 | #define ilipaintHalfTopVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ | |||
|
103 | for(int l=0;l<1;l++)\ | |||
|
104 | {\ | |||
|
105 | ssd2119setFrame(LCD,X,Y,1,H);\ | |||
|
106 | int rem=(ContSz)%buffContsize;\ | |||
|
107 | if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ | |||
|
108 | for(int i=rem;i<(ContSz);i+=buffContsize)\ | |||
|
109 | {\ | |||
|
110 | LCD->interface->writeGRAM(bufferCont,buffContsize);\ | |||
|
111 | }\ | |||
|
112 | if(ContSz<H) \ | |||
|
113 | {\ | |||
|
114 | rem=(H-ContSz)%buffIntsize;\ | |||
|
115 | if(rem)LCD->interface->writeGRAM(bufferInt,rem);\ | |||
|
116 | for(int i=rem;i<(H-ContSz);i+=buffIntsize)\ | |||
|
117 | {\ | |||
|
118 | LCD->interface->writeGRAM(bufferInt,buffIntsize);\ | |||
|
119 | }\ | |||
|
120 | }\ | |||
|
121 | }\ | |||
|
122 | ||||
|
123 | ||||
|
124 | #define ilipaintHalfBottomVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ | |||
|
125 | for(int l=0;l<1;l++)\ | |||
|
126 | {\ | |||
|
127 | ssd2119setFrame(LCD,X,Y,1,H);\ | |||
|
128 | int rem;\ | |||
|
129 | if(ContSz<H) \ | |||
|
130 | {\ | |||
|
131 | rem=(H-ContSz)%buffIntsize;\ | |||
|
132 | if(rem)LCD->interface->writeGRAM(bufferInt,rem);\ | |||
|
133 | for(int i=rem;i<(H-ContSz);i+=buffIntsize)\ | |||
|
134 | {\ | |||
|
135 | LCD->interface->writeGRAM(bufferInt,buffIntsize);\ | |||
|
136 | }\ | |||
|
137 | }\ | |||
|
138 | rem=(ContSz)%buffContsize;\ | |||
|
139 | if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ | |||
|
140 | for(int i=rem;i<(ContSz);i+=buffContsize)\ | |||
|
141 | {\ | |||
|
142 | LCD->interface->writeGRAM(bufferCont,buffContsize);\ | |||
|
143 | }\ | |||
|
144 | }\ | |||
|
145 | ||||
|
146 | ||||
|
147 | void ssd2119setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress) | |||
|
148 | { | |||
|
149 | LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,Haddress); | |||
|
150 | LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,Vaddress); | |||
|
151 | } | |||
|
152 | ||||
|
153 | void ssd2119refreshenable(struct LCD_t* LCD,int enable) | |||
|
154 | { | |||
|
155 | if(enable) | |||
|
156 | { | |||
|
157 | //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1018); | |||
|
158 | } | |||
|
159 | else | |||
|
160 | { | |||
|
161 | //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1008); | |||
|
162 | ||||
|
163 | } | |||
|
164 | } | |||
|
165 | ||||
|
166 | void ssd2119setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H) | |||
|
167 | { | |||
|
168 | LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,(uint32_t)X); | |||
|
169 | LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,(uint32_t)Y); | |||
|
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)); | |||
|
172 | LCD->interface->writereg(SSD2119_REGISTER_V_RAM_POS,(((uint32_t)(Y+H-1))<<8) + (uint32_t)Y); | |||
|
173 | } | |||
|
174 | ||||
|
175 | void ssd2119paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height) | |||
|
176 | { | |||
|
177 | if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height))) | |||
|
178 | { | |||
|
179 | ssd2119setFrame(LCD,Xpos,Ypos,Width,Height); | |||
|
180 | LCD->interface->writeGRAM(buffer,Width*Height); | |||
|
181 | } | |||
|
182 | } | |||
|
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) | |||
|
185 | { | |||
|
186 | //Based on the mid point circle algorithm from Wikipedia | |||
|
187 | //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm | |||
|
188 | uint16_t innerbuffer[16]; | |||
|
189 | uint16_t outterbuffer[16]; | |||
|
190 | for(int i=0;i<16;i++)innerbuffer[i]=fillColor; | |||
|
191 | for(int i=0;i<16;i++)outterbuffer[i]=contColor; | |||
|
192 | if(contSz<r) | |||
|
193 | { | |||
|
194 | int error = -r,error_int = -r+contSz; | |||
|
195 | int x = r,x_int=r-contSz; | |||
|
196 | int y = 0,y_int=0; | |||
|
197 | while (x >= y) | |||
|
198 | { | |||
|
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); | |||
|
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); | |||
|
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); | |||
|
205 | error += y; | |||
|
206 | ++y; | |||
|
207 | error += y; | |||
|
208 | error_int += y_int; | |||
|
209 | ++y_int; | |||
|
210 | error_int += y_int; | |||
|
211 | if(error >= 0) | |||
|
212 | { | |||
|
213 | error -= x; | |||
|
214 | --x; | |||
|
215 | error -= x; | |||
|
216 | } | |||
|
217 | if(error_int >= 0) | |||
|
218 | { | |||
|
219 | error_int -= x_int; | |||
|
220 | --x_int; | |||
|
221 | error_int -= x_int; | |||
|
222 | } | |||
|
223 | } | |||
|
224 | ||||
|
225 | ||||
|
226 | ||||
|
227 | } | |||
|
228 | ||||
|
229 | } | |||
|
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) | |||
|
232 | { | |||
|
233 | if(contSz<r) | |||
|
234 | { | |||
|
235 | uint16_t innerbuffer[16]; | |||
|
236 | uint16_t outterbuffer[16]; | |||
|
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; | |||
|
239 | for(int i=0;i<16;i++)outterbuffer[i]=contColor; | |||
|
240 | /* Y = b +/- sqrt[r^2 - (x - a)^2] */ | |||
|
241 | for(int32_t line=-r;line<r;line++) | |||
|
242 | { | |||
|
243 | #ifdef __OPTIMIZED_MATH | |||
|
244 | Val1 = (uint32_t)optimised_sqrt((float32_t)(rr - (line*line)) ); | |||
|
245 | Val2 = (uint32_t)optimised_sqrt((float32_t)(rr2 - (line*line)) ); | |||
|
246 | #else | |||
|
247 | Val1 = sqrt( (double)(rr - ((line)*(line))) ); | |||
|
248 | Val2 = sqrt( (double)(rr2 - ((line)*(line))) ); | |||
|
249 | #endif | |||
|
250 | X1=Xpos - Val1; | |||
|
251 | contSz2= Val1-Val2; | |||
|
252 | ssd2119setFrame(LCD,X1,line+Ypos,2*Val1,1); | |||
|
253 | rem=(contSz2)%16; | |||
|
254 | if(rem)LCD->interface->writeGRAM(outterbuffer,rem); | |||
|
255 | for(int i=rem;i<(contSz2);i+=16) | |||
|
256 | { | |||
|
257 | LCD->interface->writeGRAM(outterbuffer,16); | |||
|
258 | } | |||
|
259 | ||||
|
260 | W=2*Val1; | |||
|
261 | if(W>(2*contSz2)) | |||
|
262 | { | |||
|
263 | W-=2*contSz2; | |||
|
264 | rem=(W)%16; | |||
|
265 | if(rem)LCD->interface->writeGRAM(innerbuffer,rem); | |||
|
266 | for(int i=rem;i<(W);i+=16) | |||
|
267 | { | |||
|
268 | LCD->interface->writeGRAM(innerbuffer,16); | |||
|
269 | } | |||
|
270 | } | |||
|
271 | ||||
|
272 | rem=(contSz2)%16; | |||
|
273 | if(rem)LCD->interface->writeGRAM(outterbuffer,rem); | |||
|
274 | for(int i=rem;i<(contSz2);i+=16) | |||
|
275 | { | |||
|
276 | LCD->interface->writeGRAM(outterbuffer,16); | |||
|
277 | } | |||
|
278 | } | |||
|
279 | } | |||
|
280 | } | |||
|
281 | ||||
|
282 | ||||
|
283 | ||||
|
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) | |||
|
286 | { | |||
|
287 | ssd2119setFrame(LCD,Xpos,Ypos,w,h); | |||
|
288 | uint16_t tmp[32]; | |||
|
289 | for(int i=0;i<32;i++)tmp[i]=fillColor; | |||
|
290 | for(int i=0;i<(h*w);i+=32) | |||
|
291 | { | |||
|
292 | LCD->interface->writeGRAM(tmp,32); | |||
|
293 | } | |||
|
294 | int rem=(w*h)%32; | |||
|
295 | if(rem)LCD->interface->writeGRAM(tmp,rem); | |||
|
296 | if(contSz) | |||
|
297 | { | |||
|
298 | ssd2119setFrame(LCD,Xpos,Ypos,w,contSz); | |||
|
299 | for(int i=0;i<32;i++)tmp[i]=contColor; | |||
|
300 | rem=(w*contSz)%32; | |||
|
301 | if(rem)LCD->interface->writeGRAM(tmp,rem); | |||
|
302 | for(int i=rem;i<(w*contSz);i+=32) | |||
|
303 | { | |||
|
304 | LCD->interface->writeGRAM(tmp,32); | |||
|
305 | } | |||
|
306 | ||||
|
307 | ssd2119setFrame(LCD,Xpos,Ypos+h-contSz,w,contSz); | |||
|
308 | rem=(w*contSz)%32; | |||
|
309 | if(rem)LCD->interface->writeGRAM(tmp,rem); | |||
|
310 | for(int i=rem;i<(w*contSz);i+=32) | |||
|
311 | { | |||
|
312 | LCD->interface->writeGRAM(tmp,32); | |||
|
313 | } | |||
|
314 | ||||
|
315 | ssd2119setFrame(LCD,Xpos,Ypos,contSz,h); | |||
|
316 | rem=(h*contSz)%32; | |||
|
317 | if(rem)LCD->interface->writeGRAM(tmp,rem); | |||
|
318 | for(int i=rem;i<(h*contSz);i+=32) | |||
|
319 | { | |||
|
320 | LCD->interface->writeGRAM(tmp,32); | |||
|
321 | } | |||
|
322 | ||||
|
323 | ssd2119setFrame(LCD,Xpos+w-contSz,Ypos,contSz,h); | |||
|
324 | rem=(h*contSz)%32; | |||
|
325 | if(rem)LCD->interface->writeGRAM(tmp,rem); | |||
|
326 | for(int i=rem;i<(h*contSz);i+=32) | |||
|
327 | { | |||
|
328 | LCD->interface->writeGRAM(tmp,32); | |||
|
329 | } | |||
|
330 | } | |||
|
331 | } | |||
|
332 | ||||
|
333 | void ssd2119paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color) | |||
|
334 | { | |||
|
335 | int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0; | |||
|
336 | uint16_t tmp[w]; | |||
|
337 | uint16_t linenum=0,charnum=0; | |||
|
338 | uint8_t line=0; | |||
|
339 | while(*buffer!='\0') | |||
|
340 | { | |||
|
341 | ssd2119setFrame(LCD,Xpos+(charnum*w),Ypos-h,w,1); | |||
|
342 | LCD->interface->readGRAM(tmp,w); | |||
|
343 | for(int i=0;i<(h*w);i++) | |||
|
344 | { | |||
|
345 | if( ((i%w)==0) ) //read current line to apply text pixmap | |||
|
346 | { | |||
|
347 | if(linenum++>0) | |||
|
348 | { | |||
|
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); | |||
|
351 | ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum + 1-h,w,1); | |||
|
352 | LCD->interface->readGRAM(tmp,w); | |||
|
353 | pix=0; | |||
|
354 | } | |||
|
355 | } | |||
|
356 | if((pix%8) == 0) | |||
|
357 | { | |||
|
358 | line=font->table[(((*buffer)-32)*h*bpl)+tableoffset++]; | |||
|
359 | } | |||
|
360 | if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color; | |||
|
361 | pix++; | |||
|
362 | line>>=1; | |||
|
363 | } | |||
|
364 | linenum=0; | |||
|
365 | tableoffset=0; | |||
|
366 | charnum++; | |||
|
367 | buffer++; | |||
|
368 | } | |||
|
369 | } | |||
|
370 | ||||
|
371 | ||||
|
372 | int ssd2119init(struct LCD_t* LCD) | |||
|
373 | { | |||
|
374 | if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL)) | |||
|
375 | { | |||
|
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 | |||
|
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 | |||
|
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 | |||
|
382 | LCD->interface->writereg(0x11,0x6870); // Entry Mode - Page 50-52 of SSD2119 datasheet | |||
|
383 | ||||
|
384 | // RAM WRITE DATA MASK | |||
|
385 | LCD->interface->writereg(0x0f,0x0000); // Gate Scan Position - Page 49 of SSD2119 datasheet | |||
|
386 | // RAM WRITE DATA MASK | |||
|
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 | |||
|
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 | |||
|
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 | |||
|
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 | |||
|
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 | |||
|
397 | ||||
|
398 | // -----------------Adjust the Gamma Curve----// | |||
|
399 | LCD->interface->writereg(0x30,0x0000); //0007 | |||
|
400 | LCD->interface->writereg(0x31,0x0104); //0203 | |||
|
401 | LCD->interface->writereg(0x32,0x0100); //0001 | |||
|
402 | LCD->interface->writereg(0x33,0x0305); //0007 | |||
|
403 | LCD->interface->writereg(0x34,0x0505); //0007 | |||
|
404 | LCD->interface->writereg(0x35,0x0305); //0407 | |||
|
405 | LCD->interface->writereg(0x36,0x0707); //0407 | |||
|
406 | LCD->interface->writereg(0x37,0x0300); //0607 | |||
|
407 | LCD->interface->writereg(0x3a,0x1200); //0106 | |||
|
408 | LCD->interface->writereg(0x3b,0x0800); | |||
|
409 | LCD->interface->writereg(0x07,0x0033); // Display Control - Page 45 of SSD2119 datasheet | |||
|
410 | } | |||
|
411 | return 0; | |||
|
412 | } | |||
|
413 | ||||
|
414 | ||||
|
415 | ||||
|
416 |
@@ -0,0 +1,22 | |||||
|
1 | TEMPLATE = lib | |||
|
2 | OBJECTS_DIR = obj | |||
|
3 | TARGET = ssd2119 | |||
|
4 | ||||
|
5 | SOURCES += \ | |||
|
6 | ssd2119.c | |||
|
7 | ||||
|
8 | DEFINES -= __OPTIMIZED_MATH | |||
|
9 | ||||
|
10 | INCLUDEPATH += ../../../../includes \ | |||
|
11 | ../../../CPU/STM32F4xx_StdPeriph_Driver/inc \ | |||
|
12 | ../../../CPU/CMSIS/Include \ | |||
|
13 | ../../../../includes/GRAPHIC/CONTROLERS \ | |||
|
14 | ../../../../includes/GRAPHIC/GUI/FONTS \ | |||
|
15 | ../../../../includes/GRAPHIC/GUI/Widgets | |||
|
16 | ||||
|
17 | ||||
|
18 | UCMODEL=stm32f4 | |||
|
19 | ||||
|
20 | target.path = $$[QT_INSTALL_LIBS]/$$UCMODEL | |||
|
21 | INSTALLS += target | |||
|
22 |
@@ -0,0 +1,93 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the libuc, microcontroler library | |||
|
3 | -- Copyright (C) 2013, Alexis Jeandet | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@gmail.com | |||
|
21 | -------------------------------------------------------------------------------*/ | |||
|
22 | #ifndef SSD2119_H | |||
|
23 | #define SSD2119_H | |||
|
24 | ||||
|
25 | #include <uhandle.h> | |||
|
26 | #include <genericLCD_Controler.h> | |||
|
27 | #include <stdint.h> | |||
|
28 | #include <fonts.h> | |||
|
29 | ||||
|
30 | extern int ssd2119init(struct LCD_t* LCD); | |||
|
31 | extern void ssd2119setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H); | |||
|
32 | extern void ssd2119setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress); | |||
|
33 | extern void ssd2119paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height); | |||
|
34 | extern void ssd2119paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT *font,uint32_t color); | |||
|
35 | extern 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); | |||
|
36 | extern void ssd2119paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); | |||
|
37 | extern void ssd2119paintFilCircMidPoint(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); | |||
|
38 | extern void ssd2119refreshenable(struct LCD_t* LCD,int enable); | |||
|
39 | ||||
|
40 | /* SSD2119 registers */ | |||
|
41 | ||||
|
42 | #define SSD2119_REGISTER_DEVICE_CODE_READ ((uint32_t)0x00) | |||
|
43 | #define SSD2119_REGISTER_OSC_START ((uint32_t)0x00) | |||
|
44 | #define SSD2119_REGISTER_OUTPUT_CTRL ((uint32_t)0x01) | |||
|
45 | #define SSD2119_REGISTER_LCD_DRIVE_AC_CTRL ((uint32_t)0x02) | |||
|
46 | #define SSD2119_REGISTER_PWR_CTRL_1 ((uint32_t)0x03) | |||
|
47 | #define SSD2119_REGISTER_DISPLAY_CTRL ((uint32_t)0x07) | |||
|
48 | #define SSD2119_REGISTER_FRAME_CYCLE_CTRL ((uint32_t)0x0B) | |||
|
49 | #define SSD2119_REGISTER_PWR_CTRL_2 ((uint32_t)0x0C) | |||
|
50 | #define SSD2119_REGISTER_PWR_CTRL_3 ((uint32_t)0x0D) | |||
|
51 | #define SSD2119_REGISTER_PWR_CTRL_4 ((uint32_t)0x0E) | |||
|
52 | #define SSD2119_REGISTER_GATE_SCAN_START ((uint32_t)0x0F) | |||
|
53 | #define SSD2119_REGISTER_SLEEP_MODE_1 ((uint32_t)0x10) | |||
|
54 | #define SSD2119_REGISTER_ENTRY_MODE ((uint32_t)0x11) | |||
|
55 | #define SSD2119_REGISTER_SLEEP_MODE_2 ((uint32_t)0x12) | |||
|
56 | #define SSD2119_REGISTER_GEN_IF_CTRL ((uint32_t)0x15) | |||
|
57 | #define SSD2119_REGISTER_H_PORCH ((uint32_t)0x16) | |||
|
58 | #define SSD2119_REGISTER_V_PORCH ((uint32_t)0x17) | |||
|
59 | #define SSD2119_REGISTER_PWR_CTRL_5 ((uint32_t)0x1E) | |||
|
60 | #define SSD2119_REGISTER_UNIFORMITY ((uint32_t)0x20) | |||
|
61 | #define SSD2119_REGISTER_RAM_DATA ((uint32_t)0x22) | |||
|
62 | #define SSD2119_REGISTER_FRAME_FREQ ((uint32_t)0x25) | |||
|
63 | #define SSD2119_REGISTER_ANALOG_SET ((uint32_t)0x26) | |||
|
64 | #define SSD2119_REGISTER_VCOM_OTP_1 ((uint32_t)0x28) | |||
|
65 | #define SSD2119_REGISTER_VCOM_OTP_2 ((uint32_t)0x29) | |||
|
66 | #define SSD2119_REGISTER_GAMMA_CTRL_1 ((uint32_t)0x30) | |||
|
67 | #define SSD2119_REGISTER_GAMMA_CTRL_2 ((uint32_t)0x31) | |||
|
68 | #define SSD2119_REGISTER_GAMMA_CTRL_3 ((uint32_t)0x32) | |||
|
69 | #define SSD2119_REGISTER_GAMMA_CTRL_4 ((uint32_t)0x33) | |||
|
70 | #define SSD2119_REGISTER_GAMMA_CTRL_5 ((uint32_t)0x34) | |||
|
71 | #define SSD2119_REGISTER_GAMMA_CTRL_6 ((uint32_t)0x35) | |||
|
72 | #define SSD2119_REGISTER_GAMMA_CTRL_7 ((uint32_t)0x36) | |||
|
73 | #define SSD2119_REGISTER_GAMMA_CTRL_8 ((uint32_t)0x37) | |||
|
74 | #define SSD2119_REGISTER_GAMMA_CTRL_9 ((uint32_t)0x3A) | |||
|
75 | #define SSD2119_REGISTER_GAMMA_CTRL_10 ((uint32_t)0x3B) | |||
|
76 | #define SSD2119_REGISTER_V_SCROLL_1 ((uint32_t)0x41) | |||
|
77 | #define SSD2119_REGISTER_V_SCROLL_2 ((uint32_t)0x42) | |||
|
78 | #define SSD2119_REGISTER_V_RAM_POS ((uint32_t)0x44) | |||
|
79 | #define SSD2119_REGISTER_H_RAM_START ((uint32_t)0x45) | |||
|
80 | #define SSD2119_REGISTER_H_RAM_END ((uint32_t)0x46) | |||
|
81 | #define SSD2119_REGISTER_1_DRV_POS_1 ((uint32_t)0x48) | |||
|
82 | #define SSD2119_REGISTER_1_DRV_POS_2 ((uint32_t)0x49) | |||
|
83 | #define SSD2119_REGISTER_2_DRV_POS_1 ((uint32_t)0x4A) | |||
|
84 | #define SSD2119_REGISTER_2_DRV_POS_2 ((uint32_t)0x4B) | |||
|
85 | #define SSD2119_REGISTER_X_RAM_ADDR ((uint32_t)0x4E) | |||
|
86 | #define SSD2119_REGISTER_Y_RAM_ADDR ((uint32_t)0x4F) | |||
|
87 | ||||
|
88 | #endif | |||
|
89 | ||||
|
90 | ||||
|
91 | ||||
|
92 | ||||
|
93 |
@@ -81,19 +81,21 void bsp_uart_init() | |||||
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,115200,PA9,PA10,-1,-1); |
|
85 | uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1); | |
85 | uartmkstreamdev(uart,fd1); |
|
86 | uartmkstreamdev(uart,fd1); | |
86 | __opnfiles__[1] = fd1; |
|
87 | __opnfiles__[1] = fd1; | |
87 | } |
|
88 | } | |
88 | else |
|
89 | else | |
89 | { |
|
90 | { | |
|
91 | // uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1); | |||
90 | uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1); |
|
92 | uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1); | |
91 | } |
|
93 | } | |
92 | } |
|
94 | } | |
93 |
|
95 | |||
94 | void bsp_spi_init() |
|
96 | void bsp_spi_init() | |
95 | { |
|
97 | { | |
96 |
spiopenandconfig(spi1,spi8bits | spimaster |spiclkinhlow | spiclkfirstedge | spimsbfirst, |
|
98 | spiopenandconfig(spi1,spi8bits | spimaster |spiclkinhlow | spiclkfirstedge | spimsbfirst,4000000,DAC_DIN,ADC_DOUT1,ADC_SCLK,-1); | |
97 | } |
|
99 | } | |
98 |
|
100 | |||
99 |
|
101 |
@@ -5,7 +5,8 SUBDIRS += STM32F4Discovery \ | |||||
5 | M4StickV2 \ |
|
5 | M4StickV2 \ | |
6 | SOLAR_LFR_PSU \ |
|
6 | SOLAR_LFR_PSU \ | |
7 | BEAGLESYNTH \ |
|
7 | BEAGLESYNTH \ | |
8 | STM32F4Eval |
|
8 | STM32F4Eval \ | |
|
9 | STM32F4Discovery-EXT | |||
9 |
|
10 | |||
10 |
|
11 | |||
11 |
|
12 |
@@ -5,6 +5,9 UCMODEL=stm32f4 | |||||
5 |
|
5 | |||
6 | BSP=M4StickV2 |
|
6 | BSP=M4StickV2 | |
7 |
|
7 | |||
|
8 | ||||
|
9 | DEFINES += CPUFREQ=80000000 | |||
|
10 | ||||
8 | SOURCES += \ |
|
11 | SOURCES += \ | |
9 | main.c |
|
12 | main.c | |
10 |
|
13 |
@@ -9,7 +9,8 | |||||
9 | void ads1278readOut(spi_t spidev,int32_t* data) |
|
9 | void ads1278readOut(spi_t spidev,int32_t* data) | |
10 | { |
|
10 | { | |
11 | gpioset(ADC_FSYNC); |
|
11 | gpioset(ADC_FSYNC); | |
12 | delay_100us(1); |
|
12 | //delay_100us(1); | |
|
13 | for(volatile int i=0;i<50;i++); | |||
13 | gpioclr(ADC_FSYNC); |
|
14 | gpioclr(ADC_FSYNC); | |
14 | for(int i=0;i<8;i++) |
|
15 | for(int i=0;i<8;i++) | |
15 | { |
|
16 | { | |
@@ -23,20 +24,92 void ads1278readOut(spi_t spidev,int32_t | |||||
23 |
|
24 | |||
24 | void pushData(int32_t* data) |
|
25 | void pushData(int32_t* data) | |
25 | { |
|
26 | { | |
26 | printf("%d;%d;%d\n\r",(int)data[0],(int)data[1],(int)data[2]); |
|
27 | // printf("%f\t%f\t%f\n",(6.0/(8*1000*1000)) *data[0],(6.0/(8*1000*1000))*data[1],(6.0/(8*1000*1000))*data[2]); | |
|
28 | printf("%f\n",(6.0/(16*1000*1000)) *data[0]); | |||
|
29 | ||||
|
30 | } | |||
|
31 | ||||
|
32 | void pushData2(int32_t* data) | |||
|
33 | { | |||
|
34 | char buffer[29]; | |||
|
35 | buffer[0] = 0xa5; | |||
|
36 | buffer[1] = 0x0f; | |||
|
37 | buffer[2] = 0x00; | |||
|
38 | buffer[27] = 0xf0; | |||
|
39 | buffer[28] = 0x5a; | |||
|
40 | for(int i=0;i<8;i++) | |||
|
41 | { | |||
|
42 | buffer[(i*3)+3] = (char)data[i]>>16; | |||
|
43 | buffer[(i*3)+4] = (char)data[i]>>8; | |||
|
44 | buffer[(i*3)+5] = (char)data[i]; | |||
|
45 | } | |||
|
46 | uartputnc(uart1,buffer,29); | |||
27 | } |
|
47 | } | |
28 |
|
48 | |||
|
49 | void sample() | |||
|
50 | { | |||
|
51 | int32_t data[8]; | |||
|
52 | data[0]=0x712345; | |||
|
53 | char buffer[2+1+3+2]; | |||
|
54 | buffer[0] = 0xa5; | |||
|
55 | buffer[1] = 0x0f; | |||
|
56 | buffer[2] = 0x00; | |||
|
57 | buffer[2+1+3] = 0xf0; | |||
|
58 | buffer[2+1+4] = 0x5a; | |||
|
59 | while(1) | |||
|
60 | { | |||
|
61 | //uartputnc(uart1,buffer,3); | |||
|
62 | uartputc(uart1,0xa5); | |||
|
63 | uartputc(uart1,0x0f); | |||
|
64 | uartputc(uart1,0x01); | |||
|
65 | uartputc(uart1,25); | |||
|
66 | for(int i=0;i<8;i++) | |||
|
67 | { | |||
|
68 | //ads1278readOut(spi1,data); | |||
|
69 | uartputc(uart1,(char)0x1);//(data[0])>>16); | |||
|
70 | uartputc(uart1,(char)0x2);//(data[0]>>8)); | |||
|
71 | uartputc(uart1,(char)0x3);//(data[0]>>0)); | |||
|
72 | } | |||
|
73 | uartputc(uart1,0xf0); | |||
|
74 | uartputc(uart1,0x5a); | |||
|
75 | } | |||
|
76 | } | |||
29 |
|
77 | |||
30 | int main() |
|
78 | int main() | |
31 | { |
|
79 | { | |
32 | int32_t data[8]; |
|
80 | int32_t data[8]; | |
|
81 | char test=0; | |||
|
82 | for(int i=0;i<500;i++) | |||
|
83 | { | |||
|
84 | ads1278readOut(spi1,data); | |||
|
85 | delay_100us(10); | |||
|
86 | } | |||
|
87 | sample(); | |||
|
88 | //while(1) | |||
|
89 | //{ | |||
|
90 | // uartputc(uart1,test++); | |||
|
91 | //} | |||
33 |
|
92 | |||
34 | while(1) |
|
93 | // while(1) | |
35 | { |
|
94 | // { | |
36 | ads1278readOut(spi1,data); |
|
95 | // ads1278readOut(spi1,data); | |
37 | gpioclr(LED2); |
|
96 | // gpioclr(LED2); | |
38 |
delay_100us(1 |
|
97 | // //delay_100us(100); | |
39 | pushData(data); |
|
98 | //// for(volatile int i=0;i<100;i++); | |
40 | gpioset(LED2); |
|
99 | // pushData(data); | |
41 | } |
|
100 | // gpioset(LED2); | |
|
101 | // //delay_100us(100); | |||
|
102 | // } | |||
42 | } |
|
103 | } | |
|
104 | ||||
|
105 | ||||
|
106 | ||||
|
107 | ||||
|
108 | ||||
|
109 | ||||
|
110 | ||||
|
111 | ||||
|
112 | ||||
|
113 | ||||
|
114 | ||||
|
115 |
@@ -36,7 +36,7 void resetHold(int rhstate) | |||||
36 |
|
36 | |||
37 | int main() |
|
37 | int main() | |
38 | { |
|
38 | { | |
39 |
spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13, |
|
39 | spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13,-1); | |
40 | //spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13,PB12); |
|
40 | //spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13,PB12); | |
41 | gpio_t PC1pin= gpioopen(PC1); |
|
41 | gpio_t PC1pin= gpioopen(PC1); | |
42 | gpiosetdir(&PC1pin,gpiooutdir); |
|
42 | gpiosetdir(&PC1pin,gpiooutdir); |
@@ -10,7 +10,8 SUBDIRS += QtTest/test.pro \ | |||||
10 | lcdTerminal \ |
|
10 | lcdTerminal \ | |
11 | BeagleSynthHelloSupMon \ |
|
11 | BeagleSynthHelloSupMon \ | |
12 | TEST_CMSIS_FFT \ |
|
12 | TEST_CMSIS_FFT \ | |
13 | N25Q128_test |
|
13 | N25Q128_test \ | |
|
14 | ssd2119Tests | |||
14 |
|
15 | |||
15 |
|
16 | |||
16 |
|
17 |
@@ -1,5 +1,6 | |||||
1 | TEMPLATE = subdirs |
|
1 | TEMPLATE = subdirs | |
2 | SUBDIRS += ILI9328 |
|
2 | SUBDIRS += ILI9328 \ | |
|
3 | SSD2119 | |||
3 |
|
4 | |||
4 |
|
5 | |||
5 |
|
6 | |||
@@ -7,3 +8,4 SUBDIRS += ILI9328 | |||||
7 |
|
8 | |||
8 |
|
9 | |||
9 |
|
10 | |||
|
11 |
@@ -7,7 +7,7 INCLUDEPATH += $$[QT_INSTALL_HEADERS] \ | |||||
7 | $$[QT_INSTALL_HEADERS]/$$ARCH |
|
7 | $$[QT_INSTALL_HEADERS]/$$ARCH | |
8 |
|
8 | |||
9 |
|
9 | |||
10 | LIBS += -L$$[QT_INSTALL_LIBS]/$$ARCH -lterminal -lCS43L22 -lina226 -lili9328 -lSTMPE811 -lfonts -lsdcard -lfat32 -lmbr -luart -li2c -lgpio -lspi -lcpu -lcore -lm |
|
10 | LIBS += -L$$[QT_INSTALL_LIBS]/$$ARCH -lterminal -lCS43L22 -lina226 -lili9328 -lssd2119 -lSTMPE811 -lfonts -lsdcard -lfat32 -lmbr -luart -li2c -lgpio -lspi -lcpu -lcore -lm | |
11 |
|
11 | |||
12 |
|
12 | |||
13 |
|
13 |
@@ -45,7 +45,9 contains( TEMPLATE, app ) { | |||||
45 |
|
45 | |||
46 | stflash.target = stflash |
|
46 | stflash.target = stflash | |
47 | stflash.commands = cd $$DESTDIR && sudo st-flash write $(QMAKE_TARGET).bin 0x08000000 |
|
47 | stflash.commands = cd $$DESTDIR && sudo st-flash write $(QMAKE_TARGET).bin 0x08000000 | |
48 | QMAKE_EXTRA_TARGETS += stflash |
|
48 | dfu.target = dfu | |
|
49 | dfu.commands = cd $$DESTDIR && sudo dfu-util d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D $(QMAKE_TARGET).bin 0x08000000 | |||
|
50 | QMAKE_EXTRA_TARGETS += stflash dfu | |||
49 | } |
|
51 | } | |
50 |
|
52 | |||
51 | contains( TEMPLATE, lib ) { |
|
53 | contains( TEMPLATE, lib ) { |
General Comments 0
You need to be logged in to leave comments.
Login now