波形显示区域的网格构建成功

This commit is contained in:
zhan-min 2020-12-10 23:18:02 +08:00
parent d04f31f543
commit 4c0eb8b35a
12 changed files with 5989 additions and 1917 deletions

View File

@ -0,0 +1,513 @@
ARM Macro Assembler Page 1
1 00000000 ;/*
2 00000000 ; * File : context_rvds.S
3 00000000 ; * This file is part of RT-Thread RTOS
4 00000000 ; * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Tea
m
5 00000000 ; *
6 00000000 ; * The license and distribution terms for this file may
be
7 00000000 ; * found in the file LICENSE in this distribution or at
8 00000000 ; * http://www.rt-thread.org/license/LICENSE
9 00000000 ; *
10 00000000 ; * Change Logs:
11 00000000 ; * Date Author Notes
12 00000000 ; * 2009-01-17 Bernard first version
13 00000000 ; * 2013-06-18 aozima add restore MSP feature.
14 00000000 ; * 2013-07-09 aozima enhancement hard fault e
xception handler.
15 00000000 ; */
16 00000000
17 00000000 ;/**
18 00000000 ; * @addtogroup CORTEX-M3
19 00000000 ; */
20 00000000 ;/*@{*/
21 00000000
22 00000000 E000ED08
SCB_VTOR
EQU 0xE000ED08 ; Vector Table Offs
et Register
23 00000000 E000ED04
NVIC_INT_CTRL
EQU 0xE000ED04 ; interrupt control
state register
24 00000000 E000ED20
NVIC_SYSPRI2
EQU 0xE000ED20 ; system priority r
egister (2)
25 00000000 00FF0000
NVIC_PENDSV_PRI
EQU 0x00FF0000 ; PendSV priority v
alue (lowest)
26 00000000 10000000
NVIC_PENDSVSET
EQU 0x10000000 ; value to trigger
PendSV exception
27 00000000
28 00000000 AREA |.text|, CODE, READONLY, ALIGN=
2
29 00000000 THUMB
30 00000000 REQUIRE8
31 00000000 PRESERVE8
32 00000000
33 00000000 IMPORT rt_thread_switch_interrupt_flag
34 00000000 IMPORT rt_interrupt_from_thread
35 00000000 IMPORT rt_interrupt_to_thread
36 00000000
37 00000000 ;/*
38 00000000 ; * rt_base_t rt_hw_interrupt_disable();
ARM Macro Assembler Page 2
39 00000000 ; */
40 00000000 rt_hw_interrupt_disable
PROC
41 00000000 EXPORT rt_hw_interrupt_disable
42 00000000 F3EF 8010 MRS r0, PRIMASK
43 00000004 B672 CPSID I
44 00000006 4770 BX LR
45 00000008 ENDP
46 00000008
47 00000008 ;/*
48 00000008 ; * void rt_hw_interrupt_enable(rt_base_t level);
49 00000008 ; */
50 00000008 rt_hw_interrupt_enable
PROC
51 00000008 EXPORT rt_hw_interrupt_enable
52 00000008 F380 8810 MSR PRIMASK, r0
53 0000000C 4770 BX LR
54 0000000E ENDP
55 0000000E
56 0000000E ;/*
57 0000000E ; * void rt_hw_context_switch(rt_uint32 from, rt_uint32
to);
58 0000000E ; * r0 --> from
59 0000000E ; * r1 --> to
60 0000000E ; */
61 0000000E rt_hw_context_switch_interrupt
62 0000000E EXPORT rt_hw_context_switch_interrupt
63 0000000E rt_hw_context_switch
PROC
64 0000000E EXPORT rt_hw_context_switch
65 0000000E
66 0000000E ; set rt_thread_switch_interrupt_flag to 1
67 0000000E 4A32 LDR r2, =rt_thread_switch_interrupt
_flag
68 00000010 6813 LDR r3, [r2]
69 00000012 2B01 CMP r3, #1
70 00000014 D004 BEQ _reswitch
71 00000016 F04F 0301 MOV r3, #1
72 0000001A 6013 STR r3, [r2]
73 0000001C
74 0000001C 4A2F LDR r2, =rt_interrupt_from_thread ;
set rt_interrupt_f
rom_thread
75 0000001E 6010 STR r0, [r2]
76 00000020
77 00000020 _reswitch
78 00000020 4A2F LDR r2, =rt_interrupt_to_thread ; s
et rt_interrupt_to_
thread
79 00000022 6011 STR r1, [r2]
80 00000024
81 00000024 482F LDR r0, =NVIC_INT_CTRL ; trigger th
e PendSV exception
(causes context swi
tch)
82 00000026 F04F 5180 LDR r1, =NVIC_PENDSVSET
83 0000002A 6001 STR r1, [r0]
84 0000002C 4770 BX LR
85 0000002E ENDP
ARM Macro Assembler Page 3
86 0000002E
87 0000002E ; r0 --> switch from thread stack
88 0000002E ; r1 --> switch to thread stack
89 0000002E ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from
] stack
90 0000002E PendSV_Handler
PROC
91 0000002E EXPORT PendSV_Handler
92 0000002E
93 0000002E ; disable interrupt to protect context switch
94 0000002E F3EF 8210 MRS r2, PRIMASK
95 00000032 B672 CPSID I
96 00000034
97 00000034 ; get rt_thread_switch_interrupt_flag
98 00000034 4828 LDR r0, =rt_thread_switch_interrupt
_flag
99 00000036 6801 LDR r1, [r0]
100 00000038 B191 CBZ r1, pendsv_exit ; pendsv alread
y handled
101 0000003A
102 0000003A ; clear rt_thread_switch_interrupt_flag to 0
103 0000003A F04F 0100 MOV r1, #0x00
104 0000003E 6001 STR r1, [r0]
105 00000040
106 00000040 4826 LDR r0, =rt_interrupt_from_thread
107 00000042 6801 LDR r1, [r0]
108 00000044 B129 CBZ r1, switch_to_thread ; skip reg
ister save at the f
irst time
109 00000046
110 00000046 F3EF 8109 MRS r1, psp ; get from thread s
tack pointer
111 0000004A E921 0FF0 STMFD r1!, {r4 - r11} ; push r4 - r11
register
112 0000004E 6800 LDR r0, [r0]
113 00000050 6001 STR r1, [r0] ; update from threa
d stack pointer
114 00000052
115 00000052 switch_to_thread
116 00000052 4923 LDR r1, =rt_interrupt_to_thread
117 00000054 6809 LDR r1, [r1]
118 00000056 6809 LDR r1, [r1] ; load thread stack
pointer
119 00000058
120 00000058 E8B1 0FF0 LDMFD r1!, {r4 - r11} ; pop r4 - r11
register
121 0000005C F381 8809 MSR psp, r1 ; update stack poin
ter
122 00000060
123 00000060 pendsv_exit
124 00000060 ; restore interrupt
125 00000060 F382 8810 MSR PRIMASK, r2
126 00000064
127 00000064 F04E 0E04 ORR lr, lr, #0x04
128 00000068 4770 BX lr
129 0000006A ENDP
130 0000006A
131 0000006A ;/*
132 0000006A ; * void rt_hw_context_switch_to(rt_uint32 to);
ARM Macro Assembler Page 4
133 0000006A ; * r0 --> to
134 0000006A ; * this fucntion is used to perform the first thread sw
itch
135 0000006A ; */
136 0000006A rt_hw_context_switch_to
PROC
137 0000006A EXPORT rt_hw_context_switch_to
138 0000006A ; set to thread
139 0000006A 491D LDR r1, =rt_interrupt_to_thread
140 0000006C 6008 STR r0, [r1]
141 0000006E
142 0000006E ; set from thread to 0
143 0000006E 491B LDR r1, =rt_interrupt_from_thread
144 00000070 F04F 0000 MOV r0, #0x0
145 00000074 6008 STR r0, [r1]
146 00000076
147 00000076 ; set interrupt flag to 1
148 00000076 4918 LDR r1, =rt_thread_switch_interrupt
_flag
149 00000078 F04F 0001 MOV r0, #1
150 0000007C 6008 STR r0, [r1]
151 0000007E
152 0000007E ; set the PendSV exception priority
153 0000007E 481A LDR r0, =NVIC_SYSPRI2
154 00000080 F44F 017F LDR r1, =NVIC_PENDSV_PRI
155 00000084 F8D0 2000 LDR.W r2, [r0,#0x00] ; read
156 00000088 EA41 0102 ORR r1,r1,r2 ; modify
157 0000008C 6001 STR r1, [r0] ; write-back
158 0000008E
159 0000008E ; trigger the PendSV exception (causes context switch)
160 0000008E 4815 LDR r0, =NVIC_INT_CTRL
161 00000090 F04F 5180 LDR r1, =NVIC_PENDSVSET
162 00000094 6001 STR r1, [r0]
163 00000096
164 00000096 ; restore MSP
165 00000096 4815 LDR r0, =SCB_VTOR
166 00000098 6800 LDR r0, [r0]
167 0000009A 6800 LDR r0, [r0]
168 0000009C F380 8808 MSR msp, r0
169 000000A0
170 000000A0 ; enable interrupts at processor level
171 000000A0 B661 CPSIE F
172 000000A2 B662 CPSIE I
173 000000A4
174 000000A4 ; never reach here!
175 000000A4 ENDP
176 000000A4
177 000000A4 ; compatible with old version
178 000000A4 rt_hw_interrupt_thread_switch
PROC
179 000000A4 EXPORT rt_hw_interrupt_thread_switch
180 000000A4 4770 BX lr
181 000000A6 ENDP
182 000000A6
183 000000A6 IMPORT rt_hw_hard_fault_exception
184 000000A6 EXPORT HardFault_Handler
185 000000A6 HardFault_Handler
PROC
186 000000A6
ARM Macro Assembler Page 5
187 000000A6 ; get current context
188 000000A6 F01E 0F04 TST lr, #0x04 ; if(!EXC_RETURN[2]
)
189 000000AA BF14 F3EF
8008 MRSNE r0, msp ; get fault context
from handler.
190 000000B0 F3EF 8009 MRSEQ r0, psp ; get fault context
from thread.
191 000000B4
192 000000B4 E920 0FF0 STMFD r0!, {r4 - r11} ; push r4 - r11
register
193 000000B8 F840 ED04 STMFD r0!, {lr} ; push exec_return
register
194 000000BC
195 000000BC BF14 F380
8808 MSRNE msp, r0 ; update stack poin
ter to MSP.
196 000000C2 F380 8809 MSREQ psp, r0 ; update stack poin
ter to PSP.
197 000000C6
198 000000C6 B500 PUSH {lr}
199 000000C8 F7FF FFFE BL rt_hw_hard_fault_exception
200 000000CC F85D EB04 POP {lr}
201 000000D0
202 000000D0 F04E 0E04 ORR lr, lr, #0x04
203 000000D4 4770 BX lr
204 000000D6 ENDP
205 000000D6
206 000000D6 00 00 ALIGN 4
207 000000D8
208 000000D8 END
00000000
00000000
00000000
E000ED04
E000ED20
E000ED08
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
ork --depend=.\context_rvds.d -o.\context_rvds.o -I.\RTE\_oscilloscope -ID:\ins
tall\Keil_v5\Arm\Packs\Keil\STM32F1xx_DFP\2.0.0\Device\Include -ID:\install\Kei
l_v5\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1" --predefine="__UVISION_V
ERSION SETA 527" --predefine="STM32F10X_HD SETA 1" --list=.\listings\context_rv
ds.lst ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.text 00000000
Symbol: .text
Definitions
At line 28 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
None
Comment: .text unused
HardFault_Handler 000000A6
Symbol: HardFault_Handler
Definitions
At line 185 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 184 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: HardFault_Handler used once
PendSV_Handler 0000002E
Symbol: PendSV_Handler
Definitions
At line 90 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 91 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: PendSV_Handler used once
_reswitch 00000020
Symbol: _reswitch
Definitions
At line 77 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 70 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: _reswitch used once
pendsv_exit 00000060
Symbol: pendsv_exit
Definitions
At line 123 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 100 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: pendsv_exit used once
rt_hw_context_switch 0000000E
Symbol: rt_hw_context_switch
Definitions
At line 63 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 64 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_context_switch used once
rt_hw_context_switch_interrupt 0000000E
Symbol: rt_hw_context_switch_interrupt
Definitions
At line 61 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 62 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_context_switch_interrupt used once
rt_hw_context_switch_to 0000006A
Symbol: rt_hw_context_switch_to
ARM Macro Assembler Page 2 Alphabetic symbol ordering
Relocatable symbols
Definitions
At line 136 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 137 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_context_switch_to used once
rt_hw_interrupt_disable 00000000
Symbol: rt_hw_interrupt_disable
Definitions
At line 40 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 41 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_interrupt_disable used once
rt_hw_interrupt_enable 00000008
Symbol: rt_hw_interrupt_enable
Definitions
At line 50 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 51 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_interrupt_enable used once
rt_hw_interrupt_thread_switch 000000A4
Symbol: rt_hw_interrupt_thread_switch
Definitions
At line 178 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 179 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_interrupt_thread_switch used once
switch_to_thread 00000052
Symbol: switch_to_thread
Definitions
At line 115 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 108 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: switch_to_thread used once
12 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Absolute symbols
NVIC_INT_CTRL E000ED04
Symbol: NVIC_INT_CTRL
Definitions
At line 23 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 81 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 160 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
NVIC_PENDSVSET 10000000
Symbol: NVIC_PENDSVSET
Definitions
At line 26 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 82 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 161 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
NVIC_PENDSV_PRI 00FF0000
Symbol: NVIC_PENDSV_PRI
Definitions
At line 25 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 154 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: NVIC_PENDSV_PRI used once
NVIC_SYSPRI2 E000ED20
Symbol: NVIC_SYSPRI2
Definitions
At line 24 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 153 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: NVIC_SYSPRI2 used once
SCB_VTOR E000ED08
Symbol: SCB_VTOR
Definitions
At line 22 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 165 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: SCB_VTOR used once
5 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
External symbols
rt_hw_hard_fault_exception 00000000
Symbol: rt_hw_hard_fault_exception
Definitions
At line 183 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 199 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Comment: rt_hw_hard_fault_exception used once
rt_interrupt_from_thread 00000000
Symbol: rt_interrupt_from_thread
Definitions
At line 34 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 74 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 106 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 143 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
rt_interrupt_to_thread 00000000
Symbol: rt_interrupt_to_thread
Definitions
At line 35 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 78 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 116 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 139 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
rt_thread_switch_interrupt_flag 00000000
Symbol: rt_thread_switch_interrupt_flag
Definitions
At line 33 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
Uses
At line 67 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 98 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
At line 148 in file ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
4 symbols
356 symbols in table

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

