Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
e063b10a80 | |
|
dd74e17915 | |
|
a9eb7a6831 |
|
@ -4,8 +4,7 @@
|
|||
"board.h": "c",
|
||||
"motor.h": "c",
|
||||
"main.h": "c",
|
||||
"app.h": "c",
|
||||
"type_traits": "c"
|
||||
"app.h": "c"
|
||||
},
|
||||
"C_Cpp.errorSquiggles": "disabled"
|
||||
}
|
|
@ -41,14 +41,28 @@ void MX_ADC_Init(void)
|
|||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
|
||||
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
|
||||
/**ADC GPIO Configuration
|
||||
PC3 ------> ADC_IN13
|
||||
PA7 ------> ADC_IN7
|
||||
PB0 ------> ADC_IN8
|
||||
*/
|
||||
GPIO_InitStruct.Pin = MG_ADC_IN13_Pin;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(MG_ADC_IN13_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* ADC DMA Init */
|
||||
|
||||
/* ADC Init */
|
||||
|
@ -72,6 +86,14 @@ void MX_ADC_Init(void)
|
|||
|
||||
/* USER CODE END ADC_Init 1 */
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_7);
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_8);
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_13);
|
||||
|
|
|
@ -138,12 +138,6 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_4;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
|
@ -156,12 +150,6 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
|
|
|
@ -154,7 +154,7 @@ void DMA1_Channel1_IRQHandler(void)
|
|||
/* USER CODE END DMA1_Channel1_IRQn 0 */
|
||||
|
||||
/* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
|
||||
adc_convert_callback(adc1);
|
||||
|
||||
/* USER CODE END DMA1_Channel1_IRQn 1 */
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void DMA1_Channel2_3_IRQHandler(void)
|
|||
/* USER CODE END DMA1_Channel2_3_IRQn 0 */
|
||||
|
||||
/* USER CODE BEGIN DMA1_Channel2_3_IRQn 1 */
|
||||
uart_dma_reception_callback(uarts[UART_NUM_1]);
|
||||
|
||||
/* USER CODE END DMA1_Channel2_3_IRQn 1 */
|
||||
}
|
||||
|
||||
|
@ -198,11 +198,13 @@ void TIM21_IRQHandler(void)
|
|||
/* USER CODE BEGIN TIM21_IRQn 0 */
|
||||
|
||||
/* USER CODE END TIM21_IRQn 0 */
|
||||
|
||||
/* USER CODE BEGIN TIM21_IRQn 1 */
|
||||
if (LL_TIM_IsActiveFlag_UPDATE(TIM21))
|
||||
{
|
||||
__NOP();
|
||||
step_motor_update(motor);
|
||||
LL_TIM_ClearFlag_UPDATE(TIM21);
|
||||
__NOP();
|
||||
}
|
||||
/* USER CODE END TIM21_IRQn 1 */
|
||||
}
|
||||
|
@ -216,7 +218,7 @@ void USART1_IRQHandler(void)
|
|||
|
||||
/* USER CODE END USART1_IRQn 0 */
|
||||
/* USER CODE BEGIN USART1_IRQn 1 */
|
||||
uart_reception_callback(uarts[UART_NUM_1]);
|
||||
|
||||
/* USER CODE END USART1_IRQn 1 */
|
||||
}
|
||||
|
||||
|
|
|
@ -145,27 +145,10 @@
|
|||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>ST-LINKIII-KEIL_SWO</Key>
|
||||
<Name>-U-O142 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(0BC11477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32L072RBTx$CMSIS\Flash\STM32L0xx_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
|
||||
<Name>-US -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(0BC11477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32L072RBTx$CMSIS\Flash\STM32L0xx_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>207</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134223234</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>../Core/Src/stm32l0xx_it.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\motor\../Core/Src/stm32l0xx_it.c\207</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
|
@ -175,27 +158,22 @@
|
|||
<Ww>
|
||||
<count>1</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>motor_state</ItemText>
|
||||
<ItemText>motor_state,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>2</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>motor_ccr</ItemText>
|
||||
<ItemText>motor->handle.step_motor.attribute,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>3</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>step_motor_flag</ItemText>
|
||||
<ItemText>motor_param,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>4</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>motor->handle.step_motor.attribute,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>5</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>motor_dir</ItemText>
|
||||
<ItemText>\\motor\../User/board/board.c\motor_state,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<Tracepoint>
|
||||
|
@ -240,16 +218,6 @@
|
|||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
<SystemViewers>
|
||||
<Entry>
|
||||
<Name>System Viewer\TIM21</Name>
|
||||
<WinId>35905</WinId>
|
||||
</Entry>
|
||||
<Entry>
|
||||
<Name>System Viewer\TIM6</Name>
|
||||
<WinId>35904</WinId>
|
||||
</Entry>
|
||||
</SystemViewers>
|
||||
<DebugDescription>
|
||||
<Enable>1</Enable>
|
||||
<EnableFlashSeq>0</EnableFlashSeq>
|
||||
|
@ -282,7 +250,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>Application/User/Core</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@ -510,7 +478,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>User</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@ -806,7 +774,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>User/board</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,938 +0,0 @@
|
|||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1
|
||||
|
||||
|
||||
1 00000000 ;*******************************************************
|
||||
***********************
|
||||
2 00000000 ;* File Name : startup_stm32l072xx.s
|
||||
3 00000000 ;* Author : MCD Application Team
|
||||
4 00000000 ;* Description : STM32l072xx Devices vector table
|
||||
for MDK-ARM toolchain.
|
||||
5 00000000 ;* This module performs:
|
||||
6 00000000 ;* - Set the initial SP
|
||||
7 00000000 ;* - Set the initial PC == Reset_Ha
|
||||
ndler
|
||||
8 00000000 ;* - Set the vector table entries w
|
||||
ith the exceptions ISR address
|
||||
9 00000000 ;* - Branches to __main in the C lb
|
||||
rary (which eventually
|
||||
10 00000000 ;* calls main()).
|
||||
11 00000000 ;* After Reset the Cortex-M0+ proce
|
||||
ssor is in Thread mode,
|
||||
12 00000000 ;* priority is Privileged, and the
|
||||
Stack is set to Main.
|
||||
13 00000000 ;*******************************************************
|
||||
***********************
|
||||
14 00000000 ;* @attention
|
||||
15 00000000 ;*
|
||||
16 00000000 ;* Copyright (c) 2016 STMicroelectronics.
|
||||
17 00000000 ;* All rights reserved.
|
||||
18 00000000 ;*
|
||||
19 00000000 ;* This software is licensed under terms that can be fou
|
||||
nd in the LICENSE file
|
||||
20 00000000 ;* in the root directory of this software component.
|
||||
21 00000000 ;* If no LICENSE file comes with this software, it is pr
|
||||
ovided AS-IS.
|
||||
22 00000000 ;*
|
||||
23 00000000 ;*******************************************************
|
||||
***********************
|
||||
24 00000000
|
||||
25 00000000 ; Amount of memory (in bytes) allocated for Stack
|
||||
26 00000000 ; Tailor this value to your application needs
|
||||
27 00000000 ; <h> Stack Configuration
|
||||
28 00000000 ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
29 00000000 ; </h>
|
||||
30 00000000
|
||||
31 00000000 00000600
|
||||
Stack_Size
|
||||
EQU 0x600
|
||||
32 00000000
|
||||
33 00000000 AREA STACK, NOINIT, READWRITE, ALIGN
|
||||
=3
|
||||
34 00000000 Stack_Mem
|
||||
SPACE Stack_Size
|
||||
35 00000600 __initial_sp
|
||||
36 00000600
|
||||
37 00000600
|
||||
38 00000600 ; <h> Heap Configuration
|
||||
39 00000600 ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
40 00000600 ; </h>
|
||||
41 00000600
|
||||
42 00000600 00000400
|
||||
Heap_Size
|
||||
EQU 0x400
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 2
|
||||
|
||||
|
||||
43 00000600
|
||||
44 00000600 AREA HEAP, NOINIT, READWRITE, ALIGN=
|
||||
3
|
||||
45 00000000 __heap_base
|
||||
46 00000000 Heap_Mem
|
||||
SPACE Heap_Size
|
||||
47 00000400 __heap_limit
|
||||
48 00000400
|
||||
49 00000400 PRESERVE8
|
||||
50 00000400 THUMB
|
||||
51 00000400
|
||||
52 00000400
|
||||
53 00000400 ; Vector Table Mapped to Address 0 at Reset
|
||||
54 00000400 AREA RESET, DATA, READONLY
|
||||
55 00000000 EXPORT __Vectors
|
||||
56 00000000 EXPORT __Vectors_End
|
||||
57 00000000 EXPORT __Vectors_Size
|
||||
58 00000000
|
||||
59 00000000 00000000
|
||||
__Vectors
|
||||
DCD __initial_sp ; Top of Stack
|
||||
60 00000004 00000000 DCD Reset_Handler ; Reset Handler
|
||||
61 00000008 00000000 DCD NMI_Handler ; NMI Handler
|
||||
62 0000000C 00000000 DCD HardFault_Handler ; Hard Fault
|
||||
Handler
|
||||
63 00000010 00000000 DCD 0 ; Reserved
|
||||
64 00000014 00000000 DCD 0 ; Reserved
|
||||
65 00000018 00000000 DCD 0 ; Reserved
|
||||
66 0000001C 00000000 DCD 0 ; Reserved
|
||||
67 00000020 00000000 DCD 0 ; Reserved
|
||||
68 00000024 00000000 DCD 0 ; Reserved
|
||||
69 00000028 00000000 DCD 0 ; Reserved
|
||||
70 0000002C 00000000 DCD SVC_Handler ; SVCall Handler
|
||||
71 00000030 00000000 DCD 0 ; Reserved
|
||||
72 00000034 00000000 DCD 0 ; Reserved
|
||||
73 00000038 00000000 DCD PendSV_Handler ; PendSV Handler
|
||||
|
||||
74 0000003C 00000000 DCD SysTick_Handler
|
||||
; SysTick Handler
|
||||
75 00000040
|
||||
76 00000040 ; External Interrupts
|
||||
77 00000040 00000000 DCD WWDG_IRQHandler
|
||||
; Window Watchdog
|
||||
78 00000044 00000000 DCD PVD_IRQHandler ; PVD through EX
|
||||
TI Line detect
|
||||
79 00000048 00000000 DCD RTC_IRQHandler ; RTC through EX
|
||||
TI Line
|
||||
80 0000004C 00000000 DCD FLASH_IRQHandler ; FLASH
|
||||
81 00000050 00000000 DCD RCC_CRS_IRQHandler
|
||||
; RCC and CRS
|
||||
82 00000054 00000000 DCD EXTI0_1_IRQHandler
|
||||
; EXTI Line 0 and 1
|
||||
|
||||
83 00000058 00000000 DCD EXTI2_3_IRQHandler
|
||||
; EXTI Line 2 and 3
|
||||
|
||||
84 0000005C 00000000 DCD EXTI4_15_IRQHandler
|
||||
; EXTI Line 4 to 15
|
||||
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 3
|
||||
|
||||
|
||||
85 00000060 00000000 DCD TSC_IRQHandler ; TSC
|
||||
86 00000064 00000000 DCD DMA1_Channel1_IRQHandler
|
||||
; DMA1 Channel 1
|
||||
87 00000068 00000000 DCD DMA1_Channel2_3_IRQHandler ; DM
|
||||
A1 Channel 2 and Ch
|
||||
annel 3
|
||||
88 0000006C 00000000 DCD DMA1_Channel4_5_6_7_IRQHandler
|
||||
; DMA1 Channel 4, C
|
||||
hannel 5, Channel 6
|
||||
and Channel 7
|
||||
89 00000070 00000000 DCD ADC1_COMP_IRQHandler ; ADC1, CO
|
||||
MP1 and COMP2
|
||||
90 00000074 00000000 DCD LPTIM1_IRQHandler ; LPTIM1
|
||||
91 00000078 00000000 DCD USART4_5_IRQHandler
|
||||
; USART4 and USART5
|
||||
|
||||
92 0000007C 00000000 DCD TIM2_IRQHandler ; TIM2
|
||||
93 00000080 00000000 DCD TIM3_IRQHandler ; TIM3
|
||||
94 00000084 00000000 DCD TIM6_DAC_IRQHandler
|
||||
; TIM6 and DAC
|
||||
95 00000088 00000000 DCD TIM7_IRQHandler ; TIM7
|
||||
96 0000008C 00000000 DCD 0 ; Reserved
|
||||
97 00000090 00000000 DCD TIM21_IRQHandler ; TIM21
|
||||
98 00000094 00000000 DCD I2C3_IRQHandler ; I2C3
|
||||
99 00000098 00000000 DCD TIM22_IRQHandler ; TIM22
|
||||
100 0000009C 00000000 DCD I2C1_IRQHandler ; I2C1
|
||||
101 000000A0 00000000 DCD I2C2_IRQHandler ; I2C2
|
||||
102 000000A4 00000000 DCD SPI1_IRQHandler ; SPI1
|
||||
103 000000A8 00000000 DCD SPI2_IRQHandler ; SPI2
|
||||
104 000000AC 00000000 DCD USART1_IRQHandler ; USART1
|
||||
105 000000B0 00000000 DCD USART2_IRQHandler ; USART2
|
||||
106 000000B4 00000000 DCD RNG_LPUART1_IRQHandler
|
||||
; RNG and LPUART1
|
||||
107 000000B8 00000000 DCD 0 ; Reserved
|
||||
108 000000BC 00000000 DCD USB_IRQHandler ; USB
|
||||
109 000000C0
|
||||
110 000000C0 __Vectors_End
|
||||
111 000000C0
|
||||
112 000000C0 000000C0
|
||||
__Vectors_Size
|
||||
EQU __Vectors_End - __Vectors
|
||||
113 000000C0
|
||||
114 000000C0 AREA |.text|, CODE, READONLY
|
||||
115 00000000
|
||||
116 00000000 ; Reset handler routine
|
||||
117 00000000 Reset_Handler
|
||||
PROC
|
||||
118 00000000 EXPORT Reset_Handler [
|
||||
WEAK]
|
||||
119 00000000 IMPORT __main
|
||||
120 00000000 IMPORT SystemInit
|
||||
121 00000000 4807 LDR R0, =SystemInit
|
||||
122 00000002 4780 BLX R0
|
||||
123 00000004 4807 LDR R0, =__main
|
||||
124 00000006 4700 BX R0
|
||||
125 00000008 ENDP
|
||||
126 00000008
|
||||
127 00000008 ; Dummy Exception Handlers (infinite loops which can be
|
||||
modified)
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 4
|
||||
|
||||
|
||||
128 00000008
|
||||
129 00000008 NMI_Handler
|
||||
PROC
|
||||
130 00000008 EXPORT NMI_Handler
|
||||
[WEAK]
|
||||
131 00000008 E7FE B .
|
||||
132 0000000A ENDP
|
||||
134 0000000A HardFault_Handler
|
||||
PROC
|
||||
135 0000000A EXPORT HardFault_Handler
|
||||
[WEAK]
|
||||
136 0000000A E7FE B .
|
||||
137 0000000C ENDP
|
||||
138 0000000C SVC_Handler
|
||||
PROC
|
||||
139 0000000C EXPORT SVC_Handler
|
||||
[WEAK]
|
||||
140 0000000C E7FE B .
|
||||
141 0000000E ENDP
|
||||
142 0000000E PendSV_Handler
|
||||
PROC
|
||||
143 0000000E EXPORT PendSV_Handler
|
||||
[WEAK]
|
||||
144 0000000E E7FE B .
|
||||
145 00000010 ENDP
|
||||
146 00000010 SysTick_Handler
|
||||
PROC
|
||||
147 00000010 EXPORT SysTick_Handler
|
||||
[WEAK]
|
||||
148 00000010 E7FE B .
|
||||
149 00000012 ENDP
|
||||
150 00000012
|
||||
151 00000012 Default_Handler
|
||||
PROC
|
||||
152 00000012
|
||||
153 00000012 EXPORT WWDG_IRQHandler
|
||||
[WEAK]
|
||||
154 00000012 EXPORT PVD_IRQHandler
|
||||
[WEAK]
|
||||
155 00000012 EXPORT RTC_IRQHandler
|
||||
[WEAK]
|
||||
156 00000012 EXPORT FLASH_IRQHandler
|
||||
[WEAK]
|
||||
157 00000012 EXPORT RCC_CRS_IRQHandler
|
||||
[WEAK]
|
||||
158 00000012 EXPORT EXTI0_1_IRQHandler
|
||||
[WEAK]
|
||||
159 00000012 EXPORT EXTI2_3_IRQHandler
|
||||
[WEAK]
|
||||
160 00000012 EXPORT EXTI4_15_IRQHandler
|
||||
[WEAK]
|
||||
161 00000012 EXPORT TSC_IRQHandler
|
||||
[WEAK]
|
||||
162 00000012 EXPORT DMA1_Channel1_IRQHandler
|
||||
[WEAK]
|
||||
163 00000012 EXPORT DMA1_Channel2_3_IRQHandler
|
||||
[WEAK]
|
||||
164 00000012 EXPORT DMA1_Channel4_5_6_7_IRQHandler
|
||||
[WEAK]
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 5
|
||||
|
||||
|
||||
165 00000012 EXPORT ADC1_COMP_IRQHandler
|
||||
[WEAK]
|
||||
166 00000012 EXPORT LPTIM1_IRQHandler
|
||||
[WEAK]
|
||||
167 00000012 EXPORT USART4_5_IRQHandler
|
||||
[WEAK]
|
||||
168 00000012 EXPORT TIM2_IRQHandler
|
||||
[WEAK]
|
||||
169 00000012 EXPORT TIM3_IRQHandler
|
||||
[WEAK]
|
||||
170 00000012 EXPORT TIM6_DAC_IRQHandler
|
||||
[WEAK]
|
||||
171 00000012 EXPORT TIM7_IRQHandler
|
||||
[WEAK]
|
||||
172 00000012 EXPORT TIM21_IRQHandler
|
||||
[WEAK]
|
||||
173 00000012 EXPORT TIM22_IRQHandler
|
||||
[WEAK]
|
||||
174 00000012 EXPORT I2C1_IRQHandler
|
||||
[WEAK]
|
||||
175 00000012 EXPORT I2C2_IRQHandler
|
||||
[WEAK]
|
||||
176 00000012 EXPORT I2C3_IRQHandler
|
||||
[WEAK]
|
||||
177 00000012 EXPORT SPI1_IRQHandler
|
||||
[WEAK]
|
||||
178 00000012 EXPORT SPI2_IRQHandler
|
||||
[WEAK]
|
||||
179 00000012 EXPORT USART1_IRQHandler
|
||||
[WEAK]
|
||||
180 00000012 EXPORT USART2_IRQHandler
|
||||
[WEAK]
|
||||
181 00000012 EXPORT RNG_LPUART1_IRQHandler
|
||||
[WEAK]
|
||||
182 00000012 EXPORT USB_IRQHandler
|
||||
[WEAK]
|
||||
183 00000012
|
||||
184 00000012
|
||||
185 00000012 WWDG_IRQHandler
|
||||
186 00000012 PVD_IRQHandler
|
||||
187 00000012 RTC_IRQHandler
|
||||
188 00000012 FLASH_IRQHandler
|
||||
189 00000012 RCC_CRS_IRQHandler
|
||||
190 00000012 EXTI0_1_IRQHandler
|
||||
191 00000012 EXTI2_3_IRQHandler
|
||||
192 00000012 EXTI4_15_IRQHandler
|
||||
193 00000012 TSC_IRQHandler
|
||||
194 00000012 DMA1_Channel1_IRQHandler
|
||||
195 00000012 DMA1_Channel2_3_IRQHandler
|
||||
196 00000012 DMA1_Channel4_5_6_7_IRQHandler
|
||||
197 00000012 ADC1_COMP_IRQHandler
|
||||
198 00000012 LPTIM1_IRQHandler
|
||||
199 00000012 USART4_5_IRQHandler
|
||||
200 00000012 TIM2_IRQHandler
|
||||
201 00000012 TIM3_IRQHandler
|
||||
202 00000012 TIM6_DAC_IRQHandler
|
||||
203 00000012 TIM7_IRQHandler
|
||||
204 00000012 TIM21_IRQHandler
|
||||
205 00000012 TIM22_IRQHandler
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 6
|
||||
|
||||
|
||||
206 00000012 I2C1_IRQHandler
|
||||
207 00000012 I2C2_IRQHandler
|
||||
208 00000012 I2C3_IRQHandler
|
||||
209 00000012 SPI1_IRQHandler
|
||||
210 00000012 SPI2_IRQHandler
|
||||
211 00000012 USART1_IRQHandler
|
||||
212 00000012 USART2_IRQHandler
|
||||
213 00000012 RNG_LPUART1_IRQHandler
|
||||
214 00000012 USB_IRQHandler
|
||||
215 00000012
|
||||
216 00000012 E7FE B .
|
||||
217 00000014
|
||||
218 00000014 ENDP
|
||||
219 00000014
|
||||
220 00000014 ALIGN
|
||||
221 00000014
|
||||
222 00000014 ;*******************************************************
|
||||
************************
|
||||
223 00000014 ; User Stack and Heap initialization
|
||||
224 00000014 ;*******************************************************
|
||||
************************
|
||||
225 00000014 IF :DEF:__MICROLIB
|
||||
232 00000014
|
||||
233 00000014 IMPORT __use_two_region_memory
|
||||
234 00000014 EXPORT __user_initial_stackheap
|
||||
235 00000014
|
||||
236 00000014 __user_initial_stackheap
|
||||
237 00000014
|
||||
238 00000014 4804 LDR R0, = Heap_Mem
|
||||
239 00000016 4905 LDR R1, =(Stack_Mem + Stack_Size)
|
||||
240 00000018 4A05 LDR R2, = (Heap_Mem + Heap_Size)
|
||||
241 0000001A 4B06 LDR R3, = Stack_Mem
|
||||
242 0000001C 4770 BX LR
|
||||
243 0000001E
|
||||
244 0000001E 00 00 ALIGN
|
||||
245 00000020
|
||||
246 00000020 ENDIF
|
||||
247 00000020
|
||||
248 00000020 END
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
00000600
|
||||
00000400
|
||||
00000000
|
||||
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M0+ --apcs=inter
|
||||
work --depend=motor\startup_stm32l072xx.d -omotor\startup_stm32l072xx.o -I.\RTE
|
||||
\_motor -IS:\software\MDK\ARM\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IS:\sof
|
||||
tware\MDK\ARM\Packs\Keil\STM32L0xx_DFP\2.2.0\Drivers\CMSIS\Device\ST\STM32L0xx\
|
||||
Include --predefine="__UVISION_VERSION SETA 538" --predefine="_RTE_ SETA 1" --p
|
||||
redefine="STM32L072xx SETA 1" --predefine="_RTE_ SETA 1" --list=startup_stm32l0
|
||||
72xx.lst startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
STACK 00000000
|
||||
|
||||
Symbol: STACK
|
||||
Definitions
|
||||
At line 33 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: STACK unused
|
||||
Stack_Mem 00000000
|
||||
|
||||
Symbol: Stack_Mem
|
||||
Definitions
|
||||
At line 34 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 239 in file startup_stm32l072xx.s
|
||||
At line 241 in file startup_stm32l072xx.s
|
||||
|
||||
__initial_sp 00000600
|
||||
|
||||
Symbol: __initial_sp
|
||||
Definitions
|
||||
At line 35 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 59 in file startup_stm32l072xx.s
|
||||
Comment: __initial_sp used once
|
||||
3 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
HEAP 00000000
|
||||
|
||||
Symbol: HEAP
|
||||
Definitions
|
||||
At line 44 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: HEAP unused
|
||||
Heap_Mem 00000000
|
||||
|
||||
Symbol: Heap_Mem
|
||||
Definitions
|
||||
At line 46 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 238 in file startup_stm32l072xx.s
|
||||
At line 240 in file startup_stm32l072xx.s
|
||||
|
||||
__heap_base 00000000
|
||||
|
||||
Symbol: __heap_base
|
||||
Definitions
|
||||
At line 45 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: __heap_base unused
|
||||
__heap_limit 00000400
|
||||
|
||||
Symbol: __heap_limit
|
||||
Definitions
|
||||
At line 47 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: __heap_limit unused
|
||||
4 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
RESET 00000000
|
||||
|
||||
Symbol: RESET
|
||||
Definitions
|
||||
At line 54 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: RESET unused
|
||||
__Vectors 00000000
|
||||
|
||||
Symbol: __Vectors
|
||||
Definitions
|
||||
At line 59 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 55 in file startup_stm32l072xx.s
|
||||
At line 112 in file startup_stm32l072xx.s
|
||||
|
||||
__Vectors_End 000000C0
|
||||
|
||||
Symbol: __Vectors_End
|
||||
Definitions
|
||||
At line 110 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 56 in file startup_stm32l072xx.s
|
||||
At line 112 in file startup_stm32l072xx.s
|
||||
|
||||
3 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
.text 00000000
|
||||
|
||||
Symbol: .text
|
||||
Definitions
|
||||
At line 114 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: .text unused
|
||||
ADC1_COMP_IRQHandler 00000012
|
||||
|
||||
Symbol: ADC1_COMP_IRQHandler
|
||||
Definitions
|
||||
At line 197 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 89 in file startup_stm32l072xx.s
|
||||
At line 165 in file startup_stm32l072xx.s
|
||||
|
||||
DMA1_Channel1_IRQHandler 00000012
|
||||
|
||||
Symbol: DMA1_Channel1_IRQHandler
|
||||
Definitions
|
||||
At line 194 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 86 in file startup_stm32l072xx.s
|
||||
At line 162 in file startup_stm32l072xx.s
|
||||
|
||||
DMA1_Channel2_3_IRQHandler 00000012
|
||||
|
||||
Symbol: DMA1_Channel2_3_IRQHandler
|
||||
Definitions
|
||||
At line 195 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 87 in file startup_stm32l072xx.s
|
||||
At line 163 in file startup_stm32l072xx.s
|
||||
|
||||
DMA1_Channel4_5_6_7_IRQHandler 00000012
|
||||
|
||||
Symbol: DMA1_Channel4_5_6_7_IRQHandler
|
||||
Definitions
|
||||
At line 196 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 88 in file startup_stm32l072xx.s
|
||||
At line 164 in file startup_stm32l072xx.s
|
||||
|
||||
Default_Handler 00000012
|
||||
|
||||
Symbol: Default_Handler
|
||||
Definitions
|
||||
At line 151 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: Default_Handler unused
|
||||
EXTI0_1_IRQHandler 00000012
|
||||
|
||||
Symbol: EXTI0_1_IRQHandler
|
||||
Definitions
|
||||
At line 190 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 82 in file startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 2 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
At line 158 in file startup_stm32l072xx.s
|
||||
|
||||
EXTI2_3_IRQHandler 00000012
|
||||
|
||||
Symbol: EXTI2_3_IRQHandler
|
||||
Definitions
|
||||
At line 191 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 83 in file startup_stm32l072xx.s
|
||||
At line 159 in file startup_stm32l072xx.s
|
||||
|
||||
EXTI4_15_IRQHandler 00000012
|
||||
|
||||
Symbol: EXTI4_15_IRQHandler
|
||||
Definitions
|
||||
At line 192 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 84 in file startup_stm32l072xx.s
|
||||
At line 160 in file startup_stm32l072xx.s
|
||||
|
||||
FLASH_IRQHandler 00000012
|
||||
|
||||
Symbol: FLASH_IRQHandler
|
||||
Definitions
|
||||
At line 188 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 80 in file startup_stm32l072xx.s
|
||||
At line 156 in file startup_stm32l072xx.s
|
||||
|
||||
HardFault_Handler 0000000A
|
||||
|
||||
Symbol: HardFault_Handler
|
||||
Definitions
|
||||
At line 134 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 62 in file startup_stm32l072xx.s
|
||||
At line 135 in file startup_stm32l072xx.s
|
||||
|
||||
I2C1_IRQHandler 00000012
|
||||
|
||||
Symbol: I2C1_IRQHandler
|
||||
Definitions
|
||||
At line 206 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 100 in file startup_stm32l072xx.s
|
||||
At line 174 in file startup_stm32l072xx.s
|
||||
|
||||
I2C2_IRQHandler 00000012
|
||||
|
||||
Symbol: I2C2_IRQHandler
|
||||
Definitions
|
||||
At line 207 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 101 in file startup_stm32l072xx.s
|
||||
At line 175 in file startup_stm32l072xx.s
|
||||
|
||||
I2C3_IRQHandler 00000012
|
||||
|
||||
Symbol: I2C3_IRQHandler
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 3 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
Definitions
|
||||
At line 208 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 98 in file startup_stm32l072xx.s
|
||||
At line 176 in file startup_stm32l072xx.s
|
||||
|
||||
LPTIM1_IRQHandler 00000012
|
||||
|
||||
Symbol: LPTIM1_IRQHandler
|
||||
Definitions
|
||||
At line 198 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 90 in file startup_stm32l072xx.s
|
||||
At line 166 in file startup_stm32l072xx.s
|
||||
|
||||
NMI_Handler 00000008
|
||||
|
||||
Symbol: NMI_Handler
|
||||
Definitions
|
||||
At line 129 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 61 in file startup_stm32l072xx.s
|
||||
At line 130 in file startup_stm32l072xx.s
|
||||
|
||||
PVD_IRQHandler 00000012
|
||||
|
||||
Symbol: PVD_IRQHandler
|
||||
Definitions
|
||||
At line 186 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 78 in file startup_stm32l072xx.s
|
||||
At line 154 in file startup_stm32l072xx.s
|
||||
|
||||
PendSV_Handler 0000000E
|
||||
|
||||
Symbol: PendSV_Handler
|
||||
Definitions
|
||||
At line 142 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 73 in file startup_stm32l072xx.s
|
||||
At line 143 in file startup_stm32l072xx.s
|
||||
|
||||
RCC_CRS_IRQHandler 00000012
|
||||
|
||||
Symbol: RCC_CRS_IRQHandler
|
||||
Definitions
|
||||
At line 189 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 81 in file startup_stm32l072xx.s
|
||||
At line 157 in file startup_stm32l072xx.s
|
||||
|
||||
RNG_LPUART1_IRQHandler 00000012
|
||||
|
||||
Symbol: RNG_LPUART1_IRQHandler
|
||||
Definitions
|
||||
At line 213 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 106 in file startup_stm32l072xx.s
|
||||
At line 181 in file startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 4 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
|
||||
RTC_IRQHandler 00000012
|
||||
|
||||
Symbol: RTC_IRQHandler
|
||||
Definitions
|
||||
At line 187 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 79 in file startup_stm32l072xx.s
|
||||
At line 155 in file startup_stm32l072xx.s
|
||||
|
||||
Reset_Handler 00000000
|
||||
|
||||
Symbol: Reset_Handler
|
||||
Definitions
|
||||
At line 117 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 60 in file startup_stm32l072xx.s
|
||||
At line 118 in file startup_stm32l072xx.s
|
||||
|
||||
SPI1_IRQHandler 00000012
|
||||
|
||||
Symbol: SPI1_IRQHandler
|
||||
Definitions
|
||||
At line 209 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 102 in file startup_stm32l072xx.s
|
||||
At line 177 in file startup_stm32l072xx.s
|
||||
|
||||
SPI2_IRQHandler 00000012
|
||||
|
||||
Symbol: SPI2_IRQHandler
|
||||
Definitions
|
||||
At line 210 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 103 in file startup_stm32l072xx.s
|
||||
At line 178 in file startup_stm32l072xx.s
|
||||
|
||||
SVC_Handler 0000000C
|
||||
|
||||
Symbol: SVC_Handler
|
||||
Definitions
|
||||
At line 138 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 70 in file startup_stm32l072xx.s
|
||||
At line 139 in file startup_stm32l072xx.s
|
||||
|
||||
SysTick_Handler 00000010
|
||||
|
||||
Symbol: SysTick_Handler
|
||||
Definitions
|
||||
At line 146 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 74 in file startup_stm32l072xx.s
|
||||
At line 147 in file startup_stm32l072xx.s
|
||||
|
||||
TIM21_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM21_IRQHandler
|
||||
Definitions
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 5 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
At line 204 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 97 in file startup_stm32l072xx.s
|
||||
At line 172 in file startup_stm32l072xx.s
|
||||
|
||||
TIM22_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM22_IRQHandler
|
||||
Definitions
|
||||
At line 205 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 99 in file startup_stm32l072xx.s
|
||||
At line 173 in file startup_stm32l072xx.s
|
||||
|
||||
TIM2_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM2_IRQHandler
|
||||
Definitions
|
||||
At line 200 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 92 in file startup_stm32l072xx.s
|
||||
At line 168 in file startup_stm32l072xx.s
|
||||
|
||||
TIM3_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM3_IRQHandler
|
||||
Definitions
|
||||
At line 201 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 93 in file startup_stm32l072xx.s
|
||||
At line 169 in file startup_stm32l072xx.s
|
||||
|
||||
TIM6_DAC_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM6_DAC_IRQHandler
|
||||
Definitions
|
||||
At line 202 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 94 in file startup_stm32l072xx.s
|
||||
At line 170 in file startup_stm32l072xx.s
|
||||
|
||||
TIM7_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM7_IRQHandler
|
||||
Definitions
|
||||
At line 203 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 95 in file startup_stm32l072xx.s
|
||||
At line 171 in file startup_stm32l072xx.s
|
||||
|
||||
TSC_IRQHandler 00000012
|
||||
|
||||
Symbol: TSC_IRQHandler
|
||||
Definitions
|
||||
At line 193 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 85 in file startup_stm32l072xx.s
|
||||
At line 161 in file startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 6 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
USART1_IRQHandler 00000012
|
||||
|
||||
Symbol: USART1_IRQHandler
|
||||
Definitions
|
||||
At line 211 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 104 in file startup_stm32l072xx.s
|
||||
At line 179 in file startup_stm32l072xx.s
|
||||
|
||||
USART2_IRQHandler 00000012
|
||||
|
||||
Symbol: USART2_IRQHandler
|
||||
Definitions
|
||||
At line 212 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 105 in file startup_stm32l072xx.s
|
||||
At line 180 in file startup_stm32l072xx.s
|
||||
|
||||
USART4_5_IRQHandler 00000012
|
||||
|
||||
Symbol: USART4_5_IRQHandler
|
||||
Definitions
|
||||
At line 199 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 91 in file startup_stm32l072xx.s
|
||||
At line 167 in file startup_stm32l072xx.s
|
||||
|
||||
USB_IRQHandler 00000012
|
||||
|
||||
Symbol: USB_IRQHandler
|
||||
Definitions
|
||||
At line 214 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 108 in file startup_stm32l072xx.s
|
||||
At line 182 in file startup_stm32l072xx.s
|
||||
|
||||
WWDG_IRQHandler 00000012
|
||||
|
||||
Symbol: WWDG_IRQHandler
|
||||
Definitions
|
||||
At line 185 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 77 in file startup_stm32l072xx.s
|
||||
At line 153 in file startup_stm32l072xx.s
|
||||
|
||||
__user_initial_stackheap 00000014
|
||||
|
||||
Symbol: __user_initial_stackheap
|
||||
Definitions
|
||||
At line 236 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 234 in file startup_stm32l072xx.s
|
||||
Comment: __user_initial_stackheap used once
|
||||
39 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Absolute symbols
|
||||
|
||||
Heap_Size 00000400
|
||||
|
||||
Symbol: Heap_Size
|
||||
Definitions
|
||||
At line 42 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 46 in file startup_stm32l072xx.s
|
||||
At line 240 in file startup_stm32l072xx.s
|
||||
|
||||
Stack_Size 00000600
|
||||
|
||||
Symbol: Stack_Size
|
||||
Definitions
|
||||
At line 31 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 34 in file startup_stm32l072xx.s
|
||||
At line 239 in file startup_stm32l072xx.s
|
||||
|
||||
__Vectors_Size 000000C0
|
||||
|
||||
Symbol: __Vectors_Size
|
||||
Definitions
|
||||
At line 112 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 57 in file startup_stm32l072xx.s
|
||||
Comment: __Vectors_Size used once
|
||||
3 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
External symbols
|
||||
|
||||
SystemInit 00000000
|
||||
|
||||
Symbol: SystemInit
|
||||
Definitions
|
||||
At line 120 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 121 in file startup_stm32l072xx.s
|
||||
Comment: SystemInit used once
|
||||
__main 00000000
|
||||
|
||||
Symbol: __main
|
||||
Definitions
|
||||
At line 119 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 123 in file startup_stm32l072xx.s
|
||||
Comment: __main used once
|
||||
__use_two_region_memory 00000000
|
||||
|
||||
Symbol: __use_two_region_memory
|
||||
Definitions
|
||||
At line 233 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: __use_two_region_memory unused
|
||||
3 symbols
|
||||
392 symbols in table
|
|
@ -1,5 +1,5 @@
|
|||
#include "app.h"
|
||||
// #include "board.h"
|
||||
#include "board.h"
|
||||
#include "uarts.h"
|
||||
#include "sys.h"
|
||||
#include <stdio.h>
|
||||
|
@ -12,6 +12,7 @@ uint8_t mem_percent = 0; // 内存使用率
|
|||
|
||||
void app_init(void)
|
||||
{
|
||||
motor_process_init();
|
||||
flow_init(); // 流程初始化
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
typedef struct
|
||||
{
|
||||
bool is_open;
|
||||
uint32_t calibration_value;
|
||||
float32 calibration_value;
|
||||
uint32_t original_value;
|
||||
} calibration_sensor_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
calibration_sensor_data_t torsion_in13; // 扭力
|
||||
calibration_sensor_data_t pressure_in7; // 压力
|
||||
calibration_sensor_data_t pressure_in8; // 流量
|
||||
} adcs_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -17,7 +17,15 @@ static uint8_t adc_inspection(struct flow *fl)
|
|||
FL_HEAD(fl);
|
||||
for (;;)
|
||||
{
|
||||
// 扭力
|
||||
app.adc.torsion_in13.original_value = adc_get_result_average(IN13);
|
||||
app.adc.torsion_in13.calibration_value = torsion_detect(app.adc.torsion_in13.original_value);
|
||||
// 压力
|
||||
app.adc.pressure_in7.original_value = adc_get_result_average(IN7);
|
||||
app.adc.pressure_in7.calibration_value = pressure_detect(app.adc.pressure_in7.original_value);
|
||||
// 流量
|
||||
app.adc.pressure_in8.original_value = adc_get_result_average(IN8);
|
||||
app.adc.pressure_in8.calibration_value = flow_detect(app.adc.pressure_in8.original_value);
|
||||
FL_LOCK_DELAY(fl, FL_CLOCK_100MSEC); /* 延时100毫秒 */
|
||||
}
|
||||
FL_TAIL(fl);
|
||||
|
@ -28,6 +36,7 @@ static uint8_t systom_inspection(struct flow *fl)
|
|||
FL_HEAD(fl);
|
||||
for (;;)
|
||||
{
|
||||
motor_process();
|
||||
FL_LOCK_DELAY(fl, FL_CLOCK_100MSEC); /* 延时100毫秒 */
|
||||
}
|
||||
FL_TAIL(fl);
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#include "motor.h"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef __MOTOR_APP_H__
|
||||
#define __MOTOR_APP_H__
|
||||
|
||||
|
||||
|
||||
extern void motor_process(void);
|
||||
|
||||
#endif
|
|
@ -1,167 +1,47 @@
|
|||
#include "board.h"
|
||||
#include "motor.h"
|
||||
|
||||
void motor_process(frame_msg_t *rx, frame_msg_t *bk);
|
||||
void sensor_procss(frame_msg_t *rx, frame_msg_t *bk);
|
||||
|
||||
/************************************* 串口通讯 *************************************/
|
||||
uart_t *uarts[UART_NUM_MAX];
|
||||
__IO static BOOL deal_done_flag = FALSE; // 数据处理标志
|
||||
__IO static frame_msg_t rx_frame;
|
||||
__IO static frame_msg_t bk_frame;
|
||||
__IO static uint8_t send_buffer[UART_TXSIZE];
|
||||
|
||||
// 串口发送
|
||||
static void host_send_msg(uint8_t *data, uint16_t len)
|
||||
{
|
||||
uart_send_data(uarts[UART_NUM_1], data, len);
|
||||
}
|
||||
|
||||
// 接收数据解码
|
||||
static void host_data_decode(uint8_t *data, uint16_t len, frame_msg_t *msg)
|
||||
{
|
||||
DBG_ASSERT(data != NULL __DBG_LINE);
|
||||
DBG_ASSERT(msg != NULL __DBG_LINE);
|
||||
|
||||
msg->state = data[1];
|
||||
msg->dev_no = data[2];
|
||||
msg->cmd_no = data[3];
|
||||
msg->len = data[4];
|
||||
osel_memcpy(msg->data, (uint8_t *)&data[5], msg->len);
|
||||
}
|
||||
|
||||
// 发送数据编码
|
||||
static void send_data_encode(frame_msg_t *msg)
|
||||
{
|
||||
uint16_t ver_len = 0, ver_crc = 0;
|
||||
uint8_t *sp = (uint8_t *)send_buffer;
|
||||
DBG_ASSERT(msg != NULL __DBG_LINE);
|
||||
|
||||
*sp++ = PACKET_STX; // 包头
|
||||
ver_len++;
|
||||
*sp++ = msg->state; // 状态
|
||||
ver_len++;
|
||||
*sp++ = msg->dev_no; // 设备号
|
||||
ver_len++;
|
||||
*sp++ = msg->cmd_no; // 命令号
|
||||
ver_len++;
|
||||
*sp++ = msg->len; // 长度
|
||||
ver_len++;
|
||||
osel_memcpy(sp, msg->data, msg->len); // 数据
|
||||
sp += msg->len;
|
||||
ver_len += msg->len;
|
||||
|
||||
ver_crc = crc16_compute((uint8_t *)&send_buffer[1], (ver_len - 1)); // 减去包头
|
||||
ver_crc = S2B_UINT16(ver_crc);
|
||||
osel_memcpy(sp, (uint8_t *)&ver_crc, 2); // 校验
|
||||
sp += 2;
|
||||
ver_len += 2;
|
||||
|
||||
*sp++ = PACKET_ETX; // 包尾
|
||||
ver_len++;
|
||||
|
||||
// 发送
|
||||
host_send_msg((uint8_t *)send_buffer, ver_len);
|
||||
}
|
||||
|
||||
// 数据处理
|
||||
void host_data_deal(uint8_t *data, uint16_t len)
|
||||
{
|
||||
frame_msg_t *rx_msg = (frame_msg_t *)&rx_frame;
|
||||
frame_msg_t *bk_msg = (frame_msg_t *)&bk_frame;
|
||||
|
||||
if (deal_done_flag == TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// 解析
|
||||
host_data_decode(data, len, rx_msg);
|
||||
// 执行
|
||||
switch (rx_msg->dev_no)
|
||||
{
|
||||
case ADC_SENSOR:
|
||||
sensor_procss(rx_msg, bk_msg);
|
||||
break;
|
||||
case MOTOR:
|
||||
motor_process(rx_msg, bk_msg);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// 回复(组包 + 发送)
|
||||
send_data_encode(bk_msg);
|
||||
// 修改标志位
|
||||
deal_done_flag = TRUE;
|
||||
osel_memset((uint8_t *)rx_msg, 0, sizeof(rx_frame));
|
||||
osel_memset((uint8_t *)bk_msg, 0, sizeof(bk_frame));
|
||||
}
|
||||
|
||||
// 数据完整性检查
|
||||
static BOOL host_data_verify(uint8_t *data, uint16_t len)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
uint16_t ver_len = 0;
|
||||
uint16_t ver_crc = 0, rx_crc = 0;
|
||||
|
||||
// 包头包尾检查
|
||||
if (data[0] != PACKET_STX || data[1] != MASTER_CODE || data[len - 1] != PACKET_ETX)
|
||||
{
|
||||
ret = FALSE;
|
||||
return ret;
|
||||
}
|
||||
// 帧长度检查
|
||||
ver_len = data[4] + PACKET_MIN_LEN;
|
||||
if (ver_len != len)
|
||||
{
|
||||
ret = FALSE;
|
||||
return ret;
|
||||
}
|
||||
// CRC校验
|
||||
ver_crc = crc16_compute((uint8_t *)(data + 1), (len - 4)); // 减去包头、包尾、校验
|
||||
ver_crc = S2B_UINT16(ver_crc);
|
||||
osel_memcpy((uint8_t *)&rx_crc, (uint8_t *)(data + len - 3), 2);
|
||||
if (ver_crc != rx_crc)
|
||||
{
|
||||
ret = FALSE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 串口接收回调
|
||||
static void host_rx_cb(uint8_t uart_index, uint8_t *data, uint16_t len)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
// 数据完整性检查
|
||||
ret = host_data_verify(data, len);
|
||||
// 数据处理
|
||||
if (ret == TRUE && deal_done_flag == TRUE)
|
||||
{
|
||||
deal_done_flag = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// 串口初始化
|
||||
void host_uart_init(void)
|
||||
{
|
||||
if (uarts[UART_NUM_1] == NULL)
|
||||
{
|
||||
uarts[UART_NUM_1] = uart_create(USART1, TRUE, UART_RXSIZE, host_rx_cb, TRUE, UART_TXSIZE, NULL);
|
||||
uarts[UART_NUM_1]->uart_index = UART_NUM_1;
|
||||
uarts[UART_NUM_1]->dma = DMA1;
|
||||
uarts[UART_NUM_1]->dma_rx_channel = LL_DMA_CHANNEL_3;
|
||||
uarts[UART_NUM_1]->dma_tx_channel = LL_DMA_CHANNEL_2;
|
||||
uart_recv_en(uarts[UART_NUM_1]);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************* 电机 *************************************/
|
||||
// 电机对象
|
||||
motor_t *motor;
|
||||
motor_ctrl_t *motor_param = NULL;
|
||||
uint8_t motor_state = MOTOR_IDEL;
|
||||
|
||||
adc_t adc1 = {
|
||||
.adc = ADC1,
|
||||
.dma = DMA1,
|
||||
.dma_channel = LL_DMA_CHANNEL_1,
|
||||
};
|
||||
|
||||
// 单位:N·m
|
||||
float32 torsion_detect(uint16_t adc)
|
||||
{
|
||||
float32 val = 0;
|
||||
val = (float32)adc / 4096 * 3000;
|
||||
val = (val - 1500) / 101 / (1.934 * 3) * 10;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// 单位:kPa
|
||||
float32 pressure_detect(uint16_t adc)
|
||||
{
|
||||
float32 val = 0;
|
||||
val = (float32)adc / 4096 * 3000;
|
||||
val = (val - 600) / (10 * 15) / 16 * 1000;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// 单位:SLPM
|
||||
float32 flow_detect(uint16_t adc)
|
||||
{
|
||||
float32 val = 0;
|
||||
val = (float32)adc / 4096 * 3000;
|
||||
val = (val - 600) / (10 * 15) / 16 * 300;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// 电机初始化
|
||||
static void motor_init(void)
|
||||
{
|
||||
motor = motor_create(STEP_MOTOR);
|
||||
|
@ -173,73 +53,41 @@ static void motor_init(void)
|
|||
.port = ENA_GPIO_Port,
|
||||
.pin = ENA_Pin,
|
||||
};
|
||||
motor->handle.step_motor.interface.init(motor, dir, en, MIN_STEP_ANGLE, TIM21, LL_TIM_CHANNEL_CH2);
|
||||
motor->handle.step_motor.interface.init(motor, dir, en, MAX_STEP_ANGLE, TIM21, LL_TIM_CHANNEL_CH2);
|
||||
}
|
||||
|
||||
// 电机任务
|
||||
void motor_process(frame_msg_t *rx, frame_msg_t *bk)
|
||||
void motor_process_init(void)
|
||||
{
|
||||
// BOOL ret = TRUE;
|
||||
motor_param = (motor_ctrl_t *)osel_mem_alloc(sizeof(motor_ctrl_t));
|
||||
DBG_ASSERT(motor_param != NULL __DBG_LINE);
|
||||
osel_memset((uint8_t *)motor_param, 0, sizeof(motor_ctrl_t));
|
||||
}
|
||||
|
||||
switch (rx->cmd_no)
|
||||
void motor_process(void)
|
||||
{
|
||||
step_motor_t *step_motor = &motor->handle.step_motor;
|
||||
|
||||
switch (motor_state)
|
||||
{
|
||||
case SET_MOTOR_SPEED: // 设置电机转速
|
||||
case MOTOR_RUN:
|
||||
step_motor->interface.run(motor, (dir_e)motor_param->dir);
|
||||
motor_state = MOTOR_IDEL;
|
||||
break;
|
||||
case SET_DRIVER_PULSE: // 设置驱动器脉冲
|
||||
case MOTOR_STOP:
|
||||
step_motor->interface.stop(motor);
|
||||
motor_state = MOTOR_IDEL;
|
||||
break;
|
||||
case GET_MIN_STEP: // 获取最小步距
|
||||
case MOTOR_STEP:
|
||||
step_motor->interface.set_angle(motor, motor_param->angle, (dir_e)motor_param->dir);
|
||||
motor_state = MOTOR_IDEL;
|
||||
break;
|
||||
case GET_MOTOR_STATE: // 获取电机运行状态
|
||||
case MOTOR_IDEL:
|
||||
break;
|
||||
case MOTOR_MOVE: // 运行电机
|
||||
break;
|
||||
case MOTOR_STOP: // 停止电机
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bk->dev_no = MOTOR;
|
||||
bk->cmd_no = rx->cmd_no;
|
||||
}
|
||||
|
||||
/************************************* ADc传感器 *************************************/
|
||||
// AD传感器
|
||||
adc_t adc1 = {
|
||||
.adc = ADC1,
|
||||
.dma = DMA1,
|
||||
.dma_channel = LL_DMA_CHANNEL_1,
|
||||
};
|
||||
|
||||
// 获取扭力值
|
||||
static BOOL get_tors_value(frame_msg_t *bk)
|
||||
{
|
||||
uint16_t value = 0;
|
||||
|
||||
bk->len = sizeof(uint16_t);
|
||||
value = adc_get_result_average(IN13);
|
||||
value = S2B_UINT16(value);
|
||||
osel_memcpy(bk->data, (uint8_t *)&value, bk->len);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// 传感器任务
|
||||
void sensor_procss(frame_msg_t *rx, frame_msg_t *bk)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
switch (rx->cmd_no)
|
||||
{
|
||||
case GET_TORS_VALUE: // 获取扭力值
|
||||
ret = get_tors_value(bk);
|
||||
break;
|
||||
}
|
||||
|
||||
bk->state = ret;
|
||||
bk->dev_no = ADC_SENSOR;
|
||||
bk->cmd_no = rx->cmd_no;
|
||||
}
|
||||
|
||||
/************************************* 板卡 *************************************/
|
||||
// 板卡初始化
|
||||
void board_init(void)
|
||||
{
|
||||
motor = NULL;
|
||||
|
|
|
@ -4,32 +4,11 @@
|
|||
#include "adcs.h"
|
||||
#include "uarts.h"
|
||||
|
||||
// 串口协议参数
|
||||
#define UART_RXSIZE (240u) // 接收缓冲区 240个字节
|
||||
#define UART_TXSIZE (240u) // 发送缓冲区 240个字节
|
||||
|
||||
// 包头 + 状态码 + 设备号 + 命令号 + 长度 + 数据 + 校验 + 包尾
|
||||
// 1 1 1 1 1 0~128 2 1
|
||||
#define PACKET_STX 0xff // 包头
|
||||
#define PACKET_ETX 0x3c // 包尾
|
||||
#define MASTER_CODE 0x00 // 状态码-主机
|
||||
|
||||
// 最大数据长度
|
||||
#define DATA_MAX_LEN 128
|
||||
// 最小帧长度:包头 + 状态码 + 设备号 + 命令号 + 长度 + 校验 + 包尾
|
||||
#define PACKET_MIN_LEN 8
|
||||
// 最大帧长度
|
||||
#define PACKET_MAX_LEN (DATA_MAX_LEN + PACKET_MIN_LEN)
|
||||
|
||||
// 电机初始默认值
|
||||
#define PULSE_REV 18000.0 // 每圈脉冲数(驱动器脉冲)
|
||||
#define MIN_STEP_ANGLE (360 / PULSE_REV) // 最小步距
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ADC_SENSOR,
|
||||
MOTOR,
|
||||
} dev_id_e;
|
||||
#define UART_RXSIZE (240u) // 接收240个字节
|
||||
#define UART_TXSIZE (240u) // 发送240个字节
|
||||
#define PULSE_REV (18000.0 * 5) /* 每圈脉冲数 */
|
||||
#define MAX_STEP_ANGLE (360 / PULSE_REV) /* 最小步距(360/PULSE_REV) */
|
||||
#define ANGLE 180 // 步进电机180度,转盘转动1度
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -43,37 +22,23 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
SET_MOTOR_SPEED,
|
||||
SET_DRIVER_PULSE,
|
||||
GET_MIN_STEP,
|
||||
GET_MOTOR_STATE,
|
||||
MOTOR_MOVE,
|
||||
MOTOR_IDEL,
|
||||
MOTOR_RUN,
|
||||
MOTOR_STOP,
|
||||
} motor_cmd_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GET_TORS_VALUE,
|
||||
} sensor_cmd_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ST_DEV_NORMAL,
|
||||
ST_DEV_BUSY,
|
||||
ST_MSG_MISS,
|
||||
} status_code_e;
|
||||
MOTOR_STEP,
|
||||
} motor_process_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t state; // 状态
|
||||
uint8_t dev_no; // 设备号
|
||||
uint8_t cmd_no; // 命令号
|
||||
uint8_t len; // 长度
|
||||
uint8_t data[DATA_MAX_LEN]; // 数据
|
||||
|
||||
} frame_msg_t;
|
||||
uint8_t dir;
|
||||
float32 angle;
|
||||
} motor_ctrl_t;
|
||||
|
||||
extern void board_init(void);
|
||||
void host_data_deal(uint8_t *data, uint16_t len);
|
||||
extern void motor_process_init(void);
|
||||
extern void motor_process(void);
|
||||
extern float32 torsion_detect(uint16_t adc);
|
||||
extern float32 pressure_detect(uint16_t adc);
|
||||
extern float32 flow_detect(uint16_t adc);
|
||||
|
||||
#endif // __BOARD_H__
|
||||
|
|
|
@ -20,6 +20,8 @@ static void step_motor_run(motor_t *motor, dir_e dir)
|
|||
handle->attribute.dir = dir;
|
||||
handle->attribute.en = TRUE;
|
||||
dir == DIR_CCW ? handle->gpios.dir->set(*handle->gpios.dir) : handle->gpios.dir->reset(*handle->gpios.dir);
|
||||
LL_TIM_EnableIT_UPDATE(handle->pwm_timer);
|
||||
// LL_TIM_EnableIT_CC2(handle->pwm_timer);
|
||||
PWM_START(handle->pwm_timer, handle->pwm_channel);
|
||||
}
|
||||
|
||||
|
@ -32,13 +34,15 @@ static void step_motor_stop(motor_t *motor)
|
|||
handle->attribute.angle = 0;
|
||||
handle->attribute.pulse_count = 0;
|
||||
PWM_STOP(handle->pwm_timer, handle->pwm_channel);
|
||||
LL_TIM_DisableIT_UPDATE(handle->pwm_timer);
|
||||
LL_TIM_ClearFlag_UPDATE(TIM21);
|
||||
if (handle->interface.stop_cb != NULL)
|
||||
{
|
||||
handle->interface.stop_cb(motor);
|
||||
}
|
||||
}
|
||||
|
||||
static void step_motor_set_angle(motor_t *motor, uint32_t angle, dir_e dir)
|
||||
static void step_motor_set_angle(motor_t *motor, float32 angle, dir_e dir)
|
||||
{
|
||||
DBG_ASSERT(motor != NULL __DBG_LINE);
|
||||
step_motor_t *handle = &motor->handle.step_motor;
|
||||
|
@ -86,7 +90,8 @@ void step_motor_update(motor_t *motor)
|
|||
if (handle->attribute.pulse_count <= 0) /* 当脉冲数等于0的时候 代表需要发送的脉冲个数已完成,停止定时器输出 */
|
||||
{
|
||||
LOG_PRINT("累计旋转的角度:%d\r\n", (int)(handle->attribute.add_pulse_count * handle->attribute.min_step_angle)); /* 打印累计转动了多少角度 */
|
||||
handle->interface.stop(motor); /* 停止接口一输出 */
|
||||
handle->interface.stop(motor);
|
||||
/* 停止接口一输出 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct
|
|||
void (*init)(motor_t *motor, gpio_t dir, gpio_t en, float32 min_step_angle, TIM_TypeDef *pwm_timer, uint32_t pwm_channel); // 初始化
|
||||
void (*run)(motor_t *motor, dir_e dir); // 运行
|
||||
void (*stop)(motor_t *motor); // 停止
|
||||
void (*set_angle)(motor_t *motor, uint32_t angle, dir_e dir); // 将角度转换成脉冲个数并运行
|
||||
void (*set_angle)(motor_t *motor, float32 angle, dir_e dir); // 将角度转换成脉冲个数并运行
|
||||
void (*stop_cb)(motor_t *motor); // 停止回调函数,在stop中执行
|
||||
|
||||
} step_motor_interface_t;
|
||||
|
@ -45,7 +45,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
float32 min_step_angle; /* 最小步距角 */
|
||||
int angle; /* 设置需要旋转的角度 */
|
||||
float32 angle; /* 设置需要旋转的角度 */
|
||||
dir_e dir; /* 方向 */
|
||||
uint8_t en; /* 使能 */
|
||||
__IO uint32_t pulse_count; /* 脉冲个数记录 */
|
||||
|
|
|
@ -65,24 +65,24 @@
|
|||
|
||||
typedef enum
|
||||
{
|
||||
IN0 = 0,
|
||||
IN1,
|
||||
// IN0 = 0,
|
||||
// IN1,
|
||||
// IN2,
|
||||
// IN3,
|
||||
// IN4,
|
||||
// IN5,
|
||||
IN6,
|
||||
// IN6,
|
||||
IN7,
|
||||
IN8,
|
||||
IN9,
|
||||
IN10,
|
||||
IN11,
|
||||
IN12,
|
||||
// IN9,
|
||||
// IN10,
|
||||
// IN11,
|
||||
// IN12,
|
||||
IN13,
|
||||
// IN14,
|
||||
// IN15,
|
||||
INVREF,
|
||||
INTEMP,
|
||||
// INVREF,
|
||||
// INTEMP,
|
||||
INMAX,
|
||||
} adc_num_t; // ADC通道号,根据cubemax配置的通道数量而定
|
||||
|
||||
|
|
|
@ -41,79 +41,6 @@
|
|||
} \
|
||||
} while (__LINE__ == -1)
|
||||
|
||||
/**
|
||||
* @file uarts.c
|
||||
* @brief This file contains the implementation of DMA_CLEAR_FLAG_TC_CHANNEL macro.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Clear the Transfer Complete (TC) flag of a specific DMA channel.
|
||||
*
|
||||
* @param dma The DMA peripheral.
|
||||
* @param channel The DMA channel number.
|
||||
*/
|
||||
#define DMA_CLEAR_FLAG_TC_CHANNEL(dma, channel) \
|
||||
switch (channel) \
|
||||
{ \
|
||||
case 1: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 1); \
|
||||
break; \
|
||||
case 2: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 2); \
|
||||
break; \
|
||||
case 3: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 3); \
|
||||
break; \
|
||||
case 4: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 4); \
|
||||
break; \
|
||||
case 5: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 5); \
|
||||
break; \
|
||||
case 6: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 6); \
|
||||
break; \
|
||||
case 7: \
|
||||
DMA_ClEAR_FLAG_TC(dma, 7); \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear the Transfer Error (TE) flag for the specified DMA channel.
|
||||
*
|
||||
* @param dma The DMA peripheral.
|
||||
* @param channel The DMA channel number.
|
||||
*/
|
||||
#define DMA_CLEAR_FLAG_TE_CHANNEL(dma, channel) \
|
||||
switch (channel) \
|
||||
{ \
|
||||
case 1: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 1); \
|
||||
break; \
|
||||
case 2: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 2); \
|
||||
break; \
|
||||
case 3: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 3); \
|
||||
break; \
|
||||
case 4: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 4); \
|
||||
break; \
|
||||
case 5: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 5); \
|
||||
break; \
|
||||
case 6: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 6); \
|
||||
break; \
|
||||
case 7: \
|
||||
DMA_ClEAR_FLAG_TE(dma, 7); \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 创建一个UART设备
|
||||
* @param {USART_TypeDef} *huart USART总线设备句柄
|
||||
|
@ -203,8 +130,6 @@ void uart_recv_en(uart_t *uart)
|
|||
LL_DMA_SetMemoryAddress(uart->dma, uart->dma_tx_channel, (uint32_t)uart->txbuf);
|
||||
LL_DMA_EnableIT_TC(uart->dma, uart->dma_tx_channel);
|
||||
LL_USART_EnableDMAReq_TX(uart->huart);
|
||||
|
||||
uart->tx_dma_ok = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,9 +169,8 @@ void uart_send_data(uart_t *uart, uint8_t *data, uint16_t len)
|
|||
DBG_ASSERT(data != NULL __DBG_LINE);
|
||||
DBG_ASSERT(len > 0 __DBG_LINE);
|
||||
uint8_t count = 0;
|
||||
if (TRUE == uart->tx_dma_en && uart->tx_dma_ok == TRUE)
|
||||
if (TRUE == uart->tx_dma_en)
|
||||
{
|
||||
uart->tx_dma_ok = FALSE;
|
||||
osel_memcpy(uart->txbuf, data, len); // 拷贝数据到发送缓冲区
|
||||
LL_DMA_DisableChannel(uart->dma, uart->dma_tx_channel);
|
||||
// 配置数据长度
|
||||
|
@ -256,7 +180,6 @@ void uart_send_data(uart_t *uart, uint8_t *data, uint16_t len)
|
|||
}
|
||||
else
|
||||
{
|
||||
count = 0;
|
||||
for (uint16_t i = 0; i < len; i++)
|
||||
{
|
||||
count = 0;
|
||||
|
@ -268,7 +191,6 @@ void uart_send_data(uart_t *uart, uint8_t *data, uint16_t len)
|
|||
}
|
||||
}
|
||||
LL_USART_TransmitData8(uart->huart, data[i]);
|
||||
}
|
||||
count = 0;
|
||||
while (!LL_USART_IsActiveFlag_TC(uart->huart))
|
||||
{
|
||||
|
@ -278,6 +200,7 @@ void uart_send_data(uart_t *uart, uint8_t *data, uint16_t len)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -365,12 +288,13 @@ void uart_dma_reception_callback(uart_t *uart)
|
|||
LL_DMA_DisableChannel(uart->dma, uart->dma_tx_channel);
|
||||
|
||||
// 清除发送中断标志位
|
||||
DMA_CLEAR_FLAG_TC_CHANNEL(uart->dma, uart->dma_tx_channel + 1);
|
||||
DMA_ClEAR_FLAG_TC(uart->dma, 2);
|
||||
DMA_ClEAR_FLAG_TC(uart->dma, 7);
|
||||
|
||||
// 使能发送中断,用于关闭发送使能引脚
|
||||
LL_USART_EnableIT_TC(uart->huart); // 使能发送中断,用于关闭发送使能引脚
|
||||
uart->tx_dma_ok = TRUE;
|
||||
|
||||
// 清除传输错误标志
|
||||
DMA_CLEAR_FLAG_TE_CHANNEL(uart->dma, uart->dma_tx_channel + 1);
|
||||
// 清除接收中断标志位
|
||||
DMA_ClEAR_FLAG_TE(uart->dma, 2);
|
||||
DMA_ClEAR_FLAG_TE(uart->dma, 7);
|
||||
}
|
||||
|
|
|
@ -1,132 +1,47 @@
|
|||
/**
|
||||
* @file uarts.h
|
||||
* @brief Header file for UARTs module.
|
||||
*
|
||||
* This file contains the definitions and function prototypes for UARTs module.
|
||||
* The UARTs module provides functions for creating and managing UART instances,
|
||||
* enabling reception, sending data, and handling interrupts.
|
||||
*/
|
||||
|
||||
#ifndef __UARTS_H__
|
||||
#define __UARTS_H__
|
||||
|
||||
#include "lib.h"
|
||||
#include "main.h"
|
||||
|
||||
/**
|
||||
* @brief Callback function type for UART receive interrupt.
|
||||
*
|
||||
* This function type is used to define the callback function for UART receive interrupt.
|
||||
* The callback function is called when data is received on the UART.
|
||||
*
|
||||
* @param uart_index The index of the UART.
|
||||
* @param data The received data.
|
||||
* @param len The length of the received data.
|
||||
*/
|
||||
//
|
||||
typedef void (*rx_interupt_cb_t)(uint8_t uart_index, uint8_t *data, uint16_t len);
|
||||
|
||||
/**
|
||||
* @brief Callback function type for UART transmit complete.
|
||||
*
|
||||
* This function type is used to define the callback function for UART transmit complete.
|
||||
* The callback function is called when the UART transmission is complete.
|
||||
*/
|
||||
//
|
||||
typedef void (*tx_complete_cb_t)(void);
|
||||
|
||||
/**
|
||||
* @brief Enumeration for UART status.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
UART_OK = 0x00u, /**< The action was successful. */
|
||||
UART_ERROR = 0xFFu /**< Generic error. */
|
||||
} uart_status_e;
|
||||
|
||||
/**
|
||||
* @brief Structure representing a UART instance.
|
||||
*/
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint8_t uart_index; /**< The index of the UART. */
|
||||
USART_TypeDef *huart; /**< The UART peripheral. */
|
||||
DMA_TypeDef *dma; /**< The DMA peripheral. */
|
||||
uint32_t dma_rx_channel; /**< The DMA receive channel. */
|
||||
uint32_t dma_tx_channel; /**< The DMA transmit channel. */
|
||||
uint16_t rx_index; /**< The receive data index. */
|
||||
BOOL rx_dma_en; /**< Flag indicating if DMA reception is enabled. */
|
||||
uint8_t *rxbuf; /**< The receive buffer. */
|
||||
uint16_t rxsize; /**< The size of the receive buffer. */
|
||||
uint16_t tx_index; /**< The transmit data index. */
|
||||
BOOL tx_dma_en; /**< Flag indicating if DMA transmission is enabled. */
|
||||
uint8_t *txbuf; /**< The transmit buffer. */
|
||||
uint16_t txsize; /**< The size of the transmit buffer. */
|
||||
__IO BOOL tx_dma_ok; /**< Flag indicating if DMA transmission is complete. */
|
||||
rx_interupt_cb_t rx_interupt_cb; /**< The receive interrupt callback function. */
|
||||
tx_complete_cb_t tx_complete_cb; /**< The transmit complete callback function. */
|
||||
uint8_t uart_index; // 串口索引
|
||||
USART_TypeDef *huart;
|
||||
DMA_TypeDef *dma; // 外部设置
|
||||
uint32_t dma_rx_channel; // 外部设置
|
||||
uint32_t dma_tx_channel; // 外部设置
|
||||
|
||||
uint16_t rx_index; // 接收数据索引
|
||||
BOOL rx_dma_en;
|
||||
uint8_t *rxbuf;
|
||||
uint16_t rx_sta;
|
||||
uint16_t rxsize;
|
||||
|
||||
uint16_t tx_index;
|
||||
BOOL tx_dma_en;
|
||||
uint8_t *txbuf;
|
||||
uint16_t txsize;
|
||||
|
||||
// 接收中断回调
|
||||
rx_interupt_cb_t rx_interupt_cb;
|
||||
// 发生完成回调
|
||||
tx_complete_cb_t tx_complete_cb;
|
||||
|
||||
} uart_t;
|
||||
|
||||
/**
|
||||
* @brief Creates a UART instance.
|
||||
*
|
||||
* This function creates a UART instance with the specified parameters.
|
||||
*
|
||||
* @param huart The UART peripheral.
|
||||
* @param rx_dma_en Flag indicating if DMA reception is enabled.
|
||||
* @param rxsize The size of the receive buffer.
|
||||
* @param rx_cb The receive interrupt callback function.
|
||||
* @param tx_dma_en Flag indicating if DMA transmission is enabled.
|
||||
* @param txsize The size of the transmit buffer.
|
||||
* @param tx_complete_cb The transmit complete callback function.
|
||||
* @return The created UART instance.
|
||||
*/
|
||||
extern uart_t *uart_create(USART_TypeDef *huart, BOOL rx_dma_en, uint16_t rxsize, rx_interupt_cb_t rx_cb,
|
||||
BOOL tx_dma_en, uint16_t txsize, tx_complete_cb_t tx_complete_cb);
|
||||
|
||||
/**
|
||||
* @brief Frees the resources of a UART instance.
|
||||
*
|
||||
* This function frees the resources allocated for a UART instance.
|
||||
*
|
||||
* @param uart The UART instance to free.
|
||||
*/
|
||||
extern void uart_free(uart_t *uart);
|
||||
|
||||
/**
|
||||
* @brief Enables UART reception.
|
||||
*
|
||||
* This function enables reception on the specified UART instance.
|
||||
*
|
||||
* @param uart The UART instance.
|
||||
*/
|
||||
extern void uart_recv_en(uart_t *uart);
|
||||
|
||||
/**
|
||||
* @brief Sends data over UART.
|
||||
*
|
||||
* This function sends the specified data over the specified UART instance.
|
||||
*
|
||||
* @param uart The UART instance.
|
||||
* @param data The data to send.
|
||||
* @param len The length of the data.
|
||||
*/
|
||||
extern void uart_send_data(uart_t *uart, uint8_t *data, uint16_t len);
|
||||
|
||||
/**
|
||||
* @brief UART receive interrupt callback.
|
||||
*
|
||||
* This function is the interrupt callback for UART receive interrupt.
|
||||
*
|
||||
* @param uart The UART instance.
|
||||
*/
|
||||
extern void uart_reception_callback(uart_t *uart);
|
||||
|
||||
/**
|
||||
* @brief DMA receive interrupt callback.
|
||||
*
|
||||
* This function is the interrupt callback for DMA receive interrupt.
|
||||
*
|
||||
* @param uart The UART instance.
|
||||
*/
|
||||
extern void uart_dma_reception_callback(uart_t *uart);
|
||||
BOOL tx_dma_en, uint16_t txsize, tx_complete_cb_t tx_complete_cb); // 创建uart
|
||||
extern void uart_free(uart_t *uart); // 释放uart资源
|
||||
extern void uart_recv_en(uart_t *uart); // 使能接收
|
||||
extern void uart_send_data(uart_t *uart, uint8_t *data, uint16_t len); // 发送数据
|
||||
extern void uart_reception_callback(uart_t *uart); // 接收中断回调
|
||||
extern void uart_dma_reception_callback(uart_t *uart); // DMA接收中断回调
|
||||
|
||||
#endif // __UARTS_H__
|
||||
|
|
28
motor.ioc
28
motor.ioc
|
@ -57,18 +57,20 @@ Mcu.Name=STM32L072R(B-Z)Tx
|
|||
Mcu.Package=LQFP64
|
||||
Mcu.Pin0=PH0-OSC_IN
|
||||
Mcu.Pin1=PH1-OSC_OUT
|
||||
Mcu.Pin10=PA14
|
||||
Mcu.Pin11=VP_SYS_VS_Systick
|
||||
Mcu.Pin12=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin10=PA10
|
||||
Mcu.Pin11=PA13
|
||||
Mcu.Pin12=PA14
|
||||
Mcu.Pin13=VP_SYS_VS_Systick
|
||||
Mcu.Pin14=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin2=PC3
|
||||
Mcu.Pin3=PB12
|
||||
Mcu.Pin4=PB13
|
||||
Mcu.Pin5=PB14
|
||||
Mcu.Pin6=PB15
|
||||
Mcu.Pin7=PA9
|
||||
Mcu.Pin8=PA10
|
||||
Mcu.Pin9=PA13
|
||||
Mcu.PinsNb=13
|
||||
Mcu.Pin3=PA7
|
||||
Mcu.Pin4=PB0
|
||||
Mcu.Pin5=PB12
|
||||
Mcu.Pin6=PB13
|
||||
Mcu.Pin7=PB14
|
||||
Mcu.Pin8=PB15
|
||||
Mcu.Pin9=PA9
|
||||
Mcu.PinsNb=15
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32L072RBTx
|
||||
|
@ -91,8 +93,12 @@ PA13.Mode=Serial_Wire
|
|||
PA13.Signal=SYS_SWDIO
|
||||
PA14.Mode=Serial_Wire
|
||||
PA14.Signal=SYS_SWCLK
|
||||
PA7.Mode=IN7
|
||||
PA7.Signal=ADC_IN7
|
||||
PA9.Mode=Asynchronous
|
||||
PA9.Signal=USART1_TX
|
||||
PB0.Mode=IN8
|
||||
PB0.Signal=ADC_IN8
|
||||
PB12.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
|
||||
PB12.GPIO_Label=ENA
|
||||
PB12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
|
|
Reference in New Issue