mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 15:34:33 +08:00
remove I2C handler from patch file and stick in user section instead
This commit is contained in:
@@ -10,11 +10,9 @@ Subject: [PATCH] Add I2C files and settings
|
||||
.../Src/stm32f4xx_hal_i2c_ex.c | 204 +
|
||||
Firmware/Board/v3/Inc/i2c.h | 91 +
|
||||
Firmware/Board/v3/Inc/stm32f4xx_hal_conf.h | 2 +-
|
||||
Firmware/Board/v3/Inc/stm32f4xx_it.h | 1 +
|
||||
Firmware/Board/v3/Odrive.ioc | 5 +
|
||||
Firmware/Board/v3/Src/i2c.c | 198 +
|
||||
Firmware/Board/v3/Src/main.c | 1 -
|
||||
Firmware/Board/v3/Src/stm32f4xx_it.c | 31 +
|
||||
11 files changed, 6811 insertions(+), 2 deletions(-)
|
||||
create mode 100644 Firmware/Board/v3/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h
|
||||
create mode 100644 Firmware/Board/v3/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h
|
||||
@@ -6641,18 +6639,6 @@ index d0f48f5..b3ef59a 100644
|
||||
/* #define HAL_I2S_MODULE_ENABLED */
|
||||
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||
/* #define HAL_LTDC_MODULE_ENABLED */
|
||||
diff --git a/Firmware/Board/v3/Inc/stm32f4xx_it.h b/Firmware/Board/v3/Inc/stm32f4xx_it.h
|
||||
index a4d1813..050334c 100644
|
||||
--- a/Firmware/Board/v3/Inc/stm32f4xx_it.h
|
||||
+++ b/Firmware/Board/v3/Inc/stm32f4xx_it.h
|
||||
@@ -59,6 +59,7 @@ void DMA1_Stream2_IRQHandler(void);
|
||||
void DMA1_Stream4_IRQHandler(void);
|
||||
void DMA1_Stream6_IRQHandler(void);
|
||||
void ADC_IRQHandler(void);
|
||||
+void I2C1_ER_IRQHandler(void);
|
||||
void TIM8_TRG_COM_TIM14_IRQHandler(void);
|
||||
void UART4_IRQHandler(void);
|
||||
void OTG_FS_IRQHandler(void);
|
||||
diff --git a/Firmware/Board/v3/Src/i2c.c b/Firmware/Board/v3/Src/i2c.c
|
||||
new file mode 100644
|
||||
index 0000000..bae77f1
|
||||
@@ -6869,55 +6855,6 @@ index 987e0bd..efaeef1 100644
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
//Required to use OC4 for ADC triggering.
|
||||
diff --git a/Firmware/Board/v3/Src/stm32f4xx_it.c b/Firmware/Board/v3/Src/stm32f4xx_it.c
|
||||
index 8434a9e..f6b4fcd 100644
|
||||
--- a/Firmware/Board/v3/Src/stm32f4xx_it.c
|
||||
+++ b/Firmware/Board/v3/Src/stm32f4xx_it.c
|
||||
@@ -54,6 +54,9 @@ extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
extern ADC_HandleTypeDef hadc2;
|
||||
extern ADC_HandleTypeDef hadc3;
|
||||
+extern DMA_HandleTypeDef hdma_i2c1_rx;
|
||||
+extern DMA_HandleTypeDef hdma_i2c1_tx;
|
||||
+extern I2C_HandleTypeDef hi2c1;
|
||||
extern TIM_HandleTypeDef htim8;
|
||||
extern DMA_HandleTypeDef hdma_uart4_rx;
|
||||
extern DMA_HandleTypeDef hdma_uart4_tx;
|
||||
@@ -266,6 +269,34 @@ void ADC_IRQHandler(void)
|
||||
/* USER CODE END ADC_IRQn 1 */
|
||||
}
|
||||
|
||||
+/**
|
||||
+* @brief This function handles I2C1 event interrupt.
|
||||
+*/
|
||||
+void I2C1_EV_IRQHandler(void)
|
||||
+{
|
||||
+ /* USER CODE BEGIN I2C1_EV_IRQn 0 */
|
||||
+
|
||||
+ /* USER CODE END I2C1_EV_IRQn 0 */
|
||||
+ HAL_I2C_EV_IRQHandler(&hi2c1);
|
||||
+ /* USER CODE BEGIN I2C1_EV_IRQn 1 */
|
||||
+
|
||||
+ /* USER CODE END I2C1_EV_IRQn 1 */
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+* @brief This function handles I2C1 error interrupt.
|
||||
+*/
|
||||
+void I2C1_ER_IRQHandler(void)
|
||||
+{
|
||||
+ /* USER CODE BEGIN I2C1_ER_IRQn 0 */
|
||||
+
|
||||
+ /* USER CODE END I2C1_ER_IRQn 0 */
|
||||
+ HAL_I2C_ER_IRQHandler(&hi2c1);
|
||||
+ /* USER CODE BEGIN I2C1_ER_IRQn 1 */
|
||||
+
|
||||
+ /* USER CODE END I2C1_ER_IRQn 1 */
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* @brief This function handles TIM8 trigger and commutation interrupts and TIM14 global interrupt.
|
||||
*/
|
||||
--
|
||||
2.17.0
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ void DMA1_Stream2_IRQHandler(void);
|
||||
void DMA1_Stream4_IRQHandler(void);
|
||||
void DMA1_Stream6_IRQHandler(void);
|
||||
void ADC_IRQHandler(void);
|
||||
void I2C1_ER_IRQHandler(void);
|
||||
void TIM8_TRG_COM_TIM14_IRQHandler(void);
|
||||
void UART4_IRQHandler(void);
|
||||
void OTG_FS_IRQHandler(void);
|
||||
|
||||
@@ -47,6 +47,8 @@ void ADC_IRQ_Dispatch(ADC_HandleTypeDef* hadc, ADC_handler_t callback);
|
||||
void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
|
||||
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
|
||||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
@@ -54,9 +56,6 @@ extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
extern ADC_HandleTypeDef hadc2;
|
||||
extern ADC_HandleTypeDef hadc3;
|
||||
extern DMA_HandleTypeDef hdma_i2c1_rx;
|
||||
extern DMA_HandleTypeDef hdma_i2c1_tx;
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
extern TIM_HandleTypeDef htim8;
|
||||
extern DMA_HandleTypeDef hdma_uart4_rx;
|
||||
extern DMA_HandleTypeDef hdma_uart4_tx;
|
||||
@@ -269,34 +268,6 @@ void ADC_IRQHandler(void)
|
||||
/* USER CODE END ADC_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles I2C1 event interrupt.
|
||||
*/
|
||||
void I2C1_EV_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN I2C1_EV_IRQn 0 */
|
||||
|
||||
/* USER CODE END I2C1_EV_IRQn 0 */
|
||||
HAL_I2C_EV_IRQHandler(&hi2c1);
|
||||
/* USER CODE BEGIN I2C1_EV_IRQn 1 */
|
||||
|
||||
/* USER CODE END I2C1_EV_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles I2C1 error interrupt.
|
||||
*/
|
||||
void I2C1_ER_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN I2C1_ER_IRQn 0 */
|
||||
|
||||
/* USER CODE END I2C1_ER_IRQn 0 */
|
||||
HAL_I2C_ER_IRQHandler(&hi2c1);
|
||||
/* USER CODE BEGIN I2C1_ER_IRQn 1 */
|
||||
|
||||
/* USER CODE END I2C1_ER_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM8 trigger and commutation interrupts and TIM14 global interrupt.
|
||||
*/
|
||||
@@ -367,6 +338,21 @@ void ADC_IRQ_Dispatch(ADC_HandleTypeDef* hadc, ADC_handler_t callback) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles I2C1 event interrupt.
|
||||
*/
|
||||
void I2C1_EV_IRQHandler(void)
|
||||
{
|
||||
HAL_I2C_EV_IRQHandler(&hi2c1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles I2C1 error interrupt.
|
||||
*/
|
||||
void I2C1_ER_IRQHandler(void)
|
||||
{
|
||||
HAL_I2C_ER_IRQHandler(&hi2c1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI line0 interrupt.
|
||||
|
||||
Reference in New Issue
Block a user