旋转编码器控制LED明暗,按钮控制电机转速

This commit is contained in:
james 2024-11-07 21:23:17 +08:00
parent b6a0e98611
commit 7908b65803
35 changed files with 5135 additions and 4994 deletions

View File

@ -1,2 +1,5 @@
#define KEY_PRESSED GPIO_PIN_RESET #define KEY_PRESSED GPIO_PIN_RESET
#define KEY_NOT_PRESSED GPIO_PIN_SET #define KEY_NOT_PRESSED GPIO_PIN_SET
//WK_UP 是高电平有效,其他三个按键是低电平有效。
#define KEY_UP_PRESSED GPIO_PIN_SET
#define KEY_UP_NOT_PRESSED GPIO_PIN_RESET

View File

@ -57,6 +57,10 @@ void Error_Handler(void);
/* USER CODE END EFP */ /* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/ /* Private defines -----------------------------------------------------------*/
#define KEY_UP_Pin GPIO_PIN_13
#define KEY_UP_GPIO_Port GPIOC
#define BIN1_Pin GPIO_PIN_4
#define BIN1_GPIO_Port GPIOA
#define BEEP_Pin GPIO_PIN_2 #define BEEP_Pin GPIO_PIN_2
#define BEEP_GPIO_Port GPIOB #define BEEP_GPIO_Port GPIOB
#define LED_R_Pin GPIO_PIN_7 #define LED_R_Pin GPIO_PIN_7
@ -65,14 +69,18 @@ void Error_Handler(void);
#define LED_G_GPIO_Port GPIOE #define LED_G_GPIO_Port GPIOE
#define LED_B_Pin GPIO_PIN_9 #define LED_B_Pin GPIO_PIN_9
#define LED_B_GPIO_Port GPIOE #define LED_B_GPIO_Port GPIOE
#define BIN2_Pin GPIO_PIN_11
#define BIN2_GPIO_Port GPIOB
#define PWMB_Pin GPIO_PIN_13
#define PWMB_GPIO_Port GPIOB
#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 KEY_LEFT_Pin GPIO_PIN_8
#define KEY0_GPIO_Port GPIOD #define KEY_LEFT_GPIO_Port GPIOD
#define KEY1_Pin GPIO_PIN_9 #define KEY_DOWN_Pin GPIO_PIN_9
#define KEY1_GPIO_Port GPIOD #define KEY_DOWN_GPIO_Port GPIOD
#define KEY2_Pin GPIO_PIN_10 #define KEY_RIGHT_Pin GPIO_PIN_10
#define KEY2_GPIO_Port GPIOD #define KEY_RIGHT_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

@ -1,6 +1,6 @@
#include "main.h" #include "main.h"
//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 int16_t Servo_Speed,Servo_goal,Servo_position; extern int16_t Servo_Speed,Servo_goal,Servo_position;

View File