60
Project/oscilloscope.lnp Normal file
View File

@ -0,0 +1,60 @@
--cpu Cortex-M3
".\startup_stm32f10x_hd.o"
".\core_cm3.o"
".\system_stm32f10x.o"
".\misc.o"
".\stm32f10x_adc.o"
".\stm32f10x_bkp.o"
".\stm32f10x_can.o"
".\stm32f10x_cec.o"
".\stm32f10x_crc.o"
".\stm32f10x_dac.o"
".\stm32f10x_dbgmcu.o"
".\stm32f10x_dma.o"
".\stm32f10x_exti.o"
".\stm32f10x_flash.o"
".\stm32f10x_fsmc.o"
".\stm32f10x_gpio.o"
".\stm32f10x_i2c.o"
".\stm32f10x_iwdg.o"
".\stm32f10x_pwr.o"
".\stm32f10x_rcc.o"
".\stm32f10x_rtc.o"
".\stm32f10x_sdio.o"
".\stm32f10x_spi.o"
".\stm32f10x_tim.o"
".\stm32f10x_usart.o"
".\stm32f10x_wwdg.o"
".\main.o"
".\stm32f10x_it.o"
".\bsp_usart.o"
".\bsp_ili9341_lcd.o"
".\fonts.o"
".\bsp_adc.o"
".\bsp_timbase.o"
".\bsp_led.o"
".\bsp_key_exti.o"
".\osc.o"
".\bsp_ps2.o"
".\board.o"
".\clock.o"
".\components.o"
".\device.o"
".\idle.o"
".\ipc.o"
".\irq.o"
".\kservice.o"
".\mem.o"
".\memheap.o"
".\mempool.o"
".\object.o"
".\scheduler.o"
".\signal.o"
".\thread.o"
".\timer.o"
".\cpuport.o"
".\context_rvds.o"
--library_type=microlib --strict --scatter ".\oscilloscope.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers
--list ".\Listings\oscilloscope.map" -o .\oscilloscope.axf

