Commit 9c89baa5 authored by 957dd's avatar 957dd

加入了编码器读取,没有进行使用

parent c1363e7b
debug/
\ No newline at end of file
This diff is collapsed.
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file dma.h
* @brief This file contains all the function prototypes for
* the dma.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 __DMA_H__
#define __DMA_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* DMA memory to memory transfer handles -------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_DMA_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __DMA_H__ */
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file spi.h
* @brief This file contains all the function prototypes for
* the spi.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 __SPI_H__
#define __SPI_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern SPI_HandleTypeDef hspi3;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_SPI3_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __SPI_H__ */
......@@ -62,7 +62,7 @@
/* #define HAL_SAI_MODULE_ENABLED */
/* #define HAL_SD_MODULE_ENABLED */
/* #define HAL_MMC_MODULE_ENABLED */
/* #define HAL_SPI_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_UART_MODULE_ENABLED
/* #define HAL_USART_MODULE_ENABLED */
......
......@@ -52,6 +52,7 @@ void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void DebugMon_Handler(void);
void DMA1_Stream5_IRQHandler(void);
void USART1_IRQHandler(void);
void USART2_IRQHandler(void);
void TIM7_IRQHandler(void);
......
......@@ -42,6 +42,8 @@ extern TIM_HandleTypeDef htim4;
extern TIM_HandleTypeDef htim5;
extern TIM_HandleTypeDef htim8;
extern TIM_HandleTypeDef htim9;
extern TIM_HandleTypeDef htim12;
......@@ -55,6 +57,7 @@ void MX_TIM2_Init(void);
void MX_TIM3_Init(void);
void MX_TIM4_Init(void);
void MX_TIM5_Init(void);
void MX_TIM8_Init(void);
void MX_TIM9_Init(void);
void MX_TIM12_Init(void);
......
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file dma.c
* @brief This file provides code for the configuration
* of all the requested memory to memory DMA transfers.
******************************************************************************
* @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 */
/* Includes ------------------------------------------------------------------*/
#include "dma.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/*----------------------------------------------------------------------------*/
/* Configure DMA */
/*----------------------------------------------------------------------------*/
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/**
* Enable DMA controller clock
*/
void MX_DMA_Init(void)
{
/* DMA controller clock enable */
__HAL_RCC_DMA1_CLK_ENABLE();
/* DMA interrupt init */
/* DMA1_Stream5_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn);
}
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
......@@ -27,6 +27,8 @@
/* USER CODE BEGIN Includes */
#include "buzz.h"
#include "pwm.h"
#include "encoder.h"
#include "task_manage.h"
/* USER CODE END Includes */
......@@ -119,8 +121,7 @@ void StartDefaultTask(void *argument)
/* Infinite loop */
for(;;)
{
osDelay(2000);
task_1_main();
}
/* USER CODE END StartDefaultTask */
}
......
......@@ -40,8 +40,6 @@
* EXTI
PD8 ------> USART3_TX
PD9 ------> USART3_RX
PB6 ------> I2C1_SCL
PB7 ------> I2C1_SDA
*/
void MX_GPIO_Init(void)
{
......@@ -62,6 +60,9 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_7, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6|GPIO_PIN_7, GPIO_PIN_RESET);
/*Configure GPIO pins : PE2 PE3 PE1 */
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
......@@ -77,12 +78,6 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/*Configure GPIO pin : PC12 */
GPIO_InitStruct.Pin = GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : PD3 PD4 PD7 */
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
......@@ -92,10 +87,9 @@ void MX_GPIO_Init(void)
/*Configure GPIO pins : PB6 PB7 */
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : PE0 */
......
......@@ -21,6 +21,8 @@
#include "cmsis_os.h"
#include "adc.h"
#include "can.h"
#include "dma.h"
#include "spi.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
......@@ -28,9 +30,14 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "usart1.h"
#include "usart2.h" // 确保包含 huart2 定义所在的头文件
#include "buzz.h"
#include "pwm.h"
#include "encode.h"
#include "encoder.h"
#include "led.h"
#include "rgb.h"
#include "mpu6050.h"
#include "servo.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
......@@ -95,6 +102,7 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_CAN1_Init();
MX_ADC1_Init();
MX_USART1_UART_Init();
......@@ -106,15 +114,27 @@ int main(void)
MX_TIM5_Init();
MX_TIM9_Init();
MX_TIM12_Init();
MX_SPI3_Init();
MX_TIM8_Init();
/* USER CODE BEGIN 2 */
RGB_Init();
SERVO_Init_All();
RGB_SetFullColor(255, 0, 0); // 全亮红灯
set_buzz_state(1);
HAL_Delay(1000);
set_buzz_state(0);
set_led3_state(0);
set_led4_state(0);
RGB_SetFullColor(0, 255, 0); // 全亮绿灯
USART1_Config_Init();
USART2_Config_Init();
PWM_Init_All(); // 开启PWM
Encoder_Init_All(); // 开启编码器模式
printf("MPU6050 Software IIC Initializing...\r\n");
// 初始化MPU6050
MPU6050_Init();
Servo_360_Set_Angle(90);
/* USER CODE END 2 */
/* Init scheduler */
......
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file spi.c
* @brief This file provides code for the configuration
* of the SPI instances.
******************************************************************************
* @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 */
/* Includes ------------------------------------------------------------------*/
#include "spi.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
SPI_HandleTypeDef hspi3;
DMA_HandleTypeDef hdma_spi3_tx;
/* SPI3 init function */
void MX_SPI3_Init(void)
{
/* USER CODE BEGIN SPI3_Init 0 */
/* USER CODE END SPI3_Init 0 */
/* USER CODE BEGIN SPI3_Init 1 */
/* USER CODE END SPI3_Init 1 */
hspi3.Instance = SPI3;
hspi3.Init.Mode = SPI_MODE_MASTER;
hspi3.Init.Direction = SPI_DIRECTION_2LINES;
hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi3.Init.CLKPhase = SPI_PHASE_2EDGE;
hspi3.Init.NSS = SPI_NSS_SOFT;
hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi3.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&hspi3) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN SPI3_Init 2 */
/* USER CODE END SPI3_Init 2 */
}
void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(spiHandle->Instance==SPI3)
{
/* USER CODE BEGIN SPI3_MspInit 0 */
/* USER CODE END SPI3_MspInit 0 */
/* SPI3 clock enable */
__HAL_RCC_SPI3_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
/**SPI3 GPIO Configuration
PC10 ------> SPI3_SCK
PC12 ------> SPI3_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/* SPI3 DMA Init */
/* SPI3_TX Init */
hdma_spi3_tx.Instance = DMA1_Stream5;
hdma_spi3_tx.Init.Channel = DMA_CHANNEL_0;
hdma_spi3_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_spi3_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_spi3_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_spi3_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_spi3_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_spi3_tx.Init.Mode = DMA_NORMAL;
hdma_spi3_tx.Init.Priority = DMA_PRIORITY_HIGH;
hdma_spi3_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
if (HAL_DMA_Init(&hdma_spi3_tx) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(spiHandle,hdmatx,hdma_spi3_tx);
/* USER CODE BEGIN SPI3_MspInit 1 */
/* USER CODE END SPI3_MspInit 1 */
}
}
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle)
{
if(spiHandle->Instance==SPI3)
{
/* USER CODE BEGIN SPI3_MspDeInit 0 */
/* USER CODE END SPI3_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_SPI3_CLK_DISABLE();
/**SPI3 GPIO Configuration
PC10 ------> SPI3_SCK
PC12 ------> SPI3_MOSI
*/
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10|GPIO_PIN_12);
/* SPI3 DMA DeInit */
HAL_DMA_DeInit(spiHandle->hdmatx);
/* USER CODE BEGIN SPI3_MspDeInit 1 */
/* USER CODE END SPI3_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
......@@ -55,6 +55,7 @@
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern DMA_HandleTypeDef hdma_spi3_tx;
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
extern TIM_HandleTypeDef htim7;
......@@ -162,6 +163,20 @@ void DebugMon_Handler(void)
/******************************************************************************/
/**
* @brief This function handles DMA1 stream5 global interrupt.
*/
void DMA1_Stream5_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
/* USER CODE END DMA1_Stream5_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_spi3_tx);
/* USER CODE BEGIN DMA1_Stream5_IRQn 1 */
/* USER CODE END DMA1_Stream5_IRQn 1 */
}
/**
* @brief This function handles USART1 global interrupt.
*/
void USART1_IRQHandler(void)
......
......@@ -29,6 +29,7 @@ TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim3;
TIM_HandleTypeDef htim4;
TIM_HandleTypeDef htim5;
TIM_HandleTypeDef htim8;
TIM_HandleTypeDef htim9;
TIM_HandleTypeDef htim12;
......@@ -280,6 +281,78 @@ void MX_TIM5_Init(void)
/* USER CODE END TIM5_Init 2 */
}
/* TIM8 init function */
void MX_TIM8_Init(void)
{
/* USER CODE BEGIN TIM8_Init 0 */
/* USER CODE END TIM8_Init 0 */
TIM_MasterConfigTypeDef sMasterConfig = {0};
TIM_OC_InitTypeDef sConfigOC = {0};
TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0};
/* USER CODE BEGIN TIM8_Init 1 */
/* USER CODE END TIM8_Init 1 */
htim8.Instance = TIM8;
htim8.Init.Prescaler = 167;
htim8.Init.CounterMode = TIM_COUNTERMODE_UP;
htim8.Init.Period = 19999;
htim8.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim8.Init.RepetitionCounter = 0;
htim8.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_PWM_Init(&htim8) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim8, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
{
Error_Handler();
}
sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE;
sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF;
sBreakDeadTimeConfig.DeadTime = 0;
sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE;
sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH;
sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE;
if (HAL_TIMEx_ConfigBreakDeadTime(&htim8, &sBreakDeadTimeConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM8_Init 2 */
/* USER CODE END TIM8_Init 2 */
HAL_TIM_MspPostInit(&htim8);
}
/* TIM9 init function */
void MX_TIM9_Init(void)
{
......@@ -377,6 +450,17 @@ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* tim_pwmHandle)
/* USER CODE END TIM1_MspInit 1 */
}
else if(tim_pwmHandle->Instance==TIM8)
{
/* USER CODE BEGIN TIM8_MspInit 0 */
/* USER CODE END TIM8_MspInit 0 */
/* TIM8 clock enable */
__HAL_RCC_TIM8_CLK_ENABLE();
/* USER CODE BEGIN TIM8_MspInit 1 */
/* USER CODE END TIM8_MspInit 1 */
}
else if(tim_pwmHandle->Instance==TIM9)
{
/* USER CODE BEGIN TIM9_MspInit 0 */
......@@ -537,6 +621,30 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
/* USER CODE END TIM1_MspPostInit 1 */
}
else if(timHandle->Instance==TIM8)
{
/* USER CODE BEGIN TIM8_MspPostInit 0 */
/* USER CODE END TIM8_MspPostInit 0 */
__HAL_RCC_GPIOC_CLK_ENABLE();
/**TIM8 GPIO Configuration
PC6 ------> TIM8_CH1
PC7 ------> TIM8_CH2
PC8 ------> TIM8_CH3
PC9 ------> TIM8_CH4
*/
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF3_TIM8;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/* USER CODE BEGIN TIM8_MspPostInit 1 */
/* USER CODE END TIM8_MspPostInit 1 */
}
else if(timHandle->Instance==TIM9)
{
/* USER CODE BEGIN TIM9_MspPostInit 0 */
......@@ -598,6 +706,17 @@ void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* tim_pwmHandle)
/* USER CODE END TIM1_MspDeInit 1 */
}
else if(tim_pwmHandle->Instance==TIM8)
{
/* USER CODE BEGIN TIM8_MspDeInit 0 */
/* USER CODE END TIM8_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM8_CLK_DISABLE();
/* USER CODE BEGIN TIM8_MspDeInit 1 */
/* USER CODE END TIM8_MspDeInit 1 */
}
else if(tim_pwmHandle->Instance==TIM9)
{
/* USER CODE BEGIN TIM9_MspDeInit 0 */
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "encode.h"
#include "encoder.h"
// 全局结构体数组,对应 4 个电机
Encoder_T g_encoder[MOTOR_COUNT] = {0};
......
#ifndef __ENCODE_H
#define __ENCODE_H
#ifndef __ENCODER_H
#define __ENCODER_H
#include "tim.h"
......
#include "led.h"
void set_led3_state(bool state)
{
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_3,
state ? GPIO_PIN_SET : GPIO_PIN_RESET);
}
void set_led4_state(bool state)
{
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4,
state ? GPIO_PIN_SET : GPIO_PIN_RESET);
}
#ifndef __LED_H__
#define __LED_H__
#include "gpio.h"
#include <stdbool.h>
#include <stdint.h>
void set_led3_state(bool state);
void set_led4_state(bool state);
#endif
#include "rgb.h"
#include "spi.h"
// 定义 0 和 1 的波形特征码(根据你的 SPI 频率可能需要微调)
#define TIM_ZERO 0xC0
#define TIM_ONE 0xF8
// 缓存数组:1个起始0 + PIXEL_NUM*24位数据 + 1个停止0
uint8_t RGB_BYTE_Buffer[PIXEL_NUM * 24 + 2] = {0};
/**
* @brief RGB驱动初始化 (HAL库下,CubeMX已完成大部分初始化)
*/
void RGB_Init(void)
{
// 在 CubeMX 中已经生成了 MX_SPI3_Init(),这里可以留空或做逻辑初始化
for(int i=0; i < sizeof(RGB_BYTE_Buffer); i++) RGB_BYTE_Buffer[i] = 0;
}
/**
* @brief 将数据发送到硬件(DMA方式)
*/
void RGB_Update(void)
{
// 使用 HAL 库的 DMA 发送函数
// 参数:句柄,数据地址,数据长度
HAL_SPI_Transmit_DMA(&hspi3, RGB_BYTE_Buffer, PIXEL_NUM * 24 + 2);
// 原代码中使用 while 等待标志位,在 HAL 中如果需要同步等待可以使用:
// while (HAL_SPI_GetState(&hspi3) != HAL_SPI_STATE_READY);
}
/**
* @brief 全灯设置同一个颜色
*/
void RGB_SetFullColor(uint8_t r, uint8_t g, uint8_t b)
{
uint16_t i, j;
RGB_BYTE_Buffer[0] = 0;
RGB_BYTE_Buffer[PIXEL_NUM * 24 + 1] = 0;
// 填充第一个灯珠的数据 (WS2812 顺序通常是 G-R-B)
for(j = 0; j < 8; j++)
{
RGB_BYTE_Buffer[j + 1] = ((g << j) & 0x80) ? TIM_ONE : TIM_ZERO;
RGB_BYTE_Buffer[j + 1 + 8] = ((r << j) & 0x80) ? TIM_ONE : TIM_ZERO;
RGB_BYTE_Buffer[j + 1 + 16] = ((b << j) & 0x80) ? TIM_ONE : TIM_ZERO;
}
// 复制到其他灯珠
for(i = 1; i < PIXEL_NUM; i++)
{
for(j = 1; j < 25; j++)
{
RGB_BYTE_Buffer[(24 * i) + j] = RGB_BYTE_Buffer[j];
}
}
RGB_Update();
}
/**
* @brief 设置每个灯珠不同的颜色
*/
void RGB_SetPixelColor(uint8_t pixel[PIXEL_NUM][3])
{
uint8_t i, j;
RGB_BYTE_Buffer[0] = 0;
RGB_BYTE_Buffer[PIXEL_NUM * 24 + 1] = 0;
for(i = 0; i < PIXEL_NUM; i++)
{
for(j = 0; j < 8; j++)
{
// pixel[i][0]=R, [i][1]=G, [i][2]=B
RGB_BYTE_Buffer[(i * 24) + j + 1] = ((pixel[i][1] << j) & 0x80) ? TIM_ONE : TIM_ZERO;
RGB_BYTE_Buffer[(i * 24) + j + 1 + 8] = ((pixel[i][0] << j) & 0x80) ? TIM_ONE : TIM_ZERO;
RGB_BYTE_Buffer[(i * 24) + j + 1 + 16] = ((pixel[i][2] << j) & 0x80) ? TIM_ONE : TIM_ZERO;
}
}
RGB_Update();
}
#ifndef __RGB_H
#define __RGB_H
#include "main.h"
#define PIXEL_NUM 8 // 灯珠数量
// 定义颜色结构体
typedef struct {
uint8_t R;
uint8_t G;
uint8_t B;
} RGB_Color_t;
// 定义灯带结构体(可选,方便管理整串灯)
typedef struct {
RGB_Color_t Pixel[PIXEL_NUM];
} RGB_Strip_t;
// 接口函数
void RGB_Init(void);
void RGB_SetFullColor(uint8_t r, uint8_t g, uint8_t b);
void RGB_SetPixelColor(uint8_t pixel[PIXEL_NUM][3]);
#endif
......@@ -22,43 +22,72 @@ void PWM_Set_Duty(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t pulse) {
}
// 假设 duty 范围是 -100 到 100
void motor_left_front(int16_t duty) {
if (duty >= 0) {
PWM_Set_Duty(&htim1, TIM_CHANNEL_1, duty);
PWM_Set_Duty(&htim1, TIM_CHANNEL_2, 0);
void motor_left_front(int16_t speed) {
int16_t temp = speed;
if(temp>4200)
temp = 4200;
if(temp<-4200)
temp = -4200;
if (temp >= 0) {
PWM_Set_Duty(&htim1, TIM_CHANNEL_1, 4200);
PWM_Set_Duty(&htim1, TIM_CHANNEL_2, (4200 - temp));
} else {
PWM_Set_Duty(&htim1, TIM_CHANNEL_1, 0);
PWM_Set_Duty(&htim1, TIM_CHANNEL_2, -duty);
PWM_Set_Duty(&htim1, TIM_CHANNEL_1, (4200 + temp));
PWM_Set_Duty(&htim1, TIM_CHANNEL_2, 4200);
}
}
void motor_right_front(int16_t duty) {
if (duty >= 0) {
PWM_Set_Duty(&htim1, TIM_CHANNEL_3, duty);
PWM_Set_Duty(&htim1, TIM_CHANNEL_4, 0);
void motor_right_front(int16_t speed) {
int16_t temp = speed;
if(temp>4200)
temp = 4200;
if(temp<-4200)
temp = -4200;
if (temp >= 0) {
PWM_Set_Duty(&htim1, TIM_CHANNEL_3, 4200);
PWM_Set_Duty(&htim1, TIM_CHANNEL_4, (4200 - temp));
} else {
PWM_Set_Duty(&htim1, TIM_CHANNEL_3, 0);
PWM_Set_Duty(&htim1, TIM_CHANNEL_4, -duty);
PWM_Set_Duty(&htim1, TIM_CHANNEL_3, (4200 + temp));
PWM_Set_Duty(&htim1, TIM_CHANNEL_4, 4200);
}
}
void motor_left_back(int16_t duty) {
if (duty >= 0) {
PWM_Set_Duty(&htim9, TIM_CHANNEL_1, duty);
PWM_Set_Duty(&htim9, TIM_CHANNEL_2, 0);
void motor_left_back(int16_t speed) {
int16_t temp = speed;
if(temp>4200)
temp = 4200;
if(temp<-4200)
temp = -4200;
if (temp >= 0) {
PWM_Set_Duty(&htim9, TIM_CHANNEL_1, 4200);
PWM_Set_Duty(&htim9, TIM_CHANNEL_2, (4200 - temp));
} else {
PWM_Set_Duty(&htim9, TIM_CHANNEL_1, 0);
PWM_Set_Duty(&htim9, TIM_CHANNEL_2, -duty);
PWM_Set_Duty(&htim9, TIM_CHANNEL_1, (4200 + temp));
PWM_Set_Duty(&htim9, TIM_CHANNEL_2, 4200);
}
}
void motor_right_back(int16_t duty) {
if (duty >= 0) {
PWM_Set_Duty(&htim12, TIM_CHANNEL_1, duty);
PWM_Set_Duty(&htim12, TIM_CHANNEL_2, 0);
void motor_right_back(int16_t speed) {
int16_t temp = speed;
if(temp>4200)
temp = 4200;
if(temp<-4200)
temp = -4200;
if (temp >= 0) {
PWM_Set_Duty(&htim12, TIM_CHANNEL_1, 4200);
PWM_Set_Duty(&htim12, TIM_CHANNEL_2, (4200 - temp));
} else {
PWM_Set_Duty(&htim12, TIM_CHANNEL_1, 0);
PWM_Set_Duty(&htim12, TIM_CHANNEL_2, -duty);
PWM_Set_Duty(&htim12, TIM_CHANNEL_1, (4200 + temp));
PWM_Set_Duty(&htim12, TIM_CHANNEL_2, 4200);
}
}
......
......@@ -3,6 +3,8 @@
#include "tim.h"
void PWM_Set_Duty(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t pulse);
// 启动所有PWM通道
void PWM_Init_All(void);
// 设置PWM占空比 (Compare范围 0-20000)
......
#include "servo.h"
#include "tim.h"
#include "pwm.h"
void SERVO_Init_All(void) {
HAL_TIM_PWM_Start(&htim8, TIM_CHANNEL_1);
// HAL_TIM_PWM_Start(&htim8, TIM_CHANNEL_2);
// HAL_TIM_PWM_Start(&htim8, TIM_CHANNEL_3);
// HAL_TIM_PWM_Start(&htim8, TIM_CHANNEL_4);
}
void Servo_360_Set_Angle(float angle) {
// 1. 角度限幅
if (angle < 0.0f) angle = 0.0f;
if (angle > 270.0f) angle = 270.0f;
/* 2. 角度映射到脉宽
* 标准舵机协议:
* 0° -> 0.5ms (500us)
* 360° -> 2.5ms (2500us)
* 计算公式:Pulse = 500 + (angle / 360.0) * (2500 - 500)
*/
uint32_t pulse = (uint32_t)(500.0f + (angle * 2000.0f / 360.0f));
// 3. 设置 PWM
PWM_Set_Duty(&htim8,TIM_CHANNEL_1,pulse);
}
#ifndef __SERVO_H
#define __SERVO_H
void SERVO_Init_All(void);
void Servo_360_Set_Angle(float angle);
#endif
#include "vin.h"
#include "adc.h"
#include "usart2.h" // 确保包含 huart2 定义所在的头文件
#include "usart1.h"
#include <string.h>
/**
* @brief 读取 ADC 值并转换为电压
* @return float 电压值 (0.0V - 3.3V)
*/
float Get_ADC_Voltage(void)
{
uint32_t adc_value = 0;
float voltage = 0.0;
// 1. 启动 ADC 转换
HAL_ADC_Start(&hadc1);
// 2. 等待转换完成 (超时时间设为 10ms)
if (HAL_ADC_PollForConversion(&hadc1, 10) == HAL_OK)
{
// 3. 读取 12 位的数字值 (0 - 4095)
adc_value = HAL_ADC_GetValue(&hadc1);
// 4. 转换为电压值
// 公式:电压 = (读取值 / 最大值) * 参考电压
// 12位 ADC 最大值是 2^12 - 1 = 4095
// STM32 标准参考电压通常是 3.3V
voltage = (float)adc_value * 3.3f / 4095.0f;
}
// 5. 停止 ADC (单次模式下可选,但建议养成习惯)
HAL_ADC_Stop(&hadc1);
return voltage;
}
float Get_Vin_Voltage(void)
{
float voltage = 11.0f * Get_ADC_Voltage();
return (float)((int)(voltage * 100.0f + 0.5f))/100.0f;
}
void USART_Send_Voltage(void)
{
uint8_t frame[8];
// 1. 将电压放大100倍转换为整数
// +0.5f 是为了四舍五入,防止浮点数精度误差(如 12.34 变成 12.33999)
uint32_t v_int = (uint32_t)(Get_Vin_Voltage() * 100.0f + 0.5f);
// 限制最大值,防止输入超出 99.99 (可选)
if (v_int > 999999) v_int = 999999; // 3字节理论最大值远超99.99
frame[0] = 0x01; // 帧头
frame[1] = 0xFF; // mode 固定为 FF
frame[2] = 0xFF; // value 固定为 FF
// 2. 将数据填入 3 个预留位 (大端模式:高位在前)
// 例如 v_int = 9999 (0x00270F)
frame[3] = 0x01; // 高位 (0x00)
frame[4] = (uint8_t)((v_int >> 8) & 0xFF); // 中位 (0x27)
frame[5] = (uint8_t)(v_int & 0xFF); // 低位 (0x0F)
// 3. 生成和校验 (Sum Check)
// 校验位 = frame[1] + frame[2] + frame[3] + frame[4] + frame[5]
uint8_t checksum = 0;
for(int i = 1; i <= 5; i++)
{
checksum += frame[i];
}
frame[6] = checksum;
frame[7] = 0xFF; // 停止位
// 4. 阻塞式发送 8 字节二进制数据
HAL_UART_Transmit(&huart2, frame, 8, 100);
}
#ifndef __VIN_H__
#define __VIN_H__
float Get_Vin_Voltage(void);
void USART_Send_Voltage(void);
#endif
#include"eeprom.h"
#include "delay.h"
#ifndef __EEPROM_H
#define __EEPROM_H
#endif
\ No newline at end of file
#include "mpu6050.h"
#include <stdio.h>
#include "delay.h"
// --- IO模式切换宏 (针对STM32F407, PB7引脚) ---
// F4的MODER寄存器每2位控制一个IO口,Pin7对应14-15位
#define SDA_IN() {GPIOB->MODER &= ~(3 << (7 * 2)); GPIOB->MODER |= (0 << (7 * 2));}
#define SDA_OUT() {GPIOB->MODER &= ~(3 << (7 * 2)); GPIOB->MODER |= (1 << (7 * 2));}
// --- IO电平控制宏 ---
#define IIC_SCL(n) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, n ? GPIO_PIN_SET : GPIO_PIN_RESET)
#define IIC_SDA(n) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, n ? GPIO_PIN_SET : GPIO_PIN_RESET)
#define READ_SDA HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7)
// --- 内部底层协议函数 ---
static void IIC_Start(void) {
SDA_OUT();
IIC_SDA(1);
IIC_SCL(1);
delay_us(4);
IIC_SDA(0);
delay_us(4);
IIC_SCL(0);
}
static void IIC_Stop(void) {
SDA_OUT();
IIC_SCL(0);
IIC_SDA(0);
delay_us(4);
IIC_SCL(1);
IIC_SDA(1);
delay_us(4);
}
static uint8_t IIC_Wait_Ack(void) {
uint8_t retry = 0;
SDA_IN();
IIC_SDA(1); delay_us(1);
IIC_SCL(1); delay_us(1);
while (READ_SDA) {
retry++;
if (retry > 250) { IIC_Stop(); return 1; }
}
IIC_SCL(0);
return 0;
}
static void IIC_Ack(void) {
IIC_SCL(0); SDA_OUT();
IIC_SDA(0); delay_us(2);
IIC_SCL(1); delay_us(2);
IIC_SCL(0);
}
static void IIC_NAck(void) {
IIC_SCL(0); SDA_OUT();
IIC_SDA(1); delay_us(2);
IIC_SCL(1); delay_us(2);
IIC_SCL(0);
}
static void IIC_Send_Byte(uint8_t data) {
SDA_OUT();
IIC_SCL(0);
for (uint8_t i = 0; i < 8; i++) {
IIC_SDA((data & 0x80) >> 7);
data <<= 1;
delay_us(2);
IIC_SCL(1); delay_us(2);
IIC_SCL(0); delay_us(2);
}
}
static uint8_t IIC_Read_Byte(uint8_t ack) {
uint8_t receive = 0;
SDA_IN();
for (uint8_t i = 0; i < 8; i++) {
IIC_SCL(0); delay_us(2);
IIC_SCL(1);
receive <<= 1;
if (READ_SDA) receive++;
delay_us(1);
}
if (ack) IIC_Ack(); else IIC_NAck();
return receive;
}
// --- 寄存器读写包装 ---
static void MPU6050_WriteRegister(uint8_t reg, uint8_t data) {
IIC_Start();
IIC_Send_Byte(MPU6050_ADDR << 1);
IIC_Wait_Ack();
IIC_Send_Byte(reg);
IIC_Wait_Ack();
IIC_Send_Byte(data);
IIC_Wait_Ack();
IIC_Stop();
}
static void MPU6050_ReadRegister(uint8_t reg, uint8_t *pdata, uint16_t len) {
IIC_Start();
IIC_Send_Byte(MPU6050_ADDR << 1);
IIC_Wait_Ack();
IIC_Send_Byte(reg);
IIC_Wait_Ack();
IIC_Start();
IIC_Send_Byte((MPU6050_ADDR << 1) | 0x01);
IIC_Wait_Ack();
while (len) {
if (len == 1) *pdata = IIC_Read_Byte(0);
else *pdata = IIC_Read_Byte(1);
pdata++; len--;
}
IIC_Stop();
}
// --- MPU6050应用接口 ---
/**
* @brief MPU6050初始化
*/
void MPU6050_Init(void) {
// 引脚初始化在MX_GPIO_Init中完成,或者手动配置PB6/PB7为推挽输出
IIC_SCL(1);
IIC_SDA(1);
MPU6050_WriteRegister(MPU6050_PWR_MGMT_1, 0x80); // 复位
HAL_Delay(100); // 100ms
MPU6050_WriteRegister(MPU6050_PWR_MGMT_1, 0x00); // 唤醒
MPU6050_SetGyroRange(GYRO_RANGE_2000);
MPU6050_SetAccRange(ACC_RANGE_2G);
MPU6050_WriteRegister(MPU6050_PWR_MGMT_1, 0x01); // 时钟源PLL
}
void MPU6050_SetAccRange(uint8_t range) {
MPU6050_WriteRegister(MPU6050_ACCEL_CONFIG, range << 3);
}
void MPU6050_SetGyroRange(uint8_t range) {
MPU6050_WriteRegister(MPU6050_GYRO_CONFIG, range << 3);
}
void MPU6050_GetAccData(int16_t *pbuf) {
uint8_t buf[6];
MPU6050_ReadRegister(MPU6050_ACCEL_XOUT_H, buf, 6);
pbuf[0] = (buf[0] << 8) | buf[1];
pbuf[1] = (buf[2] << 8) | buf[3];
pbuf[2] = (buf[4] << 8) | buf[5];
}
void MPU6050_GetGyroData(int16_t *pbuf) {
uint8_t buf[6];
MPU6050_ReadRegister(MPU6050_GYRO_XOUT_H, buf, 6);
pbuf[0] = (buf[0] << 8) | buf[1];
pbuf[1] = (buf[2] << 8) | buf[3];
pbuf[2] = (buf[4] << 8) | buf[5];
}
float MPU6050_GetTempValue(void) {
uint8_t buf[2];
MPU6050_ReadRegister(MPU6050_TEMP_OUT_H, buf, 2);
int16_t tmp = (buf[0] << 8) | buf[1];
return (float)(36.53f + ((double)tmp / 340.0f));
}
#ifndef __AX_MPU6050_H
#define __AX_MPU6050_H
#include "main.h" // 包含HAL库相关定义
#define MPU6050_ADDR 0x68 // MPU6050器件地址
// MPU6050寄存器地址定义
#define MPU6050_SMPLRT_DIV 0x19
#define MPU6050_CONFIG 0x1A
#define MPU6050_GYRO_CONFIG 0x1B
#define MPU6050_ACCEL_CONFIG 0x1C
#define MPU6050_INT_ENABLE 0x38
#define MPU6050_ACCEL_XOUT_H 0x3B
#define MPU6050_TEMP_OUT_H 0x41
#define MPU6050_GYRO_XOUT_H 0x43
#define MPU6050_PWR_MGMT_1 0x6B
#define MPU6050_PWR_MGMT_2 0x6C
#define MPU6050_WHO_AM_I 0x75
// 范围定义
#define ACC_RANGE_2G 0
#define GYRO_RANGE_2000 3
// 函数声明 (保持原有命名)
void MPU6050_Init(void);
void MPU6050_GetAccData(int16_t *pbuf);
void MPU6050_GetGyroData(int16_t *pbuf);
float MPU6050_GetTempValue(void);
void MPU6050_SetAccRange(uint8_t range);
void MPU6050_SetGyroRange(uint8_t range);
#endif
#include "delay.h"
/**
* @brief NOP 延时因子
* @note 针对 STM32F407 @ 168MHz 且关闭编译优化时的粗略估算。
* 如果延时太快导致 IIC 通讯失败,请调大此值。
*/
#define US_FACTOR 45
/**
* @brief 微秒级主动等待
* @note 使用 volatile 确保循环不被编译器优化掉
*/
void delay_us(uint32_t us)
{
// 计算总循环次数
// 168MHz 下,执行一圈循环约需要几个指令周期
volatile uint32_t count = us * US_FACTOR;
while(count--)
{
__nop();
}
}
/**
* @brief 毫秒级延时
*/
void delay_ms(uint32_t ms)
{
// 如果 FreeRTOS 调度器已经运行,则使用 vTaskDelay 释放 CPU
#if defined(INC_TASK_H)
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
{
vTaskDelay(pdMS_TO_TICKS(ms));
return;
}
#endif
// 调度器未运行,或未定义 FreeRTOS 时使用阻塞延时
while(ms--)
{
delay_us(1000);
}
}
#ifndef __DELAY_H
#define __DELAY_H
#include "main.h"
void delay_us(uint32_t us);
void delay_ms(uint32_t ms);
#endif
......@@ -2,15 +2,13 @@
#include "buzz.h"
#include "pwm.h"
uint8_t RxBuffer[RX_BUF_SIZE]; // 接收缓冲区
/**
* @brief 启动串口接收
*/
void USART1_Config_Init(void)
{
/* 使用扩展接收函数:接收到 RX_BUF_SIZE 个字节,或者遇到空闲中断时停止并回调 */
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxBuffer, RX_BUF_SIZE);
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxBuffer1, RX_BUF_SIZE);
printf("USART1 Multi-Byte Mode Ready.\r\n");
}
......@@ -30,23 +28,6 @@ int fputc(int ch, FILE *f) {
#endif
/**
* @brief 这是处理变长数据的关键回调函数
* @param huart: 串口句柄
* @param Size: 实际接收到的字节数
*/
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if (huart->Instance == USART1)
{
// 1. 处理接收到的一包数据
USART1_Process_Packet(RxBuffer, Size);
// 2. 接收完成后,必须再次开启监听
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxBuffer, RX_BUF_SIZE);
}
}
/**
* @brief 业务逻辑:解析数据包
* @param pData: 指向接收缓冲区的指针
* @param Size: 接收到的有效数据长度
......@@ -54,39 +35,20 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
void USART1_Process_Packet(uint8_t *pData, uint16_t Size)
{
// 基础长度检查
if (len < 8) return;
if (Size < 8) return;
for (int i = 0; i <= len - 8; i++) {
for (int i = 0; i <= Size - 8; i++) {
// 1. 检查帧头和帧尾
if (buf[i] == 0x01 && buf[i+7] == 0xFF) {
if (pData[i] == 0x01 && pData[i+7] == 0xFF) {
uint8_t r_mode = buf[i+1];
uint8_t r_value = buf[i+2];
uint8_t r_check = buf[i+6];
uint8_t r_mode = pData[i+1];
uint8_t r_value = pData[i+2];
pwm_control_territory(r_mode, r_value);
// 2. 计算校验和
uint8_t cal_check = (buf[i+1] + buf[i+2] + buf[i+3] + buf[i+4] + buf[i+5]) & 0xFF;
// 3. 校验比对
if (cal_check == r_check) {
// 校验通过,执行控制指令
pwm_control_territory(r_mode, r_value);
return; // 处理完一帧就退出
} else {
// 校验失败,可能是干扰
printf("Check Error!\n");
}
}
}
}
/**
* @brief 如果发生错误(如溢出),在此重启接收
*/
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
{
if (huart->Instance == USART1)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxBuffer, RX_BUF_SIZE);
}
}
#include "usart.h" // 确保包含 huart2 定义所在的头文件
#include "usart2.h" // 确保包含 huart2 定义所在的头文件
#include "pwm.h"
#include <string.h>
// 接收缓冲区
uint8_t RxBuffer[RX_BUF_SIZE];
/**
* @brief 启动串口2接收(初始化调用)
*/
void USART2_Config_Init(void)
{
/* 使用扩展接收函数:接收到 RX_BUF_SIZE 个字节,或者遇到空闲中断时停止并回调 */
HAL_UARTEx_ReceiveToIdle_IT(&huart2, RxBuffer, RX_BUF_SIZE);
HAL_UARTEx_ReceiveToIdle_IT(&huart2, RxBuffer2, RX_BUF_SIZE);
}
/**
......@@ -38,22 +35,6 @@ void USART2_Send_Command(uint8_t mode, uint8_t value)
HAL_UART_Transmit(&huart2, frame, 8, 100);
}
/**
* @brief 串口接收回调函数 (处理串口空闲中断)
* @param huart: 串口句柄
* @param Size: 实际接收到的字节数
*/
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if (huart->Instance == USART2)
{
// 1. 处理接收到的二进制数据包
USART2_Process_Packet(RxBuffer, Size);
// 2. 必须再次开启监听,以便下一次接收
HAL_UARTEx_ReceiveToIdle_IT(&huart2, RxBuffer, RX_BUF_SIZE);
}
}
/**
* @brief 解析 8 字节协议帧
......@@ -73,7 +54,7 @@ void USART2_Process_Packet(uint8_t *pData, uint16_t Size)
{
uint8_t r_mode = pData[i+1];
uint8_t r_value = pData[i+2];
uint8_t r_check = pData[i+6];
uint8_t r_check = pData[i+6];
// 2. 计算接收到的数据位和校验
uint8_t cal_check = (uint8_t)((pData[i+1] + pData[i+2] + pData[i+3] + pData[i+4] + pData[i+5]) & 0xFF);
......@@ -91,13 +72,4 @@ void USART2_Process_Packet(uint8_t *pData, uint16_t Size)
}
}
/**
* @brief 错误回调,防止串口因为溢出等错误停止接收
*/
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
{
if (huart->Instance == USART2)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart2, RxBuffer, RX_BUF_SIZE);
}
}
\ No newline at end of file
#ifndef __USART1_H
#define __USART1_H
#ifndef __USART2_H
#define __USART2_H
#include "main.h"
#include <stdio.h>
......@@ -11,5 +11,6 @@
/* 函数声明 */
void USART2_Config_Init(void);
void USART2_Process_Packet(uint8_t *pData, uint16_t Size);
void USART2_Send_Command(uint8_t mode, uint8_t value);
#endif
#include "usart_config.h"
uint8_t RxBuffer1[RX_BUF_SIZE]; // 接收缓冲区
// 接收缓冲区
uint8_t RxBuffer2[RX_BUF_SIZE];
/**
* @brief 这是处理变长数据的关键回调函数
* @param huart: 串口句柄
* @param Size: 实际接收到的字节数
*/
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if (huart->Instance == USART1)
{
// 1. 处理接收到的一包数据
USART1_Process_Packet(RxBuffer1, Size);
// 2. 接收完成后,必须再次开启监听
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxBuffer1, RX_BUF_SIZE);
}
if (huart->Instance == USART2)
{
// 1. 处理接收到的二进制数据包
USART2_Process_Packet(RxBuffer2, Size);
// 2. 必须再次开启监听,以便下一次接收
HAL_UARTEx_ReceiveToIdle_IT(&huart2, RxBuffer2, RX_BUF_SIZE);
}
}
/**
* @brief 如果发生错误(如溢出),在此重启接收
*/
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
{
if (huart->Instance == USART1)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxBuffer1, RX_BUF_SIZE);
}
if (huart->Instance == USART2)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart2, RxBuffer2, RX_BUF_SIZE);
}
}
#ifndef __USART_CONFIG_H
#define __USART_CONFIG_H
#include <stdio.h>
#include <string.h>
#include "main.h"
/* 定义最大接收字节数 */
#define RX_BUF_SIZE 256
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
#endif
\ No newline at end of file
// 告诉编译器,这两个函数在别的地方定义了,放心去用
extern void USART1_Process_Packet(uint8_t *data, uint16_t size);
extern void USART2_Process_Packet(uint8_t *data, uint16_t size);
extern uint8_t RxBuffer1[];
extern uint8_t RxBuffer2[];
#endif
#include "task_manage.h"
#include "encoder.h"
#include "pwm.h"
#include "led.h"
#include "rgb.h"
#include "buzz.h"
#include "usart1.h"
#include "usart2.h"
#include "vin.h"
#include "mpu6050.h"
#include "servo.h"
int16_t acc[3], gyro[3];
float temperature;
float angle=90;
void task_1_main(void) {
Encoder_Update_All();
printf("M0: %ld (%d) | M1: %ld (%d) | M2: %ld (%d) | M3: %ld (%d)\r\n",
g_encoder[0].total_count, g_encoder[0].speed,
g_encoder[1].total_count, g_encoder[1].speed,
g_encoder[2].total_count, g_encoder[2].speed,
g_encoder[3].total_count, g_encoder[3].speed);
printf("VIN: %fV\r\n",Get_Vin_Voltage());
MPU6050_GetAccData(acc);
printf("acceleration: X=%d, Y=%d, Z=%d\r\n", acc[0], acc[1], acc[2]);
MPU6050_GetGyroData(gyro);
printf("gyroscope: X=%d, Y=%d, Z=%d\r\n", gyro[0], gyro[1], gyro[2]);
temperature = MPU6050_GetTempValue();
printf("temperature: %.2f\r\n", temperature);
angle+=30;
if(360<angle)angle=20;
Servo_360_Set_Angle(angle);
osDelay(2000); // 100ms读取一次
}
#ifndef __MANAGE_H
#define __MANAGE_H
#include "main.h"
#include "FreeRTOS.h"
#include "task.h"
#include "cmsis_os.h"
void task_1_main(void);
#endif
No preview for this file type
......@@ -33,6 +33,7 @@
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
No preview for this file type
..\debug\buzz.o: ..\Hardware\Buzz\buzz.c
..\debug\buzz.o: ..\Hardware\Buzz\buzz.h
..\debug\buzz.o: ..\User\Hardware\Buzz\buzz.c
..\debug\buzz.o: ..\User\Hardware\Buzz\buzz.h
..\debug\buzz.o: ../Core/Inc/gpio.h
..\debug\buzz.o: ../Core/Inc/main.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h
......@@ -34,6 +34,7 @@
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\buzz.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
......
No preview for this file type
No preview for this file type
......@@ -33,6 +33,7 @@
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\can.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
No preview for this file type
......@@ -48,6 +48,7 @@
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\cmsis_os2.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
No preview for this file type
No preview for this file type
..\debug\encode.o: ..\Hardware\Encode\encode.c
..\debug\encode.o: ..\Hardware\Encode\encode.h
..\debug\encode.o: ../Core/Inc/tim.h
..\debug\encode.o: ../Core/Inc/main.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h
..\debug\encode.o: ../Core/Inc/stm32f4xx_hal_conf.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h
..\debug\encode.o: ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
..\debug\encode.o: ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h
..\debug\encode.o: ../Drivers/CMSIS/Include/core_cm4.h
..\debug\encode.o: D:\keil\ARM\ARMCC\Bin\..\include\stdint.h
..\debug\encode.o: ../Drivers/CMSIS/Include/cmsis_version.h
..\debug\encode.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
..\debug\encode.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
..\debug\encode.o: ../Drivers/CMSIS/Include/mpu_armv7.h
..\debug\encode.o: ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
..\debug\encode.o: D:\keil\ARM\ARMCC\Bin\..\include\stddef.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_adc.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\encode.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
No preview for this file type
......@@ -41,13 +41,16 @@
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\freertos.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
..\debug\freertos.o: ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h
..\debug\freertos.o: ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h
..\debug\freertos.o: ../Hardware/Buzz/buzz.h
..\debug\freertos.o: ../User/Hardware/Buzz/buzz.h
..\debug\freertos.o: ../Core/Inc/gpio.h
..\debug\freertos.o: D:\keil\ARM\ARMCC\Bin\..\include\stdbool.h
..\debug\freertos.o: ../Hardware/Pwm/pwm.h
..\debug\freertos.o: ../User/Hardware/Pwm/pwm.h
..\debug\freertos.o: ../Core/Inc/tim.h
..\debug\freertos.o: ../User/Hardware/Encoder/encoder.h
..\debug\freertos.o: ../User/Tasks/task_manage.h
No preview for this file type
No preview for this file type
......@@ -33,6 +33,7 @@
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\gpio.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -22,17 +22,14 @@ Dialog DLL: TCM.DLL V1.56.4.0
<h2>Project:</h2>
C:\Users\17122\Desktop\״ʦԻ\H60\project\MDK-ARM\project.uvprojx
Project File Date: 12/23/2025
Project File Date: 12/26/2025
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
Build target 'project'
compiling pwm.c...
compiling usart1.c...
compiling main.c...
compiling freertos.c...
compiling servo.c...
linking...
Program Size: Code=18116 RO-data=496 RW-data=152 ZI-data=20792
Program Size: Code=26468 RO-data=504 RW-data=172 ZI-data=21500
FromELF: creating hex file...
"..\debug\main.axf" - 0 Error(s), 0 Warning(s).
......
No preview for this file type
......@@ -32,6 +32,7 @@
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\main.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
......@@ -48,13 +49,21 @@
..\debug\main.o: ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h
..\debug\main.o: ../Core/Inc/adc.h
..\debug\main.o: ../Core/Inc/can.h
..\debug\main.o: ../Core/Inc/dma.h
..\debug\main.o: ../Core/Inc/spi.h
..\debug\main.o: ../Core/Inc/tim.h
..\debug\main.o: ../Core/Inc/usart.h
..\debug\main.o: ../Core/Inc/gpio.h
..\debug\main.o: ../System/usart/usart1.h
..\debug\main.o: ../User/System/usart/usart1.h
..\debug\main.o: D:\keil\ARM\ARMCC\Bin\..\include\stdio.h
..\debug\main.o: D:\keil\ARM\ARMCC\Bin\..\include\string.h
..\debug\main.o: ../Hardware/Buzz/buzz.h
..\debug\main.o: ../User/System/usart/usart_config.h
..\debug\main.o: ../User/System/usart/usart2.h
..\debug\main.o: ../User/Hardware/Buzz/buzz.h
..\debug\main.o: D:\keil\ARM\ARMCC\Bin\..\include\stdbool.h
..\debug\main.o: ../Hardware/Pwm/pwm.h
..\debug\main.o: ../Hardware/Encode/encode.h
..\debug\main.o: ../User/Hardware/Pwm/pwm.h
..\debug\main.o: ../User/Hardware/Encoder/encoder.h
..\debug\main.o: ../User/Hardware/Led/led.h
..\debug\main.o: ../User/Hardware/Led/rgb.h
..\debug\main.o: ../User/Hardware/mpu6050/mpu6050.h
..\debug\main.o: ../User/Hardware/Pwm/servo.h
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,6 +5,8 @@
"..\debug\freertos.o"
"..\debug\adc.o"
"..\debug\can.o"
"..\debug\dma.o"
"..\debug\spi.o"
"..\debug\tim.o"
"..\debug\usart.o"
"..\debug\stm32f4xx_it.o"
......@@ -29,6 +31,7 @@
"..\debug\stm32f4xx_hal.o"
"..\debug\stm32f4xx_hal_exti.o"
"..\debug\stm32f4xx_hal_can.o"
"..\debug\stm32f4xx_hal_spi.o"
"..\debug\stm32f4xx_hal_uart.o"
"..\debug\system_stm32f4xx.o"
"..\debug\croutine.o"
......@@ -42,9 +45,18 @@
"..\debug\heap_4.o"
"..\debug\port.o"
"..\debug\buzz.o"
"..\debug\encode.o"
"..\debug\led.o"
"..\debug\pwm.o"
"..\debug\vin.o"
"..\debug\encoder.o"
"..\debug\rgb.o"
"..\debug\mpu6050.o"
"..\debug\servo.o"
"..\debug\usart_config.o"
"..\debug\usart1.o"
"..\debug\usart2.o"
"..\debug\delay.o"
"..\debug\task_manage.o"
--library_type=microlib --strict --scatter "..\debug\main.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers
......
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
..\debug\pwm.o: ..\Hardware\Pwm\pwm.c
..\debug\pwm.o: ..\Hardware\Pwm\pwm.h
..\debug\pwm.o: ..\User\Hardware\Pwm\pwm.c
..\debug\pwm.o: ..\User\Hardware\Pwm\pwm.h
..\debug\pwm.o: ../Core/Inc/tim.h
..\debug\pwm.o: ../Core/Inc/main.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h
......@@ -34,6 +34,7 @@
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\pwm.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -31,6 +31,7 @@
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\stm32f4xx_hal.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
No preview for this file type
......@@ -31,6 +31,7 @@
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\stm32f4xx_hal_adc.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
......@@ -31,6 +31,7 @@
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
..\debug\stm32f4xx_hal_adc_ex.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment