2个按键控制舵机旋转角度、速度

This commit is contained in:
james 2024-11-07 16:26:27 +08:00
parent 2830892d58
commit b6a0e98611
66 changed files with 5369 additions and 5224 deletions

2
Inc/key.h Normal file
View File

@ -0,0 +1,2 @@
#define KEY_PRESSED GPIO_PIN_RESET
#define KEY_NOT_PRESSED GPIO_PIN_SET

View File

@ -67,6 +67,12 @@ void Error_Handler(void);
#define LED_B_GPIO_Port GPIOE #define LED_B_GPIO_Port GPIOE
#define SERVO_Pin GPIO_PIN_15 #define SERVO_Pin GPIO_PIN_15
#define SERVO_GPIO_Port GPIOB #define SERVO_GPIO_Port GPIOB
#define KEY0_Pin GPIO_PIN_8
#define KEY0_GPIO_Port GPIOD
#define KEY1_Pin GPIO_PIN_9
#define KEY1_GPIO_Port GPIOD
#define KEY2_Pin GPIO_PIN_10
#define KEY2_GPIO_Port GPIOD
#define PB8_EXTI_Pin GPIO_PIN_8 #define PB8_EXTI_Pin GPIO_PIN_8
#define PB8_EXTI_GPIO_Port GPIOB #define PB8_EXTI_GPIO_Port GPIOB
#define PB8_EXTI_EXTI_IRQn EXTI9_5_IRQn #define PB8_EXTI_EXTI_IRQn EXTI9_5_IRQn

View File

@ -2,7 +2,7 @@
//Tanslate angle into Capture Compare Register value //Tanslate angle into Capture Compare Register value
#define ANGLETOCCR(angle) 2000 * (angle) / 180 + 500 #define ANGLETOCCR(angle) 2000 * (angle) / 180 + 500
extern uint8_t Servo_Speed,Servo_goal,Servo_position; extern int16_t Servo_Speed,Servo_goal,Servo_position;
void Servo_SetAngle(int goal); void Servo_SetAngle(int goal);
int Servo_toward(void); int Servo_toward(void);

Binary file not shown.

View File

