@@ -85,7 +85,7 void bsp_uart_init() | |||||
85 | } |
|
85 | } | |
86 | else |
|
86 | else | |
87 | { |
|
87 | { | |
88 |
uartopenandconfig( |
|
88 | uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1); | |
89 | } |
|
89 | } | |
90 | } |
|
90 | } | |
91 |
|
91 |
@@ -4,7 +4,8 SUBDIRS += QtTest/test.pro \ | |||||
4 | SOLAR_PSU_HELLO/hello.pro \ |
|
4 | SOLAR_PSU_HELLO/hello.pro \ | |
5 | SDCARD \ |
|
5 | SDCARD \ | |
6 | STM32F4IT \ |
|
6 | STM32F4IT \ | |
7 | BeagleSynthHello |
|
7 | BeagleSynthHello \ | |
|
8 | ../../../home/jeandet/hello | |||
8 |
|
9 | |||
9 |
|
10 | |||
10 |
|
11 |
@@ -31,6 +31,18 | |||||
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) \ | |||
|
35 | for(int l=0;l<1;l++)\ | |||
|
36 | {\ | |||
|
37 | ili9328setFrame(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 | ||||
34 | void ili9328setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress) |
|
46 | void ili9328setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress) | |
35 | { |
|
47 | { | |
36 | LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,Haddress); |
|
48 | LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,Haddress); | |
@@ -71,12 +83,30 void ili9328paint(LCD_t* LCD,void* buffe | |||||
71 |
|
83 | |||
72 | void ili9328paintFilCircMidPoint(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor) |
|
84 | void ili9328paintFilCircMidPoint(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor) | |
73 | { |
|
85 | { | |
|
86 | //Based on the mid point circle algorithm from Wikipedia | |||
|
87 | //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm | |||
|
88 | ||||
74 | if(contSz<r) |
|
89 | if(contSz<r) | |
75 | { |
|
90 | { | |
76 | for(int i=0;i<(r/2);i++) |
|
91 | int f = 1 - r; | |
77 | { |
|
92 | int ddF_x = 1; | |
|
93 | int ddF_y = -2 * r; | |||
|
94 | int x = 0; | |||
|
95 | int y = r; | |||
|
96 | uint16_t tmp1[16]; | |||
|
97 | uint16_t tmp2[16]; | |||
|
98 | for(int i=0;i<16;i++)tmp1[i]=fillColor; | |||
|
99 | for(int i=0;i<16;i++)tmp2[i]=contColor; | |||
|
100 | ilipaintLine(LCD,Xpos-r,Ypos,2*r,tmp1,16); | |||
|
101 | ilipaintLine(LCD,Xpos-r,Ypos+1,2*r,tmp1,16); | |||
|
102 | ilipaintLine(LCD,Xpos-1,Ypos+r,2,tmp1,16); | |||
|
103 | ilipaintLine(LCD,Xpos,Ypos-r,2,tmp1,16); | |||
|
104 | setPixel(x0, y0 + radius); | |||
|
105 | setPixel(x0, y0 - radius); | |||
|
106 | setPixel(x0 + radius, y0); | |||
|
107 | setPixel(x0 - radius, y0); | |||
78 |
|
108 | |||
79 | } |
|
109 | ||
80 | } |
|
110 | } | |
81 |
|
111 | |||
82 | } |
|
112 | } |
@@ -38,17 +38,34 void SysTick_Handler(void) | |||||
38 | tickCounter+=1; |
|
38 | tickCounter+=1; | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
|
41 | void delay_us(uint32_t value) | |||
|
42 | { | |||
|
43 | extern uint32_t currentCpuFreq; | |||
|
44 | if(value) | |||
|
45 | { | |||
|
46 | uint32_t tickperus=currentCpuFreq/(1000*10); | |||
|
47 | uint32_t SysTickSnap = SysTick->VAL+((value%100)*tickperus); | |||
|
48 | uint32_t targetVal=tickCounterSnap +(value/100); | |||
|
49 | if(targetVal < tickCounterSnap) | |||
|
50 | { | |||
|
51 | while(tickCounter > targetVal); | |||
|
52 | } | |||
|
53 | while((tickCounter < targetVal) | (SysTick->VAL<SysTickSnap)); | |||
|
54 | } | |||
|
55 | } | |||
|
56 | ||||
41 | void delay_100us(uint32_t value) |
|
57 | void delay_100us(uint32_t value) | |
42 | { |
|
58 | { | |
43 | if(value) |
|
59 | if(value) | |
44 | { |
|
60 | { | |
45 | uint32_t tickCounterSnap = tickCounter; |
|
61 | uint32_t tickCounterSnap = tickCounter; | |
|
62 | uint32_t SysTickSnap = SysTick->VAL; | |||
46 | uint32_t targetVal=tickCounterSnap +(value); |
|
63 | uint32_t targetVal=tickCounterSnap +(value); | |
47 | if(targetVal < tickCounterSnap) |
|
64 | if(targetVal < tickCounterSnap) | |
48 | { |
|
65 | { | |
49 | while(tickCounter > targetVal); |
|
66 | while(tickCounter > targetVal); | |
50 | } |
|
67 | } | |
51 | while(tickCounter < targetVal); |
|
68 | while((tickCounter < targetVal) | (SysTick->VAL<SysTickSnap)); | |
52 | } |
|
69 | } | |
53 | } |
|
70 | } | |
54 |
|
71 |
General Comments 0
You need to be logged in to leave comments.
Login now