加入Buzzer,Shake_Motor,Ultrasound

This commit is contained in:
2025-06-24 20:46:30 +08:00
parent 5cc35cbad3
commit 20d90d8933
50 changed files with 12844 additions and 4561 deletions

View File

@@ -30,12 +30,13 @@ extern "C" {
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "headfile.h"
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
//extern MotorCommand current_motor_cmd;
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
@@ -46,7 +47,17 @@ extern "C" {
/* Private defines -----------------------------------------------------------*/
/* USER CODE BEGIN PD */
// <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>define
#define EVENT_OBSTACLE_DETECTED 0x01
#define EVENT_GPS_DATA_READY 0x02
#define EVENT_BLE_COMMAND_RECEIVED 0x04
#define IMU_UPDATE_EVENT 0x08
#define EVENT_LOCATION_UPDATED 0x10
// <20><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD>ȥ 0x20 ?
extern TX_QUEUE ble_tx_queue;
extern TX_EVENT_FLAGS_GROUP system_events;
extern MotorCommand current_motor_cmd;
/* USER CODE END PD */
/* Main thread defines -------------------------------------------------------*/

View File

@@ -57,6 +57,14 @@ void Error_Handler(void);
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define HC_Trig_Pin GPIO_PIN_0
#define HC_Trig_GPIO_Port GPIOA
#define HC_Echo_Pin GPIO_PIN_1
#define HC_Echo_GPIO_Port GPIOA
#define Shake_Motor_Pin GPIO_PIN_4
#define Shake_Motor_GPIO_Port GPIOD
#define Buzzer_Pin GPIO_PIN_5
#define Buzzer_GPIO_Port GPIOD
/* USER CODE BEGIN Private defines */

View File

@@ -56,8 +56,10 @@ void GPDMA1_Channel3_IRQHandler(void);
void GPDMA1_Channel4_IRQHandler(void);
void GPDMA1_Channel5_IRQHandler(void);
void TIM1_UP_IRQHandler(void);
void TIM2_IRQHandler(void);
void USART1_IRQHandler(void);
void USART2_IRQHandler(void);
void UART5_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */

52
Core/Inc/tim.h Normal file
View File

@@ -0,0 +1,52 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.h
* @brief This file contains all the function prototypes for
* the tim.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __TIM_H__
#define __TIM_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern TIM_HandleTypeDef htim2;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_TIM2_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __TIM_H__ */

View File

@@ -32,6 +32,8 @@ extern "C" {
/* USER CODE END Includes */
extern UART_HandleTypeDef huart5;
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
@@ -40,6 +42,7 @@ extern UART_HandleTypeDef huart2;
/* USER CODE END Private defines */
void MX_UART5_Init(void);
void MX_USART1_UART_Init(void);
void MX_USART2_UART_Init(void);