同步最新代码
This commit is contained in:
17
底盘独立控制器/code/User/Parameter.h
Normal file
17
底盘独立控制器/code/User/Parameter.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef __PARAMETER_H
|
||||
#define __PARAMETER_H
|
||||
|
||||
/*=============================================结构参数=============================================*/
|
||||
#define Yaw_GM6020PositionValue 4050//Yaw轴编码器值
|
||||
|
||||
/*=============================================麦轮参数=============================================*/
|
||||
#define Mecanum_WheelRadius 7.0f//麦轮半径(单位cm)
|
||||
|
||||
#define Mecanum_rx 18.75f//底盘中心到轮子中心的距离的x轴分量(单位cm)
|
||||
#define Mecanum_ry 18.0f//底盘中心到轮子中心的距离的y轴分量(单位cm)
|
||||
|
||||
#define Mecanum_LeverSpeedMapRate (1.2f/660.0f)//拨杆速度映射比例
|
||||
#define Mecanum_GyroScopeAngularVelocity 5.0f//小陀螺角速度
|
||||
#define Mecanum_NormalSpeedRate 1.5f//底盘正常速度和超功率速度的比值
|
||||
|
||||
#endif
|
||||
36
底盘独立控制器/code/User/RM_C.h
Normal file
36
底盘独立控制器/code/User/RM_C.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef __RM_C_H
|
||||
#define __RM_C_H
|
||||
|
||||
/*==========延时==========*/
|
||||
#include "Delay.h" //延时
|
||||
|
||||
/*==========硬件驱动==========*/
|
||||
#include "TIM.h" //定时器
|
||||
#include "LED.h" //LED
|
||||
#include "Buzzer.h" //蜂鸣器
|
||||
#include "Remote.h" //遥控器
|
||||
#include "M3508.h" //M3508
|
||||
#include "GM6020.h" //GM6020
|
||||
|
||||
/*==========通讯协议==========*/
|
||||
#include "UART.h" //串口
|
||||
#include "CAN.h" //CAN
|
||||
|
||||
/*==========控制算法==========*/
|
||||
#include "PID.h" //PID
|
||||
|
||||
/*==========功能==========*/
|
||||
#include "LinkCheck.h" //CAN连接检测
|
||||
#include "CloseLoopControl.h" //闭环控制
|
||||
|
||||
#include "Warming.h" //报警
|
||||
|
||||
/*==========车体==========*/
|
||||
#include "Parameter.h" //参数
|
||||
#include "Mecanum.h" //底盘
|
||||
#include "RefereeSystem.h" //裁判系统
|
||||
#include "RefereeSystem_CRCTable.h" //裁判系统CRC数组
|
||||
#include "Ultra_CAP.h" //超电
|
||||
#include "UI.h" //UI
|
||||
|
||||
#endif
|
||||
20
底盘独立控制器/code/User/main.c
Normal file
20
底盘独立控制器/code/User/main.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "stm32f4xx.h" // Device header
|
||||
#include "stm32f4xx_conf.h"
|
||||
#include <stdio.h>
|
||||
#include "RM_C.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
Warming_Init();//报警初始化
|
||||
LED_BON();//蓝灯点亮表示代码在运行
|
||||
Delay_s(2);//延时,等待校准和模块启动
|
||||
RefereeSystem_Init();//裁判系统数据接收初始化
|
||||
LinkCheck_Init();//连接检测初始化
|
||||
Ultra_CAP_Init();//超电初始化
|
||||
CloseLoopControl_Init();//闭环控制初始化
|
||||
while(1)
|
||||
{
|
||||
|
||||
Delay_us(2000);
|
||||
}
|
||||
}
|
||||
164
底盘独立控制器/code/User/stm32f4xx_conf.h
Normal file
164
底盘独立控制器/code/User/stm32f4xx_conf.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_conf.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.8.1
|
||||
* @date 27-January-2022
|
||||
* @brief Library configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F4xx_CONF_H
|
||||
#define __STM32F4xx_CONF_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Uncomment the line below to enable peripheral header file inclusion */
|
||||
#include "stm32f4xx_adc.h"
|
||||
#include "stm32f4xx_crc.h"
|
||||
#include "stm32f4xx_dbgmcu.h"
|
||||
#include "stm32f4xx_dma.h"
|
||||
#include "stm32f4xx_exti.h"
|
||||
#include "stm32f4xx_flash.h"
|
||||
#include "stm32f4xx_gpio.h"
|
||||
#include "stm32f4xx_i2c.h"
|
||||
#include "stm32f4xx_iwdg.h"
|
||||
#include "stm32f4xx_pwr.h"
|
||||
#include "stm32f4xx_rcc.h"
|
||||
#include "stm32f4xx_rtc.h"
|
||||
#include "stm32f4xx_sdio.h"
|
||||
#include "stm32f4xx_spi.h"
|
||||
#include "stm32f4xx_syscfg.h"
|
||||
#include "stm32f4xx_tim.h"
|
||||
#include "stm32f4xx_usart.h"
|
||||
#include "stm32f4xx_wwdg.h"
|
||||
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
|
||||
|
||||
#if defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
|
||||
#include "stm32f4xx_cryp.h"
|
||||
#include "stm32f4xx_hash.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_can.h"
|
||||
#include "stm32f4xx_dac.h"
|
||||
#include "stm32f4xx_dcmi.h"
|
||||
#include "stm32f4xx_dma2d.h"
|
||||
#include "stm32f4xx_fmc.h"
|
||||
#include "stm32f4xx_ltdc.h"
|
||||
#include "stm32f4xx_sai.h"
|
||||
#endif /* STM32F429_439xx || STM32F446xx || STM32F469_479xx */
|
||||
|
||||
#if defined(STM32F427_437xx)
|
||||
#include "stm32f4xx_cryp.h"
|
||||
#include "stm32f4xx_hash.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_can.h"
|
||||
#include "stm32f4xx_dac.h"
|
||||
#include "stm32f4xx_dcmi.h"
|
||||
#include "stm32f4xx_dma2d.h"
|
||||
#include "stm32f4xx_fmc.h"
|
||||
#include "stm32f4xx_sai.h"
|
||||
#endif /* STM32F427_437xx */
|
||||
|
||||
#if defined(STM32F40_41xxx)
|
||||
#include "stm32f4xx_cryp.h"
|
||||
#include "stm32f4xx_hash.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_can.h"
|
||||
#include "stm32f4xx_dac.h"
|
||||
#include "stm32f4xx_dcmi.h"
|
||||
#include "stm32f4xx_fsmc.h"
|
||||
#endif /* STM32F40_41xxx */
|
||||
|
||||
#if defined(STM32F410xx)
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_dac.h"
|
||||
#endif /* STM32F410xx */
|
||||
|
||||
#if defined(STM32F411xE)
|
||||
#include "stm32f4xx_flash_ramfunc.h"
|
||||
#endif /* STM32F411xE */
|
||||
|
||||
#if defined(STM32F446xx) || defined(STM32F469_479xx)
|
||||
#include "stm32f4xx_qspi.h"
|
||||
#endif /* STM32F446xx || STM32F469_479xx */
|
||||
|
||||
#if defined(STM32F410xx) || defined(STM32F446xx)
|
||||
#include "stm32f4xx_fmpi2c.h"
|
||||
#endif /* STM32F410xx || STM32F446xx */
|
||||
|
||||
#if defined(STM32F446xx)
|
||||
#include "stm32f4xx_spdifrx.h"
|
||||
#include "stm32f4xx_cec.h"
|
||||
#endif /* STM32F446xx */
|
||||
|
||||
#if defined(STM32F469_479xx)
|
||||
#include "stm32f4xx_dsi.h"
|
||||
#endif /* STM32F469_479xx */
|
||||
|
||||
#if defined(STM32F410xx)
|
||||
#include "stm32f4xx_lptim.h"
|
||||
#endif /* STM32F410xx */
|
||||
|
||||
#if defined(STM32F412xG)
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_can.h"
|
||||
#include "stm32f4xx_qspi.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_fsmc.h"
|
||||
#include "stm32f4xx_dfsdm.h"
|
||||
#endif /* STM32F412xG */
|
||||
|
||||
#if defined(STM32F413_423xx)
|
||||
#include "stm32f4xx_cryp.h"
|
||||
#include "stm32f4xx_fmpi2c.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_can.h"
|
||||
#include "stm32f4xx_qspi.h"
|
||||
#include "stm32f4xx_rng.h"
|
||||
#include "stm32f4xx_fsmc.h"
|
||||
#include "stm32f4xx_dfsdm.h"
|
||||
#endif /* STM32F413_423xx */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* If an external clock source is used, then the value of the following define
|
||||
should be set to the value of the external clock source, else, if no external
|
||||
clock is used, keep this define commented */
|
||||
/*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */
|
||||
|
||||
|
||||
/* Uncomment the line below to expanse the "assert_param" macro in the
|
||||
Standard Peripheral Library drivers code */
|
||||
/* #define USE_FULL_ASSERT 1 */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#endif /* __STM32F4xx_CONF_H */
|
||||
|
||||
158
底盘独立控制器/code/User/stm32f4xx_it.c
Normal file
158
底盘独立控制器/code/User/stm32f4xx_it.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.8.1
|
||||
* @date 27-January-2022
|
||||
* @brief Main Interrupt Service Routines.
|
||||
* This file provides template for all exceptions handler and
|
||||
* peripherals interrupt service routine.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_it.h"
|
||||
|
||||
/** @addtogroup Template_Project
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M4 Processor Exceptions Handlers */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles NMI exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard Fault exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Hard Fault exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory Manage exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Memory Manage exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Bus Fault exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Bus Fault exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Usage Fault exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* Go to infinite loop when Usage Fault exception occurs */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles SVCall exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug Monitor exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles PendSVC exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles SysTick Handler.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32F4xx Peripherals Interrupt Handlers */
|
||||
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
|
||||
/* available peripheral interrupt handler's name please refer to the startup */
|
||||
/* file (startup_stm32f4xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles PPP interrupt request.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
/*void PPP_IRQHandler(void)
|
||||
{
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
52
底盘独立控制器/code/User/stm32f4xx_it.h
Normal file
52
底盘独立控制器/code/User/stm32f4xx_it.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.8.1
|
||||
* @date 27-January-2022
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F4xx_IT_H
|
||||
#define __STM32F4xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F4xx_IT_H */
|
||||
|
||||
Reference in New Issue
Block a user