@ -49,7 +49,7 @@ void MX_TIM15_Init(void);
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
/* USER CODE BEGIN Prototypes */ /* USER CODE BEGIN Prototypes */
int NewCCRValue(int now_ccr,int plus,int maxvalue);
/* USER CODE END Prototypes */ /* USER CODE END Prototypes */
#ifdef __cplusplus #ifdef __cplusplus

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 servo.c... compiling main.c...
..\Src\servo.c(25): warning: #177-D: variable "tt" was declared but never referenced ../Src/main.c(86): warning: #177-D: variable "ADC_Value" was declared but never referenced
static uint8_t times = 0, tt = 0; uint32_t ADC_Value;
..\Src\servo.c: 1 warning, 0 errors ../Src/main.c: 1 warning, 0 errors
linking... linking...
Program Size: Code=18972 RO-data=59236 RW-data=40 ZI-data=2896 Program Size: Code=19496 RO-data=59236 RW-data=44 ZI-data=2892
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

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)(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 (startup_stm32l475xx.s)(0x672CB687)(--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)(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) F (../Src/main.c)(0x672CBCC5)(--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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -155,18 +155,18 @@ 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/adc.h)(0x67284CF2) I (../Inc/adc.h)(0x67284CF2)
I (../Inc/spi.h)(0x67279574) I (../Inc/spi.h)(0x67279574)
I (../Inc/tim.h)(0x672C524A) I (../Inc/tim.h)(0x672CB995)
I (../Inc/usart.h)(0x67276B93) I (../Inc/usart.h)(0x67276B93)
I (../Inc/gpio.h)(0x6715E327) I (../Inc/gpio.h)(0x6715E327)
I (../Inc/lcd.h)(0x5BF21D0E) 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)(0x672C7728) I (../Inc/servo.h)(0x672CAFBD)
I (../Inc/key.h)(0x672C7132) I (../Inc/key.h)(0x672CBCA2)
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) F (../Src/gpio.c)(0x672CB682)(--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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -202,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)(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) F (../Src/adc.c)(0x672CAB52)(--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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -242,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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -278,9 +278,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/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)(0x672CB991)(--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)(0x672CB995)
I (../Inc/main.h)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -318,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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -354,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)(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) F (../Src/stm32l4xx_it.c)(0x672CB9B9)(--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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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,13 +392,13 @@ 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)
I (../Inc/stm32l4xx_it.h)(0x672C524A) I (../Inc/stm32l4xx_it.h)(0x672C524A)
I (../Inc/tim.h)(0x672C524A) I (../Inc/tim.h)(0x672CB995)
I (../Inc/servo.h)(0x672C7728) I (../Inc/servo.h)(0x672CAFBD)
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)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -435,8 +435,8 @@ 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)(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) 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)(0x672C7728) I (../Inc/servo.h)(0x672CAFBD)
I (../Inc/main.h)(0x672C6B20) I (../Inc/main.h)(0x672CB685)
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)
@ -472,12 +472,12 @@ 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)
I (../Inc/tim.h)(0x672C524A) I (../Inc/tim.h)(0x672CB995)
I (../Inc/lcd.h)(0x5BF21D0E) I (../Inc/lcd.h)(0x5BF21D0E)
I (../Inc/sys.h)(0x67279973) I (../Inc/sys.h)(0x67279973)
F (..\Inc\servo.h)(0x672C7728)() F (..\Inc\servo.h)(0x672CAFBD)()
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 (..\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 (..\Inc\key.h)(0x672CBCA2)()
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.

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

@ -29,28 +29,32 @@ Mcu.IP8=USART1
Mcu.IPNb=9 Mcu.IPNb=9
Mcu.Name=STM32L475V(C-E-G)Tx Mcu.Name=STM32L475V(C-E-G)Tx
Mcu.Package=LQFP100 Mcu.Package=LQFP100
Mcu.Pin0=PH0-OSC_IN (PH0) Mcu.Pin0=PC13
Mcu.Pin1=PH1-OSC_OUT (PH1) Mcu.Pin1=PH0-OSC_IN (PH0)
Mcu.Pin10=PD10 Mcu.Pin10=PB13
Mcu.Pin11=PA9 Mcu.Pin11=PB15
Mcu.Pin12=PA10 Mcu.Pin12=PD8
Mcu.Pin13=PC10 Mcu.Pin13=PD9
Mcu.Pin14=PC11 Mcu.Pin14=PD10
Mcu.Pin15=PC12 Mcu.Pin15=PA9
Mcu.Pin16=PB8 Mcu.Pin16=PA10
Mcu.Pin17=PB9 Mcu.Pin17=PC10
Mcu.Pin18=VP_SYS_VS_Systick Mcu.Pin18=PC11
Mcu.Pin19=VP_TIM7_VS_ClockSourceINT Mcu.Pin19=PC12
Mcu.Pin2=PC2 Mcu.Pin2=PH1-OSC_OUT (PH1)
Mcu.Pin20=VP_TIM15_VS_ClockSourceINT Mcu.Pin20=PB8
Mcu.Pin3=PB2 Mcu.Pin21=PB9
Mcu.Pin4=PE7 Mcu.Pin22=VP_SYS_VS_Systick
Mcu.Pin5=PE8 Mcu.Pin23=VP_TIM7_VS_ClockSourceINT
Mcu.Pin6=PE9 Mcu.Pin24=VP_TIM15_VS_ClockSourceINT
Mcu.Pin7=PB15 Mcu.Pin3=PC2
Mcu.Pin8=PD8 Mcu.Pin4=PA4
Mcu.Pin9=PD9 Mcu.Pin5=PB2
Mcu.PinsNb=21 Mcu.Pin6=PE7
Mcu.Pin7=PE8
Mcu.Pin8=PE9
Mcu.Pin9=PB11
Mcu.PinsNb=25
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32L475VETx Mcu.UserName=STM32L475VETx
@ -72,8 +76,23 @@ NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
PA10.Mode=Asynchronous PA10.Mode=Asynchronous
PA10.Signal=USART1_RX PA10.Signal=USART1_RX
PA4.GPIOParameters=GPIO_PuPd,GPIO_Label
PA4.GPIO_Label=BIN1
PA4.GPIO_PuPd=GPIO_PULLUP
PA4.Locked=true
PA4.Signal=GPIO_Output
PA9.Mode=Asynchronous PA9.Mode=Asynchronous
PA9.Signal=USART1_TX PA9.Signal=USART1_TX
PB11.GPIOParameters=GPIO_PuPd,GPIO_Label
PB11.GPIO_Label=BIN2
PB11.GPIO_PuPd=GPIO_PULLDOWN
PB11.Locked=true
PB11.Signal=GPIO_Output
PB13.GPIOParameters=GPIO_Label
PB13.GPIO_Label=PWMB
PB13.Locked=true
PB13.Mode=PWM Generation1 CH1N
PB13.Signal=TIM15_CH1N
PB15.GPIOParameters=GPIO_Label PB15.GPIOParameters=GPIO_Label
PB15.GPIO_Label=SERVO PB15.GPIO_Label=SERVO
PB15.Locked=true PB15.Locked=true
@ -99,17 +118,21 @@ PC11.Mode=Full_Duplex_Master
PC11.Signal=SPI3_MISO PC11.Signal=SPI3_MISO
PC12.Mode=Full_Duplex_Master PC12.Mode=Full_Duplex_Master
PC12.Signal=SPI3_MOSI PC12.Signal=SPI3_MOSI
PC13.GPIOParameters=GPIO_Label
PC13.GPIO_Label=KEY_UP
PC13.Locked=true
PC13.Signal=GPIO_Input
PC2.Signal=ADCx_IN3 PC2.Signal=ADCx_IN3
PD10.GPIOParameters=GPIO_Label PD10.GPIOParameters=GPIO_Label
PD10.GPIO_Label=KEY2 PD10.GPIO_Label=KEY_RIGHT
PD10.Locked=true PD10.Locked=true
PD10.Signal=GPIO_Input PD10.Signal=GPIO_Input
PD8.GPIOParameters=GPIO_Label PD8.GPIOParameters=GPIO_Label
PD8.GPIO_Label=KEY0 PD8.GPIO_Label=KEY_LEFT
PD8.Locked=true PD8.Locked=true
PD8.Signal=GPIO_Input PD8.Signal=GPIO_Input
PD9.GPIOParameters=GPIO_Label PD9.GPIOParameters=GPIO_Label
PD9.GPIO_Label=KEY1 PD9.GPIO_Label=KEY_DOWN
PD9.Locked=true PD9.Locked=true
PD9.Signal=GPIO_Input PD9.Signal=GPIO_Input
PE7.GPIOParameters=GPIO_PuPd,GPIO_Label PE7.GPIOParameters=GPIO_PuPd,GPIO_Label
@ -233,13 +256,13 @@ SPI3.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
SPI3.Mode=SPI_MODE_MASTER SPI3.Mode=SPI_MODE_MASTER
SPI3.VirtualType=VM_MASTER SPI3.VirtualType=VM_MASTER
TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM1.Channel-PWM\ Generation1\ CH1\ CH1N=TIM_CHANNEL_1 TIM1.IPParameters=Channel-PWM Generation1 CH1,Period,Prescaler,Pulse-PWM Generation1 CH1
TIM1.IPParameters=Channel-PWM Generation1 CH1 CH1N,Channel-PWM Generation1 CH1,Period,Prescaler,Pulse-PWM Generation1 CH1
TIM1.Period=100-1 TIM1.Period=100-1
TIM1.Prescaler=720-1 TIM1.Prescaler=720-1
TIM1.Pulse-PWM\ Generation1\ CH1=100 TIM1.Pulse-PWM\ Generation1\ CH1=100
TIM15.Channel-PWM\ Generation1\ CH1N=TIM_CHANNEL_1
TIM15.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2 TIM15.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
TIM15.IPParameters=Channel-PWM Generation2 CH2,Prescaler,Period,Pulse-PWM Generation2 CH2 TIM15.IPParameters=Channel-PWM Generation2 CH2,Prescaler,Period,Pulse-PWM Generation2 CH2,Channel-PWM Generation1 CH1N
TIM15.Period=20000-1 TIM15.Period=20000-1
TIM15.Prescaler=72-1 TIM15.Prescaler=72-1
TIM15.Pulse-PWM\ Generation2\ CH2=500 TIM15.Pulse-PWM\ Generation2\ CH2=500

View File

@ -86,14 +86,15 @@ 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)
{ {
GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if (adcHandle->Instance == ADC1) if(adcHandle->Instance==ADC1)
{ {
/* USER CODE BEGIN ADC1_MspInit 0 */ /* USER CODE BEGIN ADC1_MspInit 0 */
@ -133,10 +134,10 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef *adcHandle)
} }
} }
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *adcHandle) void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
{ {
if (adcHandle->Instance == ADC1) if(adcHandle->Instance==ADC1)
{ {
/* USER CODE BEGIN ADC1_MspDeInit 0 */ /* USER CODE BEGIN ADC1_MspDeInit 0 */

View File

@ -45,19 +45,35 @@ void MX_GPIO_Init(void)
GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */ /* GPIO Ports Clock Enable */
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_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_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(BEEP_GPIO_Port, BEEP_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(BIN1_GPIO_Port, BIN1_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, BEEP_Pin|BIN2_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOE, LED_R_Pin|LED_G_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOE, LED_R_Pin|LED_G_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = KEY_UP_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(KEY_UP_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = BIN1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(BIN1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = BEEP_Pin; GPIO_InitStruct.Pin = BEEP_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
@ -72,8 +88,15 @@ 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 pin : PtPin */
GPIO_InitStruct.Pin = BIN2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(BIN2_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PDPin PDPin PDPin */ /*Configure GPIO pins : PDPin PDPin PDPin */
GPIO_InitStruct.Pin = KEY0_Pin|KEY1_Pin|KEY2_Pin; GPIO_InitStruct.Pin = KEY_LEFT_Pin|KEY_DOWN_Pin|KEY_RIGHT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

View File

@ -41,7 +41,7 @@
/* Private define ------------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */ /* USER CODE BEGIN PD */
#define MOTORCCR(speed) (20000*(speed)/20)
/* USER CODE END PD */ /* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/
@ -55,7 +55,7 @@
char rxdata[52]; char rxdata[52];
uint16_t rxlen = 52; uint16_t rxlen = 52;
uint8_t LED_B_ON = 0, LED1_ON = 0, LED2_ON = 0, LED3_ON = 0; uint8_t LED_B_ON = 0, LED1_ON = 0, LED2_ON = 0, LED3_ON = 0;
uint8_t Motor_Speed=0;
int cnt = 0; int cnt = 0;
/* USER CODE END PV */ /* USER CODE END PV */
@ -118,6 +118,7 @@ int main(void)
POINT_COLOR = BLUE; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ POINT_COLOR = BLUE; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim15, TIM_CHANNEL_2); HAL_TIM_PWM_Start(&htim15, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start(&htim15, TIM_CHANNEL_1);
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Infinite loop */ /* Infinite loop */
@ -125,6 +126,9 @@ int main(void)
HAL_GPIO_WritePin(LED_R_GPIO_Port, LED_R_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LED_R_GPIO_Port, LED_R_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(LED_G_GPIO_Port, LED_G_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LED_G_GPIO_Port, LED_G_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(LED_B_GPIO_Port, LED_B_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LED_B_GPIO_Port, LED_B_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(BIN1_GPIO_Port,BIN1_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(BIN2_GPIO_Port, BIN2_Pin, GPIO_PIN_SET);
printf("Hello!"); printf("Hello!");
//__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);
@ -132,6 +136,8 @@ int main(void)
{ {
ADC_BEEP(); ADC_BEEP();
LCD_ShowxNum(50, 50, Servo_Speed, 4, 16, 0); LCD_ShowxNum(50, 50, Servo_Speed, 4, 16, 0);
LCD_ShowxNum(150, 50, Motor_Speed, 4, 16, 0);
LCD_ShowxNum(50, 100, HAL_GPIO_ReadPin(PB8_EXTI_GPIO_Port,PB8_EXTI_Pin), 4, 16, 0);
LCD_ShowxNum(50, 200, Servo_goal, 4, 16, 0); LCD_ShowxNum(50, 200, Servo_goal, 4, 16, 0);
LCD_ShowxNum(50, 150, Servo_position, 4, 16, 0); LCD_ShowxNum(50, 150, Servo_position, 4, 16, 0);
/* USER CODE END WHILE */ /* USER CODE END WHILE */
@ -139,7 +145,7 @@ int main(void)
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */
Key_get(); Key_get();
// Servo_test(); // Servo_test();
Breathing_light(); //Breathing_light();
} }
/* USER CODE END 3 */ /* USER CODE END 3 */
} }
@ -179,7 +185,8 @@ 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_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|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;
@ -300,25 +307,43 @@ void ADC_BEEP(void)
} }
void Key_get(void) void Key_get(void)
{ {
if (HAL_GPIO_ReadPin(KEY0_GPIO_Port, KEY0_Pin) == KEY_PRESSED) if (HAL_GPIO_ReadPin(KEY_LEFT_GPIO_Port, KEY_LEFT_Pin) == KEY_PRESSED)
{ {
HAL_Delay(15); HAL_Delay(15);
LCD_ShowxNum(50, 150, Servo_position, 4, 16, 0); LCD_ShowxNum(50, 150, Servo_position, 4, 16, 0);
while (HAL_GPIO_ReadPin(KEY0_GPIO_Port, KEY0_Pin) == KEY_PRESSED) while (HAL_GPIO_ReadPin(KEY_LEFT_GPIO_Port, KEY_LEFT_Pin) == KEY_PRESSED)
; ;
Servo_goal = (Servo_goal + 90) % (180 + 90); Servo_goal = (Servo_goal + 90) % (180 + 90);
LCD_ShowxNum(50, 200, Servo_goal, 4, 16, 0); LCD_ShowxNum(50, 200, Servo_goal, 4, 16, 0);
HAL_Delay(15); HAL_Delay(15);
} }
if (HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin) == KEY_PRESSED) if (HAL_GPIO_ReadPin(KEY_RIGHT_GPIO_Port, KEY_RIGHT_Pin) == KEY_PRESSED)
{ {
HAL_Delay(15); HAL_Delay(15);
while (HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin) == KEY_PRESSED) while (HAL_GPIO_ReadPin(KEY_RIGHT_GPIO_Port, KEY_RIGHT_Pin) == KEY_PRESSED)
; ;
Servo_Speed = Servo_Speed % 3 + 1; Servo_Speed = Servo_Speed % 3 + 1;
LCD_ShowxNum(50, 50, Servo_Speed, 4, 16, 0); LCD_ShowxNum(50, 50, Servo_Speed, 4, 16, 0);
HAL_Delay(15); HAL_Delay(15);
} }
if (HAL_GPIO_ReadPin(KEY_UP_GPIO_Port, KEY_UP_Pin) == KEY_UP_PRESSED)
{
HAL_Delay(15);
while (HAL_GPIO_ReadPin(KEY_UP_GPIO_Port, KEY_UP_Pin) == KEY_UP_PRESSED);
Motor_Speed = NewCCRValue(Motor_Speed,+1,20);
HAL_Delay(15);
HAL_GPIO_TogglePin(LED_G_GPIO_Port, LED_G_Pin);
__HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_1,MOTORCCR(Motor_Speed));
}
if (HAL_GPIO_ReadPin(KEY_DOWN_GPIO_Port, KEY_DOWN_Pin) == KEY_PRESSED)
{
HAL_Delay(15);
while (HAL_GPIO_ReadPin(KEY_DOWN_GPIO_Port, KEY_DOWN_Pin) == KEY_PRESSED);
Motor_Speed = NewCCRValue(Motor_Speed,-1,20);
HAL_Delay(15);
HAL_GPIO_TogglePin(LED_G_GPIO_Port, LED_G_Pin);
__HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_1,MOTORCCR(Motor_Speed));
}
} }
/* USER CODE END 4 */ /* USER CODE END 4 */

0
Src/motor.c Normal file
View File

View File

@ -250,38 +250,28 @@ void TIM7_IRQHandler(void)
} }
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
uint8_t NewCCRValue(int now_ccr,int plus)
{
if(now_ccr==100&&plus>0)
{
return now_ccr;
}
if(now_ccr==0&&plus<0)
{
return now_ccr;
}
return now_ccr+plus;
}
void SET3CCR(int plus) void SET3CCR(int plus)
{ {
if(LED3_ON) if(LED3_ON)
{ {
uint8_t now_ccr=__HAL_TIM_GET_COMPARE(&htim1,TIM_CHANNEL_1); uint8_t now_ccr=__HAL_TIM_GET_COMPARE(&htim1,TIM_CHANNEL_1);
__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,NewCCRValue(now_ccr,plus)); __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,NewCCRValue(now_ccr,plus,100));
} }
// if(LED2_ON) // if(LED2_ON)
// { // {
// uint8_t now_ccr=__HAL_TIM_GET_COMPARE(&htim1,TIM_CHANNEL_1); // uint8_t now_ccr=__HAL_TIM_GET_COMPARE(&htim1,TIM_CHANNEL_1);
// __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,NewCCRValue(now_ccr,plus)); // __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,NewCCRValue(now_ccr,plus,100));
// } // }
// if(LED1_ON) // if(LED1_ON)
// { // {
// uint8_t now_ccr=__HAL_TIM_GET_COMPARE(&htim1,TIM_CHANNEL_1); // uint8_t now_ccr=__HAL_TIM_GET_COMPARE(&htim1,TIM_CHANNEL_1);
// __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,NewCCRValue(now_ccr,plus)); // __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,NewCCRValue(now_ccr,plus,100));
// } // }
} }
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{ {
if(GPIO_Pin==PB9_EXTI_Pin) if(GPIO_Pin==PB9_EXTI_Pin)
{ {
if(HAL_GPIO_ReadPin(PB8_EXTI_GPIO_Port,PB8_EXTI_Pin)==RESET) if(HAL_GPIO_ReadPin(PB8_EXTI_GPIO_Port,PB8_EXTI_Pin)==RESET)

View File

@ -169,12 +169,17 @@ void MX_TIM15_Init(void)
Error_Handler(); Error_Handler();
} }
sConfigOC.OCMode = TIM_OCMODE_PWM1; sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 500; sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET; sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET; sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
if (HAL_TIM_PWM_ConfigChannel(&htim15, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
sConfigOC.Pulse = 500;
if (HAL_TIM_PWM_ConfigChannel(&htim15, &sConfigOC, TIM_CHANNEL_2) != HAL_OK) if (HAL_TIM_PWM_ConfigChannel(&htim15, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
{ {
Error_Handler(); Error_Handler();
@ -275,14 +280,15 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
__HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE();
/**TIM15 GPIO Configuration /**TIM15 GPIO Configuration
PB13 ------> TIM15_CH1N
PB15 ------> TIM15_CH2 PB15 ------> TIM15_CH2
*/ */
GPIO_InitStruct.Pin = SERVO_Pin; GPIO_InitStruct.Pin = PWMB_Pin|SERVO_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF14_TIM15; GPIO_InitStruct.Alternate = GPIO_AF14_TIM15;
HAL_GPIO_Init(SERVO_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* USER CODE BEGIN TIM15_MspPostInit 1 */ /* USER CODE BEGIN TIM15_MspPostInit 1 */
@ -338,5 +344,16 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
} }
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
int NewCCRValue(int now_ccr,int plus,int maxvalue)
{
if(now_ccr+plus>maxvalue&&plus>0)
{
return now_ccr;
}
if(now_ccr+plus<0&&plus<0)
{
return now_ccr;
}
return now_ccr+plus;
}
/* USER CODE END 1 */ /* USER CODE END 1 */