File diff suppressed because one or more lines are too long

View File

@ -117,6 +117,26 @@
<pMon>BIN\CMSIS_AGDI.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>CMSIS_AGDI</Key>
@ -135,12 +155,12 @@
<DebugFlag>
<trace>0</trace>
<periodic>0</periodic>
<aLwin>0</aLwin>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>0</viewmode>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>

View File

@ -16,7 +16,7 @@
<TargetCommonOption>
<Device>STM32F103VE</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F1xx_DFP.2.1.0</PackID>
<PackID>Keil.STM32F1xx_DFP.2.0.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x10000) IROM(0x08000000,0x80000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>

View File

@ -148,6 +148,7 @@ void Setting_Inf_Update(uint8_t CurSetItem)
void PlotWave(void* parameter)
{
uint16_t i;
uint8_t space=8, length=10;//虚线比例和短横线长度
rt_err_t recv_statu = RT_EOK;
uint8_t flag = 0;//波形数据采集完成标志
while(1)
@ -156,11 +157,37 @@ void PlotWave(void* parameter)
if(recv_statu == RT_EOK && flag == 1)
{
LCD_SetColors(WHITE, BLACK);
ILI9341_Clear(0,0,199,LCD_Y_LENGTH);
//ILI9341_Clear(0,0,199,LCD_Y_LENGTH);
ILI9341_Clear(Wave_Centor_X-(Wave_Width/2),Wave_Centor_Y-(Wave_Height/2),Wave_Width,Wave_Height);
//画竖线
ILI9341_DrawLine (Wave_Centor_X-(Wave_Width/2), Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X-(Wave_Width/2), Wave_Centor_Y+(Wave_Height/2));//左数第1条竖线
ILI9341_DrawDottedLine(Wave_Centor_X-50, Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X-50, Wave_Centor_Y+(Wave_Height/2), space);//左数第2条竖线 虚线
ILI9341_DrawDottedLine(Wave_Centor_X, Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X, Wave_Centor_Y+(Wave_Height/2), space);//左数第3条竖线 虚线
ILI9341_DrawDottedLine(Wave_Centor_X+50, Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X+50, Wave_Centor_Y+(Wave_Height/2), space);//左数第4条竖线 虚线
ILI9341_DrawLine (Wave_Centor_X+(Wave_Width/2), Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X+(Wave_Width/2), Wave_Centor_Y+(Wave_Height/2));//左数第4条竖线
//画横线
ILI9341_DrawDottedLine(Wave_Centor_X-(Wave_Width/2), Wave_Centor_Y, Wave_Centor_X+(Wave_Width/2), Wave_Centor_Y, space);//中间虚线
//上面的短横线
ILI9341_DrawLine(Wave_Centor_X-(Wave_Width/2), Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X-(Wave_Width/2)+length, Wave_Centor_Y-(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X-50-length/2, Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X-50+length/2, Wave_Centor_Y-(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X-length/2, Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X+length/2, Wave_Centor_Y-(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X+50-length/2, Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X+50+length/2, Wave_Centor_Y-(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X+(Wave_Width/2), Wave_Centor_Y-(Wave_Height/2), Wave_Centor_X+(Wave_Width/2)-length, Wave_Centor_Y-(Wave_Height/2));
//下面的短横线
ILI9341_DrawLine(Wave_Centor_X-(Wave_Width/2), Wave_Centor_Y+(Wave_Height/2), Wave_Centor_X-(Wave_Width/2)+length, Wave_Centor_Y+(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X-50-length/2, Wave_Centor_Y+(Wave_Height/2), Wave_Centor_X-50+length/2, Wave_Centor_Y+(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X-length/2, Wave_Centor_Y+(Wave_Height/2), Wave_Centor_X+length/2, Wave_Centor_Y+(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X+50-length/2, Wave_Centor_Y+(Wave_Height/2), Wave_Centor_X+50+length/2, Wave_Centor_Y+(Wave_Height/2));
ILI9341_DrawLine(Wave_Centor_X+(Wave_Width/2), Wave_Centor_Y+(Wave_Height/2), Wave_Centor_X+(Wave_Width/2)-length, Wave_Centor_Y+(Wave_Height/2));
for(i=0; i <= ADCx_1_SampleNbr-2; i++)
{
LCD_SetTextColor(WHITE);
ILI9341_DrawLine ( i, ADC_ConvertedValue[i] /21, i+1, ADC_ConvertedValue[i+1] /21 );
ILI9341_DrawLine ( Wave_Centor_X-(Wave_Width/2)+i, ADC_ConvertedValue[i] /21, Wave_Centor_X-(Wave_Width/2)+i+1, ADC_ConvertedValue[i+1] /21 );
}
}
flag = 0;
@ -298,7 +325,7 @@ void Run(void)
key_scan_queue = rt_mq_create("key_scan_queue", 1, 1, RT_IPC_FLAG_FIFO);
/**********创建线程************/
Setting_thread = rt_thread_create("Setting", Setting, RT_NULL, 512, 1, 20);
Setting_thread = rt_thread_create("Setting", Setting, RT_NULL, 512, 2, 20);
if (Setting_thread != RT_NULL)
rt_thread_startup(Setting_thread);

View File

@ -167,6 +167,9 @@ void Get_Wave(void* parameter)
uint8_t flag = 1;//波形数据采集完成标志位
uint16_t ADC_SampleCount = 0;
while(1)
{
ADC_SampleCount = 0;
while(ADC_GetITStatus(ADCx_1, ADC_IT_EOC) != SET);
while(ADC_SampleCount < ADCx_1_SampleNbr)
{
@ -181,6 +184,7 @@ void Get_Wave(void* parameter)
rt_thread_suspend(GetWave_thread);
}
rt_mq_send(getwave_status_queue, &flag, sizeof(flag));
}
}

View File

@ -35,6 +35,11 @@ static uint16_t CurrentTextColor = BLACK;//ǰ
static uint16_t CurrentBackColor = WHITE;//背景色
uint16_t Wave_Centor_X = 120;//波形显示窗口中心坐标
uint16_t Wave_Centor_Y = 120;
uint16_t Wave_Height = 200;//波形显示窗口尺寸
uint16_t Wave_Width = 200;
/**
* @brief ILI9341写入命令
@ -787,11 +792,95 @@ void ILI9341_DrawLine ( uint16_t usX1, uint16_t usY1, uint16_t usX2, uint16_t us
}
}
}
/**
* @brief ILI9341 使 Bresenham 线
* @param usX1 线X坐标
* @param usY1 线Y坐标
* @param usX2 线X坐标
* @param usY2 线Y坐标
* @param space 线
* @note 使LCD_SetBackColorLCD_SetTextColorLCD_SetColors函数设置颜色
* @retval
*/
void ILI9341_DrawDottedLine ( uint16_t usX1, uint16_t usY1, uint16_t usX2, uint16_t usY2 , uint8_t space)
{
uint16_t us;
uint16_t usX_Current, usY_Current;
int32_t lError_X = 0, lError_Y = 0, lDelta_X, lDelta_Y, lDistance;
int32_t lIncrease_X, lIncrease_Y;
lDelta_X = usX2 - usX1; //计算坐标增量
lDelta_Y = usY2 - usY1;
usX_Current = usX1;
usY_Current = usY1;
if ( lDelta_X > 0 )
lIncrease_X = 1; //设置单步方向
else if ( lDelta_X == 0 )
lIncrease_X = 0;//垂直线
else
{
lIncrease_X = -1;
lDelta_X = - lDelta_X;
}
if ( lDelta_Y > 0 )
lIncrease_Y = 1;
else if ( lDelta_Y == 0 )
lIncrease_Y = 0;//水平线
else
{
lIncrease_Y = -1;
lDelta_Y = - lDelta_Y;
}
if ( lDelta_X > lDelta_Y )
lDistance = lDelta_X; //选取基本增量坐标轴
else
lDistance = lDelta_Y;
for ( us = 0; us <= lDistance + 1; us ++ )//画线输出
{
if(us % space <= space/2)
ILI9341_SetPointPixel ( usX_Current, usY_Current );//画点
lError_X += lDelta_X ;
lError_Y += lDelta_Y ;
if ( lError_X > lDistance )
{
lError_X -= lDistance;
usX_Current += lIncrease_X;
}
if ( lError_Y > lDistance )
{
lError_Y -= lDistance;
usY_Current += lIncrease_Y;
}
}
}
/**
* @brief ILI9341
* @param usX_Start X坐标

View File

@ -5,6 +5,11 @@
#include "stm32f10x.h"
#include "./font/fonts.h"
//波形显示相关参数定义
extern uint16_t Wave_Centor_X;//波形显示窗口中心坐标
extern uint16_t Wave_Centor_Y;
extern uint16_t Wave_Height; //波形显示窗口尺寸
extern uint16_t Wave_Width;
/***************************************************************************************
2^26 =0X0400 0000 = 64MB,ÿ¸ö BANK ÓÐ4*64MB = 256MB
@ -185,6 +190,7 @@ void ILI9341_Clear ( uint16_t usX, uint16_
void ILI9341_SetPointPixel ( uint16_t usX, uint16_t usY );
uint16_t ILI9341_GetPointPixel ( uint16_t usX , uint16_t usY );
void ILI9341_DrawLine ( uint16_t usX1, uint16_t usY1, uint16_t usX2, uint16_t usY2 );
void ILI9341_DrawDottedLine ( uint16_t usX1, uint16_t usY1, uint16_t usX2, uint16_t usY2 , uint8_t space);
void ILI9341_DrawRectangle ( uint16_t usX_Start, uint16_t usY_Start, uint16_t usWidth, uint16_t usHeight,uint8_t ucFilled );
void ILI9341_DrawCircle ( uint16_t usX_Center, uint16_t usY_Center, uint16_t usRadius, uint8_t ucFilled );
void ILI9341_DispChar_EN ( uint16_t usX, uint16_t usY, const char cChar );

View File

@ -11,6 +11,8 @@
#include "OSC.h"
#include <stdio.h>
#include "bsp_led.h"
volatile uint32_t Time_us = 0; // us 计时变量
@ -64,9 +66,18 @@ void EXTI0_IRQHandler(void)
if(EXTI_GetITStatus(EXTI_Line0) != RESET)
{
rt_interrupt_enter();
rt_mq_send(setting_data_queue,
&setting_data_set,
sizeof(setting_data_set));
if(StopSample == SET)
{
StopSample = RESET;
rt_thread_resume(GetWave_thread);
LED1_OFF;
}
else if(StopSample == RESET)
{
StopSample = SET;
rt_thread_suspend(GetWave_thread);
LED1_ON;
}
rt_interrupt_leave();
}
EXTI_ClearITPendingBit(EXTI_Line0);