@ -27,12 +27,12 @@ Project File Date: 11/07/2024
<h2>Output:</h2> <h2>Output:</h2>
*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'D:\Keil5\ARM\ARMCC\Bin' *** Using Compiler 'V5.06 update 5 (build 528)', folder: 'D:\Keil5\ARM\ARMCC\Bin'
Build target 'Project' Build target 'Project'
compiling main.c... compiling servo.c...
../Src/main.c(126): warning: #177-D: variable "ADC_Value" was declared but never referenced ..\Src\servo.c(25): warning: #177-D: variable "tt" was declared but never referenced
uint32_t ADC_Value; static uint8_t times = 0, tt = 0;
../Src/main.c: 1 warning, 0 errors ..\Src\servo.c: 1 warning, 0 errors
linking... linking...
Program Size: Code=18628 RO-data=59236 RW-data=36 ZI-data=2892 Program Size: Code=18972 RO-data=59236 RW-data=40 ZI-data=2896
FromELF: creating hex file... FromELF: creating hex file...
"Project\Project.axf" - 0 Error(s), 1 Warning(s). "Project\Project.axf" - 0 Error(s), 1 Warning(s).

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
"project\stm32l4xx_it.o" "project\stm32l4xx_it.o"
"project\stm32l4xx_hal_msp.o" "project\stm32l4xx_hal_msp.o"
"project\servo.o" "project\servo.o"
"project\key.o"
"project\stm32l4xx_hal_adc.o" "project\stm32l4xx_hal_adc.o"
"project\stm32l4xx_hal_adc_ex.o" "project\stm32l4xx_hal_adc_ex.o"
"project\stm32l4xx_hal.o" "project\stm32l4xx_hal.o"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
Dependencies for Project 'Project', Target 'Project': (DO NOT MODIFY !) Dependencies for Project 'Project', Target 'Project': (DO NOT MODIFY !)
F (startup_stm32l475xx.s)(0x672C524E)(--cpu Cortex-M4.fp -g --apcs=interwork --pd "__MICROLIB SETA 1" -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include --pd "__UVISION_VERSION SETA 514" --pd "_RTE_ SETA 1" --pd "STM32L475xx SETA 1" --list startup_stm32l475xx.lst --xref -o project\startup_stm32l475xx.o --depend project\startup_stm32l475xx.d) F (startup_stm32l475xx.s)(0x672C6B22)(--cpu Cortex-M4.fp -g --apcs=interwork --pd "__MICROLIB SETA 1" -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include --pd "__UVISION_VERSION SETA 514" --pd "_RTE_ SETA 1" --pd "STM32L475xx SETA 1" --list startup_stm32l475xx.lst --xref -o project\startup_stm32l475xx.o --depend project\startup_stm32l475xx.d)
F (..\Src\lcd.c)(0x672794C0)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\lcd.o --omf_browse project\lcd.crf --depend project\lcd.d) F (..\Src\lcd.c)(0x672794C0)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\lcd.o --omf_browse project\lcd.crf --depend project\lcd.d)
I (../Inc/sys.h)(0x67279973) I (../Inc/sys.h)(0x67279973)
I (../Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h)(0x671507AF) I (../Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h)(0x671507AF)
@ -116,8 +116,8 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (../Src/main.c)(0x672C5484)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\main.o --omf_browse project\main.crf --depend project\main.d) F (../Src/main.c)(0x672C77C1)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\main.o --omf_browse project\main.crf --depend project\main.d)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -162,10 +162,11 @@ I (../Inc/lcd.h)(0x5BF21D0E)
I (../Inc/sys.h)(0x67279973) I (../Inc/sys.h)(0x67279973)
I (D:\Keil5\ARM\ARMCC\include\stdio.h)(0x588B8344) I (D:\Keil5\ARM\ARMCC\include\stdio.h)(0x588B8344)
I (D:\Keil5\ARM\ARMCC\include\string.h)(0x588B8344) I (D:\Keil5\ARM\ARMCC\include\string.h)(0x588B8344)
I (../Inc/servo.h)(0x672C51E6) I (../Inc/servo.h)(0x672C7728)
F (../Src/gpio.c)(0x672A38B6)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\gpio.o --omf_browse project\gpio.crf --depend project\gpio.d) I (../Inc/key.h)(0x672C7132)
F (../Src/gpio.c)(0x672C6B1E)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\gpio.o --omf_browse project\gpio.crf --depend project\gpio.d)
I (../Inc/gpio.h)(0x6715E327) I (../Inc/gpio.h)(0x6715E327)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -201,9 +202,9 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (../Src/adc.c)(0x672B7423)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\adc.o --omf_browse project\adc.crf --depend project\adc.d) F (../Src/adc.c)(0x672C6DE4)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\adc.o --omf_browse project\adc.crf --depend project\adc.d)
I (../Inc/adc.h)(0x67284CF2) I (../Inc/adc.h)(0x67284CF2)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -241,7 +242,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (../Src/spi.c)(0x67279973)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\spi.o --omf_browse project\spi.crf --depend project\spi.d) F (../Src/spi.c)(0x67279973)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\spi.o --omf_browse project\spi.crf --depend project\spi.d)
I (../Inc/spi.h)(0x67279574) I (../Inc/spi.h)(0x67279574)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -279,7 +280,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (../Src/tim.c)(0x672C524A)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\tim.o --omf_browse project\tim.crf --depend project\tim.d) F (../Src/tim.c)(0x672C524A)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\tim.o --omf_browse project\tim.crf --depend project\tim.d)
I (../Inc/tim.h)(0x672C524A) I (../Inc/tim.h)(0x672C524A)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -317,7 +318,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (../Src/usart.c)(0x6728AD52)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\usart.o --omf_browse project\usart.crf --depend project\usart.d) F (../Src/usart.c)(0x6728AD52)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\usart.o --omf_browse project\usart.crf --depend project\usart.d)
I (../Inc/usart.h)(0x67276B93) I (../Inc/usart.h)(0x67276B93)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -353,8 +354,8 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (../Src/stm32l4xx_it.c)(0x672C524A)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\stm32l4xx_it.o --omf_browse project\stm32l4xx_it.crf --depend project\stm32l4xx_it.d) F (../Src/stm32l4xx_it.c)(0x672C7765)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\stm32l4xx_it.o --omf_browse project\stm32l4xx_it.crf --depend project\stm32l4xx_it.d)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -392,12 +393,12 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
I (../Inc/stm32l4xx_it.h)(0x672C524A) I (../Inc/stm32l4xx_it.h)(0x672C524A)
I (../Inc/tim.h)(0x672C524A) I (../Inc/tim.h)(0x672C524A)
I (../Inc/servo.h)(0x672C51E6) I (../Inc/servo.h)(0x672C7728)
I (../Inc/usart.h)(0x67276B93) I (../Inc/usart.h)(0x67276B93)
I (D:\Keil5\ARM\ARMCC\include\stdio.h)(0x588B8344) I (D:\Keil5\ARM\ARMCC\include\stdio.h)(0x588B8344)
I (../Inc/gpio.h)(0x6715E327) I (../Inc/gpio.h)(0x6715E327)
F (../Src/stm32l4xx_hal_msp.c)(0x6715E328)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\stm32l4xx_hal_msp.o --omf_browse project\stm32l4xx_hal_msp.crf --depend project\stm32l4xx_hal_msp.d) F (../Src/stm32l4xx_hal_msp.c)(0x6715E328)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\stm32l4xx_hal_msp.o --omf_browse project\stm32l4xx_hal_msp.crf --depend project\stm32l4xx_hal_msp.d)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -433,9 +434,9 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
F (..\Src\servo.c)(0x672C52EE)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\servo.o --omf_browse project\servo.crf --depend project\servo.d) F (..\Src\servo.c)(0x672C78EF)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\servo.o --omf_browse project\servo.crf --depend project\servo.d)
I (../Inc/servo.h)(0x672C51E6) I (../Inc/servo.h)(0x672C7728)
I (../Inc/main.h)(0x672B2071) I (../Inc/main.h)(0x672C6B20)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h)(0x671507AF)
@ -474,7 +475,9 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
I (../Inc/tim.h)(0x672C524A) I (../Inc/tim.h)(0x672C524A)
I (../Inc/lcd.h)(0x5BF21D0E) I (../Inc/lcd.h)(0x5BF21D0E)
I (../Inc/sys.h)(0x67279973) I (../Inc/sys.h)(0x67279973)
F (..\Inc\servo.h)(0x672C51E6)() F (..\Inc\servo.h)(0x672C7728)()
F (..\Src\key.c)(0x672C6F85)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\key.o --omf_browse project\key.crf --depend project\key.d)
F (..\Inc\key.h)(0x672C7132)()
F (../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c)(0x671507AF)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\stm32l4xx_hal_adc.o --omf_browse project\stm32l4xx_hal_adc.crf --depend project\stm32l4xx_hal_adc.d) F (../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c)(0x671507AF)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I D:\Develop\Stm32Project\Project\MDK-ARM\RTE -I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include -I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include -D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx -o project\stm32l4xx_hal_adc.o --omf_browse project\stm32l4xx_hal_adc.crf --depend project\stm32l4xx_hal_adc.d)
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF) I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD) I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
MDK-ARM/Project/key.crf Normal file

Binary file not shown.

1
MDK-ARM/Project/key.d Normal file
View File

@ -0,0 +1 @@
project\key.o: ..\Src\key.c

BIN
MDK-ARM/Project/key.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -46,3 +46,4 @@ project\main.o: ../Inc/sys.h
project\main.o: D:\Keil5\ARM\ARMCC\Bin\..\include\stdio.h project\main.o: D:\Keil5\ARM\ARMCC\Bin\..\include\stdio.h
project\main.o: D:\Keil5\ARM\ARMCC\Bin\..\include\string.h project\main.o: D:\Keil5\ARM\ARMCC\Bin\..\include\string.h
project\main.o: ../Inc/servo.h project\main.o: ../Inc/servo.h
project\main.o: ../Inc/key.h

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -31,23 +31,26 @@ Mcu.Name=STM32L475V(C-E-G)Tx
Mcu.Package=LQFP100 Mcu.Package=LQFP100
Mcu.Pin0=PH0-OSC_IN (PH0) Mcu.Pin0=PH0-OSC_IN (PH0)
Mcu.Pin1=PH1-OSC_OUT (PH1) Mcu.Pin1=PH1-OSC_OUT (PH1)
Mcu.Pin10=PC10 Mcu.Pin10=PD10
Mcu.Pin11=PC11 Mcu.Pin11=PA9
Mcu.Pin12=PC12 Mcu.Pin12=PA10
Mcu.Pin13=PB8 Mcu.Pin13=PC10
Mcu.Pin14=PB9 Mcu.Pin14=PC11
Mcu.Pin15=VP_SYS_VS_Systick Mcu.Pin15=PC12
Mcu.Pin16=VP_TIM7_VS_ClockSourceINT Mcu.Pin16=PB8
Mcu.Pin17=VP_TIM15_VS_ClockSourceINT Mcu.Pin17=PB9
Mcu.Pin18=VP_SYS_VS_Systick
Mcu.Pin19=VP_TIM7_VS_ClockSourceINT
Mcu.Pin2=PC2 Mcu.Pin2=PC2
Mcu.Pin20=VP_TIM15_VS_ClockSourceINT
Mcu.Pin3=PB2 Mcu.Pin3=PB2
Mcu.Pin4=PE7 Mcu.Pin4=PE7
Mcu.Pin5=PE8 Mcu.Pin5=PE8
Mcu.Pin6=PE9 Mcu.Pin6=PE9
Mcu.Pin7=PB15 Mcu.Pin7=PB15
Mcu.Pin8=PA9 Mcu.Pin8=PD8
Mcu.Pin9=PA10 Mcu.Pin9=PD9
Mcu.PinsNb=18 Mcu.PinsNb=21
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32L475VETx Mcu.UserName=STM32L475VETx
@ -97,6 +100,18 @@ PC11.Signal=SPI3_MISO
PC12.Mode=Full_Duplex_Master PC12.Mode=Full_Duplex_Master
PC12.Signal=SPI3_MOSI PC12.Signal=SPI3_MOSI
PC2.Signal=ADCx_IN3 PC2.Signal=ADCx_IN3
PD10.GPIOParameters=GPIO_Label
PD10.GPIO_Label=KEY2
PD10.Locked=true
PD10.Signal=GPIO_Input
PD8.GPIOParameters=GPIO_Label
PD8.GPIO_Label=KEY0
PD8.Locked=true
PD8.Signal=GPIO_Input
PD9.GPIOParameters=GPIO_Label
PD9.GPIO_Label=KEY1
PD9.Locked=true
PD9.Signal=GPIO_Input
PE7.GPIOParameters=GPIO_PuPd,GPIO_Label PE7.GPIOParameters=GPIO_PuPd,GPIO_Label
PE7.GPIO_Label=LED_R PE7.GPIO_Label=LED_R
PE7.GPIO_PuPd=GPIO_PULLUP PE7.GPIO_PuPd=GPIO_PULLUP
@ -146,7 +161,7 @@ ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath= ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=false ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_SPI3_Init-SPI3-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM15_Init-TIM15-false-HAL-true ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_SPI3_Init-SPI3-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM15_Init-TIM15-false-HAL-true,8-MX_TIM7_Init-TIM7-false-HAL-true
RCC.ADCFreq_Value=12000000 RCC.ADCFreq_Value=12000000
RCC.AHBFreq_Value=72000000 RCC.AHBFreq_Value=72000000
RCC.APB1Freq_Value=72000000 RCC.APB1Freq_Value=72000000

