添加了ist8310磁力计的支持,同时修复了gpio初始化先于exti的bug

This commit is contained in:
NeoZng
2023-02-03 15:25:58 +08:00
parent 73cdc66de5
commit 1262f9a516
19 changed files with 326 additions and 124 deletions

View File

@@ -34,7 +34,6 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "robot.h"
#include "oled.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -115,6 +114,7 @@ int main(void)
MX_I2C3_Init();
/* USER CODE BEGIN 2 */
RobotInit();
/* USER CODE END 2 */
/* Call init function for freertos objects (in freertos.c) */

View File

@@ -1,20 +1,20 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2023 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.
*
******************************************************************************
*/
******************************************************************************
* @file stm32f4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2023 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 ------------------------------------------------------------------*/
@@ -87,8 +87,8 @@ extern UART_HandleTypeDef huart6;
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles Non maskable interrupt.
*/
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
@@ -102,25 +102,26 @@ void NMI_Handler(void)
}
/**
* @brief This function handles Hard fault interrupt.
*/
* @brief This function handles Hard fault interrupt.
*/
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
// 发生hardfault,点击step over会自动跳转回出错的指令,方便调试
asm("bx lr");
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
// 发生hardfault,点击step over会自动跳转回出错的指令,方便调试
asm("bx lr");
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
/**
* @brief This function handles Memory management fault.
*/
* @brief This function handles Memory management fault.
*/
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
@@ -134,8 +135,8 @@ void MemManage_Handler(void)
}
/**
* @brief This function handles Pre-fetch fault, memory access fault.
*/
* @brief This function handles Pre-fetch fault, memory access fault.
*/
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
@@ -149,8 +150,8 @@ void BusFault_Handler(void)
}
/**
* @brief This function handles Undefined instruction or illegal state.
*/
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
@@ -164,8 +165,8 @@ void UsageFault_Handler(void)
}
/**
* @brief This function handles Debug monitor.
*/
* @brief This function handles Debug monitor.
*/
void DebugMon_Handler(void)
{
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
@@ -177,20 +178,20 @@ void DebugMon_Handler(void)
}
/**
* @brief This function handles System tick timer.
*/
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
#if (INCLUDE_xTaskGetSchedulerState == 1 )
#if (INCLUDE_xTaskGetSchedulerState == 1)
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
{
#endif /* INCLUDE_xTaskGetSchedulerState */
xPortSysTickHandler();
#if (INCLUDE_xTaskGetSchedulerState == 1 )
xPortSysTickHandler();
#if (INCLUDE_xTaskGetSchedulerState == 1)
}
#endif /* INCLUDE_xTaskGetSchedulerState */
/* USER CODE BEGIN SysTick_IRQn 1 */
@@ -206,8 +207,8 @@ void SysTick_Handler(void)
/******************************************************************************/
/**
* @brief This function handles EXTI line3 interrupt.
*/
* @brief This function handles EXTI line3 interrupt.
*/
void EXTI3_IRQHandler(void)
{
/* USER CODE BEGIN EXTI3_IRQn 0 */
@@ -220,8 +221,8 @@ void EXTI3_IRQHandler(void)
}
/**
* @brief This function handles EXTI line4 interrupt.
*/
* @brief This function handles EXTI line4 interrupt.
*/
void EXTI4_IRQHandler(void)
{
/* USER CODE BEGIN EXTI4_IRQn 0 */
@@ -234,8 +235,8 @@ void EXTI4_IRQHandler(void)
}
/**
* @brief This function handles DMA1 stream1 global interrupt.
*/
* @brief This function handles DMA1 stream1 global interrupt.
*/
void DMA1_Stream1_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream1_IRQn 0 */
@@ -248,8 +249,8 @@ void DMA1_Stream1_IRQHandler(void)
}
/**
* @brief This function handles DMA1 stream2 global interrupt.
*/
* @brief This function handles DMA1 stream2 global interrupt.
*/
void DMA1_Stream2_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream2_IRQn 0 */
@@ -262,8 +263,8 @@ void DMA1_Stream2_IRQHandler(void)
}
/**
* @brief This function handles DMA1 stream3 global interrupt.
*/
* @brief This function handles DMA1 stream3 global interrupt.
*/
void DMA1_Stream3_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
@@ -276,8 +277,8 @@ void DMA1_Stream3_IRQHandler(void)
}
/**
* @brief This function handles DMA1 stream4 global interrupt.
*/
* @brief This function handles DMA1 stream4 global interrupt.
*/
void DMA1_Stream4_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream4_IRQn 0 */
@@ -290,8 +291,8 @@ void DMA1_Stream4_IRQHandler(void)
}
/**
* @brief This function handles CAN1 RX0 interrupts.
*/
* @brief This function handles CAN1 RX0 interrupts.
*/
void CAN1_RX0_IRQHandler(void)
{
/* USER CODE BEGIN CAN1_RX0_IRQn 0 */
@@ -304,8 +305,8 @@ void CAN1_RX0_IRQHandler(void)
}
/**
* @brief This function handles CAN1 RX1 interrupt.
*/
* @brief This function handles CAN1 RX1 interrupt.
*/
void CAN1_RX1_IRQHandler(void)
{
/* USER CODE BEGIN CAN1_RX1_IRQn 0 */
@@ -318,8 +319,8 @@ void CAN1_RX1_IRQHandler(void)
}
/**
* @brief This function handles I2C2 event interrupt.
*/
* @brief This function handles I2C2 event interrupt.
*/
void I2C2_EV_IRQHandler(void)
{
/* USER CODE BEGIN I2C2_EV_IRQn 0 */
@@ -332,8 +333,8 @@ void I2C2_EV_IRQHandler(void)
}
/**
* @brief This function handles I2C2 error interrupt.
*/
* @brief This function handles I2C2 error interrupt.
*/
void I2C2_ER_IRQHandler(void)
{
/* USER CODE BEGIN I2C2_ER_IRQn 0 */
@@ -346,8 +347,8 @@ void I2C2_ER_IRQHandler(void)
}
/**
* @brief This function handles SPI1 global interrupt.
*/
* @brief This function handles SPI1 global interrupt.
*/
void SPI1_IRQHandler(void)
{
/* USER CODE BEGIN SPI1_IRQn 0 */
@@ -360,8 +361,8 @@ void SPI1_IRQHandler(void)
}
/**
* @brief This function handles SPI2 global interrupt.
*/
* @brief This function handles SPI2 global interrupt.
*/
void SPI2_IRQHandler(void)
{
/* USER CODE BEGIN SPI2_IRQn 0 */
@@ -374,8 +375,8 @@ void SPI2_IRQHandler(void)
}
/**
* @brief This function handles USART1 global interrupt.
*/
* @brief This function handles USART1 global interrupt.
*/
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
@@ -388,8 +389,8 @@ void USART1_IRQHandler(void)
}
/**
* @brief This function handles USART3 global interrupt.
*/
* @brief This function handles USART3 global interrupt.
*/
void USART3_IRQHandler(void)
{
/* USER CODE BEGIN USART3_IRQn 0 */
@@ -402,8 +403,8 @@ void USART3_IRQHandler(void)
}
/**
* @brief This function handles DMA1 stream7 global interrupt.
*/
* @brief This function handles DMA1 stream7 global interrupt.
*/
void DMA1_Stream7_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream7_IRQn 0 */
@@ -416,8 +417,8 @@ void DMA1_Stream7_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream0 global interrupt.
*/
* @brief This function handles DMA2 stream0 global interrupt.
*/
void DMA2_Stream0_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
@@ -430,8 +431,8 @@ void DMA2_Stream0_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream2 global interrupt.
*/
* @brief This function handles DMA2 stream2 global interrupt.
*/
void DMA2_Stream2_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream2_IRQn 0 */
@@ -444,8 +445,8 @@ void DMA2_Stream2_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream3 global interrupt.
*/
* @brief This function handles DMA2 stream3 global interrupt.
*/
void DMA2_Stream3_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream3_IRQn 0 */
@@ -458,8 +459,8 @@ void DMA2_Stream3_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream4 global interrupt.
*/
* @brief This function handles DMA2 stream4 global interrupt.
*/
void DMA2_Stream4_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream4_IRQn 0 */
@@ -472,8 +473,8 @@ void DMA2_Stream4_IRQHandler(void)
}
/**
* @brief This function handles CAN2 RX0 interrupts.
*/
* @brief This function handles CAN2 RX0 interrupts.
*/
void CAN2_RX0_IRQHandler(void)
{
/* USER CODE BEGIN CAN2_RX0_IRQn 0 */
@@ -486,8 +487,8 @@ void CAN2_RX0_IRQHandler(void)
}
/**
* @brief This function handles CAN2 RX1 interrupt.
*/
* @brief This function handles CAN2 RX1 interrupt.
*/
void CAN2_RX1_IRQHandler(void)
{
/* USER CODE BEGIN CAN2_RX1_IRQn 0 */
@@ -500,8 +501,8 @@ void CAN2_RX1_IRQHandler(void)
}
/**
* @brief This function handles USB On The Go FS global interrupt.
*/
* @brief This function handles USB On The Go FS global interrupt.
*/
void OTG_FS_IRQHandler(void)
{
/* USER CODE BEGIN OTG_FS_IRQn 0 */
@@ -514,8 +515,8 @@ void OTG_FS_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream5 global interrupt.
*/
* @brief This function handles DMA2 stream5 global interrupt.
*/
void DMA2_Stream5_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream5_IRQn 0 */
@@ -528,8 +529,8 @@ void DMA2_Stream5_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream6 global interrupt.
*/
* @brief This function handles DMA2 stream6 global interrupt.
*/
void DMA2_Stream6_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream6_IRQn 0 */
@@ -542,8 +543,8 @@ void DMA2_Stream6_IRQHandler(void)
}
/**
* @brief This function handles DMA2 stream7 global interrupt.
*/
* @brief This function handles DMA2 stream7 global interrupt.
*/
void DMA2_Stream7_IRQHandler(void)
{
/* USER CODE BEGIN DMA2_Stream7_IRQn 0 */
@@ -556,8 +557,8 @@ void DMA2_Stream7_IRQHandler(void)
}
/**
* @brief This function handles USART6 global interrupt.
*/
* @brief This function handles USART6 global interrupt.
*/
void USART6_IRQHandler(void)
{
/* USER CODE BEGIN USART6_IRQn 0 */
@@ -570,8 +571,8 @@ void USART6_IRQHandler(void)
}
/**
* @brief This function handles I2C3 event interrupt.
*/
* @brief This function handles I2C3 event interrupt.
*/
void I2C3_EV_IRQHandler(void)
{
/* USER CODE BEGIN I2C3_EV_IRQn 0 */
@@ -584,8 +585,8 @@ void I2C3_EV_IRQHandler(void)
}
/**
* @brief This function handles I2C3 error interrupt.
*/
* @brief This function handles I2C3 error interrupt.
*/
void I2C3_ER_IRQHandler(void)
{
/* USER CODE BEGIN I2C3_ER_IRQn 0 */