View File

@ -86,7 +86,6 @@ void MX_ADC1_Init(void)
/* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE BEGIN ADC1_Init 2 */
/* USER CODE END ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */
} }
void HAL_ADC_MspInit(ADC_HandleTypeDef *adcHandle) void HAL_ADC_MspInit(ADC_HandleTypeDef *adcHandle)
@ -173,14 +172,12 @@ uint16_t Get_Adc(uint32_t ch)
if (HAL_ADC_PollForConversion(&hadc1, 10) == HAL_OK) if (HAL_ADC_PollForConversion(&hadc1, 10) == HAL_OK)
{ {
//????
return (uint16_t)HAL_ADC_GetValue(&hadc1); return (uint16_t)HAL_ADC_GetValue(&hadc1);
} }
else else
{ {
return 0; return 0;
}//??????ADC1???????? }
} }
uint16_t Get_Adc_Average(uint32_t ch, uint8_t times) uint16_t Get_Adc_Average(uint32_t ch, uint8_t times)
{ {

View File

@ -49,6 +49,7 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
@ -71,6 +72,12 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
/*Configure GPIO pins : PDPin PDPin PDPin */
GPIO_InitStruct.Pin = KEY0_Pin|KEY1_Pin|KEY2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/*Configure GPIO pins : PBPin PBPin */ /*Configure GPIO pins : PBPin PBPin */
GPIO_InitStruct.Pin = PB8_EXTI_Pin|PB9_EXTI_Pin; GPIO_InitStruct.Pin = PB8_EXTI_Pin|PB9_EXTI_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;

0
Src/key.c Normal file
View File

View File

@ -31,6 +31,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "servo.h" #include "servo.h"
#include "key.h"
/* USER CODE END Includes */ /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
@ -61,53 +62,12 @@ int cnt = 0;
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void); void SystemClock_Config(void);
/* USER CODE BEGIN PFP */ /* USER CODE BEGIN PFP */
int fputc(int ch, FILE *f) void Servo_test(void);
{ int fputc(int ch, FILE *f);
int fgetc(FILE *f);
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF); void Breathing_light(void);
return ch; void ADC_BEEP(void);
} void Key_get(void);
int fgetc(FILE *f)
{
int ch;
// while (__HAL_UART_GET_FLAG(&huart1, UART_FLAG_RXNE) == RESET);
HAL_UART_Receive(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
return (ch);
}
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
printf("rx\r\n");
if (huart == &huart1)
{
rxdata[Size] = '\0';
if (strcmp(rxdata, "LED1") == 0)
{
LED1_ON=!LED1_ON;
HAL_GPIO_TogglePin(LED_R_GPIO_Port, LED_R_Pin);
}
else if (strcmp(rxdata, "LED2") == 0)
{
LED2_ON=!LED2_ON;
HAL_GPIO_TogglePin(LED_G_GPIO_Port, LED_G_Pin);
}
else if (strcmp(rxdata, "LED3") == 0)
{
LED_B_ON=!LED_B_ON;
LED3_ON=!LED3_ON;
}
else
{
cnt=0;
for(int i=0;i<Size;i++)
{
cnt*=10;
cnt+=rxdata[i]-'0';
}
Servo_goal=cnt;
}
HAL_UARTEx_ReceiveToIdle_IT(&huart1, (uint8_t *)rxdata, sizeof(rxdata));
}
}
/* USER CODE END PFP */ /* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/ /* Private user code ---------------------------------------------------------*/
@ -169,65 +129,17 @@ int main(void)
//__HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_2,5); //__HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_2,5);
HAL_TIM_Base_Start_IT(&htim7); HAL_TIM_Base_Start_IT(&htim7);
while (1) while (1)
{ //??ADC??
// HAL_ADC_PollForConversion(&hadc1, 50); //??????,50???????,???ms
// if (HAL_IS_BIT_SET(HAL_ADC_GetState(&hadc1), HAL_ADC_STATE_REG_EOC))
// {
#ifdef ONE_ADC_BEEP
ADC_Value = Get_Adc_Average(ADC_CHANNEL_3, 5); //??AD?
LCD_ShowxNum(50, 100, ADC_Value, 4, 16, 0);
if (ADC_Value * 3.3 / 4095 > 1.7)
{ {
cnt++; ADC_BEEP();
} LCD_ShowxNum(50, 50, Servo_Speed, 4, 16, 0);
else LCD_ShowxNum(50, 200, Servo_goal, 4, 16, 0);
{ LCD_ShowxNum(50, 150, Servo_position, 4, 16, 0);
cnt = 0;
}
if (cnt == 50)
{
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
}
LCD_ShowxNum(50, 200, cnt, 4, 16, 0);
HAL_GPIO_TogglePin(LED_B_GPIO_Port,LED_B_Pin);
// }
HAL_Delay(100);
#endif
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */
Key_get();
//cnt=(cnt+30)%(180+30); // Servo_test();
LCD_ShowxNum(50, 200, cnt, 4, 16, 0); Breathing_light();
LCD_ShowxNum(50, 150, ANGLETOCCR(cnt), 4, 16, 0);
// Servo_SetAngle(cnt);
HAL_GPIO_TogglePin(LED_R_GPIO_Port, LED_R_Pin);
HAL_Delay(1000);
if(!LED_B_ON)
{
continue;
}
for(int i=0;i<=100;i++)
{
__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,100-i);
HAL_Delay(10);
}
for(int i=0;i<=100;i++)
{
__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,i);
HAL_Delay(10);
}
//HAL_Delay(500);
} }
/* USER CODE END 3 */ /* USER CODE END 3 */
} }
@ -267,8 +179,7 @@ void SystemClock_Config(void)
/** Initializes the CPU, AHB and APB buses clocks /** Initializes the CPU, AHB and APB buses clocks
*/ */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
@ -281,7 +192,134 @@ void SystemClock_Config(void)
} }
/* USER CODE BEGIN 4 */ /* USER CODE BEGIN 4 */
void Servo_test(void)
{
// cnt=(cnt+30)%(180+30);
LCD_ShowxNum(50, 200, cnt, 4, 16, 0);
LCD_ShowxNum(50, 150, ANGLETOCCR(cnt), 4, 16, 0);
Servo_SetAngle(cnt);
HAL_GPIO_TogglePin(LED_R_GPIO_Port, LED_R_Pin);
}
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
printf("rx\r\n");
if (huart == &huart1)
{
rxdata[Size] = '\0';
if (strcmp(rxdata, "LED1") == 0)
{
LED1_ON = !LED1_ON;
HAL_GPIO_TogglePin(LED_R_GPIO_Port, LED_R_Pin);
}
else if (strcmp(rxdata, "LED2") == 0)
{
LED2_ON = !LED2_ON;
HAL_GPIO_TogglePin(LED_G_GPIO_Port, LED_G_Pin);
}
else if (strcmp(rxdata, "LED3") == 0)
{
LED_B_ON = !LED_B_ON;
LED3_ON = !LED3_ON;
}
else
{
cnt = 0;
for (int i = 0; i < Size; i++)
{
cnt *= 10;
cnt += rxdata[i] - '0';
}
Servo_goal = cnt;
}
HAL_UARTEx_ReceiveToIdle_IT(&huart1, (uint8_t *)rxdata, sizeof(rxdata));
}
}
int fgetc(FILE *f)
{
int ch;
// while (__HAL_UART_GET_FLAG(&huart1, UART_FLAG_RXNE) == RESET);
HAL_UART_Receive(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
return (ch);
}
int fputc(int ch, FILE *f)
{
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
// LED_B的呼吸灯
void Breathing_light(void)
{
if (!LED_B_ON)
{
return;
}
for (int i = 0; i <= 100; i++)
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, 100 - i);
HAL_Delay(10);
}
for (int i = 0; i <= 100; i++)
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, i);
HAL_Delay(10);
}
}
void ADC_BEEP(void)
{
#ifdef ONE_ADC_BEEP
ADC_Value = Get_Adc_Average(ADC_CHANNEL_3, 5); //??AD?
LCD_ShowxNum(50, 100, ADC_Value, 4, 16, 0);
if (ADC_Value * 3.3 / 4095 > 1.7)
{
cnt++;
}
else
{
cnt = 0;
}
if (cnt == 50)
{
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
HAL_Delay(100);
HAL_GPIO_TogglePin(BEEP_GPIO_Port, BEEP_Pin);
}
LCD_ShowxNum(50, 200, cnt, 4, 16, 0);
HAL_GPIO_TogglePin(LED_B_GPIO_Port, LED_B_Pin);
// }
HAL_Delay(100);
#endif
}
void Key_get(void)
{
if (HAL_GPIO_ReadPin(KEY0_GPIO_Port, KEY0_Pin) == KEY_PRESSED)
{
HAL_Delay(15);
LCD_ShowxNum(50, 150, Servo_position, 4, 16, 0);
while (HAL_GPIO_ReadPin(KEY0_GPIO_Port, KEY0_Pin) == KEY_PRESSED)
;
Servo_goal = (Servo_goal + 90) % (180 + 90);
LCD_ShowxNum(50, 200, Servo_goal, 4, 16, 0);
HAL_Delay(15);
}
if (HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin) == KEY_PRESSED)
{
HAL_Delay(15);
while (HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin) == KEY_PRESSED)
;
Servo_Speed = Servo_Speed % 3 + 1;
LCD_ShowxNum(50, 50, Servo_Speed, 4, 16, 0);
HAL_Delay(15);
}
}
/* USER CODE END 4 */ /* USER CODE END 4 */
/** /**

View File

@ -2,7 +2,7 @@
#include "tim.h" #include "tim.h"
#include "lcd.h" #include "lcd.h"
uint8_t Servo_Speed = 1, Servo_goal = 0, Servo_position = 0; int16_t Servo_Speed = 1, Servo_goal = 0, Servo_position = 0;
void Servo_SetAngle(int goal) void Servo_SetAngle(int goal)
{ {
@ -13,7 +13,11 @@ void Servo_SetAngle(int goal)
// 往哪个方向转 // 往哪个方向转
int Servo_toward(void) int Servo_toward(void)
{ {
return Servo_goal > Servo_position; if (Servo_goal > Servo_position)
{
return 1;
}
return -1;
} }
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
@ -21,15 +25,10 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
static uint8_t times = 0, tt = 0; static uint8_t times = 0, tt = 0;
if (htim == &htim7) if (htim == &htim7)
{ {
// if (++times == 250) if (++times == 1000)
// { {
// LCD_ShowxNum(50, 50, ++tt, 4, 16, 0); times = 0;
// times = 0; }
// }
// else
// {
// return;
// }
if (Servo_position == Servo_goal) if (Servo_position == Servo_goal)
{ {
return; return;
@ -38,11 +37,11 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{ {
Servo_position = Servo_goal; Servo_position = Servo_goal;
} }
if (Servo_Speed == 2) if (Servo_Speed == 2 && times % 5 == 0)
{ {
Servo_position += Servo_toward() * 9; Servo_position += Servo_toward();
} }
if (Servo_Speed == 3) if (Servo_Speed == 3 && times % 50 == 0)
{ {
Servo_position += Servo_toward(); Servo_position += Servo_toward();
} }

View File

@ -63,7 +63,7 @@
extern TIM_HandleTypeDef htim7; extern TIM_HandleTypeDef htim7;
extern UART_HandleTypeDef huart1; extern UART_HandleTypeDef huart1;
/* USER CODE BEGIN EV */ /* USER CODE BEGIN EV */
extern uint8_t Servo_Speed;
extern uint8_t LED_B_ON,LED1_ON,LED2_ON,LED3_ON; extern uint8_t LED_B_ON,LED1_ON,LED2_ON,LED3_ON;
/* USER CODE END EV */ /* USER CODE END EV */