From 7b660f0fe26050f4189d0c6e3c19ebfd75afe1ed Mon Sep 17 00:00:00 2001 From: Klagarge Date: Sat, 13 Jan 2024 15:35:57 +0100 Subject: [PATCH] add xf integration --- .cproject | 20 +- .project | 17 + Core/Inc/main.h | 38 +- Core/Inc/stm32f7xx_it.h | 3 + Core/Src/isrs.cpp | 16 + Core/Src/main.c | 171 ++++---- Core/Src/stm32f7xx_hal_msp.c | 129 +----- Core/Src/stm32f7xx_it.c | 43 ++ RealtimeOscilloscope.ioc | 409 +++++++++--------- .../f7-disco-gcc/board/buttonscontroller.h | 2 + 10 files changed, 384 insertions(+), 464 deletions(-) diff --git a/.cproject b/.cproject index a32c422..982b647 100644 --- a/.cproject +++ b/.cproject @@ -107,11 +107,11 @@ - - - - - + + + + + @@ -199,11 +199,11 @@ - - - - - + + + + + diff --git a/.project b/.project index 43408a6..7c39f34 100644 --- a/.project +++ b/.project @@ -30,4 +30,21 @@ org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + f7-disco-gcc + 2 + C:/Users/remi.heredero/GIT/00-PTR/RealtimeOscilloscope/src/platform/f7-disco-gcc + + + mdw + 2 + C:/Users/remi.heredero/GIT/00-PTR/RealtimeOscilloscope/src/mdw + + + xf + 2 + C:/Users/remi.heredero/GIT/00-PTR/RealtimeOscilloscope/src/xf + + diff --git a/Core/Inc/main.h b/Core/Inc/main.h index cb779f7..4b06904 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -75,16 +75,16 @@ void Error_Handler(void); #define ARDUINO_SCL_D15_GPIO_Port GPIOB #define ULPI_D7_Pin GPIO_PIN_5 #define ULPI_D7_GPIO_Port GPIOB -#define ARDUINO_PWM_D3_Pin GPIO_PIN_4 -#define ARDUINO_PWM_D3_GPIO_Port GPIOB +#define LED3_Pin GPIO_PIN_4 +#define LED3_GPIO_Port GPIOB #define SWO_Pin GPIO_PIN_3 #define SWO_GPIO_Port GPIOB #define SPDIF_RX0_Pin GPIO_PIN_7 #define SPDIF_RX0_GPIO_Port GPIOD #define SDMMC_CK_Pin GPIO_PIN_12 #define SDMMC_CK_GPIO_Port GPIOC -#define ARDUINO_PWM_D9_Pin GPIO_PIN_15 -#define ARDUINO_PWM_D9_GPIO_Port GPIOA +#define LED0_Pin GPIO_PIN_15 +#define LED0_GPIO_Port GPIOA #define SWCLK_Pin GPIO_PIN_14 #define SWCLK_GPIO_Port GPIOA #define SWDIO_Pin GPIO_PIN_13 @@ -109,8 +109,6 @@ void Error_Handler(void); #define LCD_B1_GPIO_Port GPIOJ #define OTG_FS_VBUS_Pin GPIO_PIN_12 #define OTG_FS_VBUS_GPIO_Port GPIOJ -#define Audio_INT_Pin GPIO_PIN_6 -#define Audio_INT_GPIO_Port GPIOD #define FMC_D2_Pin GPIO_PIN_0 #define FMC_D2_GPIO_Port GPIOD #define SDMMC_D3_Pin GPIO_PIN_11 @@ -141,10 +139,12 @@ void Error_Handler(void); #define DCMI_D5_GPIO_Port GPIOD #define FMC_D3_Pin GPIO_PIN_1 #define FMC_D3_GPIO_Port GPIOD -#define ARDUINO_D7_Pin GPIO_PIN_3 -#define ARDUINO_D7_GPIO_Port GPIOI -#define ARDUINO_D8_Pin GPIO_PIN_2 -#define ARDUINO_D8_GPIO_Port GPIOI +#define BUTTON1_Pin GPIO_PIN_3 +#define BUTTON1_GPIO_Port GPIOI +#define BUTTON1_EXTI_IRQn EXTI3_IRQn +#define BUTTON0_Pin GPIO_PIN_2 +#define BUTTON0_GPIO_Port GPIOI +#define BUTTON0_EXTI_IRQn EXTI2_IRQn #define OTG_FS_N_Pin GPIO_PIN_11 #define OTG_FS_N_GPIO_Port GPIOA #define uSD_Detect_Pin GPIO_PIN_13 @@ -199,8 +199,8 @@ void Error_Handler(void); #define LCD_G6_GPIO_Port GPIOK #define LCD_G7_Pin GPIO_PIN_2 #define LCD_G7_GPIO_Port GPIOK -#define ARDUINO_PWM_D10_Pin GPIO_PIN_8 -#define ARDUINO_PWM_D10_GPIO_Port GPIOA +#define LED2_Pin GPIO_PIN_8 +#define LED2_GPIO_Port GPIOA #define OSC_25M_Pin GPIO_PIN_0 #define OSC_25M_GPIO_Port GPIOH #define FMC_A2_Pin GPIO_PIN_2 @@ -239,10 +239,12 @@ void Error_Handler(void); #define LCD_G0_GPIO_Port GPIOJ #define LCD_G2_Pin GPIO_PIN_9 #define LCD_G2_GPIO_Port GPIOJ -#define ARDUINO_D4_Pin GPIO_PIN_7 -#define ARDUINO_D4_GPIO_Port GPIOG -#define ARDUINO_D2_Pin GPIO_PIN_6 -#define ARDUINO_D2_GPIO_Port GPIOG +#define BUTTON2_Pin GPIO_PIN_7 +#define BUTTON2_GPIO_Port GPIOG +#define BUTTON2_EXTI_IRQn EXTI9_5_IRQn +#define BUTTON3_Pin GPIO_PIN_6 +#define BUTTON3_GPIO_Port GPIOG +#define BUTTON3_EXTI_IRQn EXTI9_5_IRQn #define ARDUINO_A4_Pin GPIO_PIN_7 #define ARDUINO_A4_GPIO_Port GPIOF #define ARDUINO_A5_Pin GPIO_PIN_6 @@ -349,8 +351,8 @@ void Error_Handler(void); #define FMC_D11_GPIO_Port GPIOE #define ULPI_D3_Pin GPIO_PIN_10 #define ULPI_D3_GPIO_Port GPIOB -#define ARDUINO_PWM_D6_Pin GPIO_PIN_6 -#define ARDUINO_PWM_D6_GPIO_Port GPIOH +#define LED1_Pin GPIO_PIN_6 +#define LED1_GPIO_Port GPIOH #define LCD_SDA_Pin GPIO_PIN_8 #define LCD_SDA_GPIO_Port GPIOH #define DCMI_D1_Pin GPIO_PIN_10 diff --git a/Core/Inc/stm32f7xx_it.h b/Core/Inc/stm32f7xx_it.h index a173c23..4ef41a6 100644 --- a/Core/Inc/stm32f7xx_it.h +++ b/Core/Inc/stm32f7xx_it.h @@ -55,7 +55,10 @@ void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); +void EXTI2_IRQHandler(void); +void EXTI3_IRQHandler(void); void ADC_IRQHandler(void); +void EXTI9_5_IRQHandler(void); void TIM6_DAC_IRQHandler(void); void LTDC_IRQHandler(void); void DMA2D_IRQHandler(void); diff --git a/Core/Src/isrs.cpp b/Core/Src/isrs.cpp index 24c69fc..90e0079 100644 --- a/Core/Src/isrs.cpp +++ b/Core/Src/isrs.cpp @@ -7,8 +7,24 @@ #include "stm32f7xx_hal.h" #include "main.h" +#include "board/buttonscontroller.h" +extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) +{ + switch (GPIO_Pin) + { + case BUTTON0_Pin: + case BUTTON1_Pin: + case BUTTON2_Pin: + case BUTTON3_Pin: + ButtonsController::getInstance().onIrq(); + break; + default: + break; + } +} + extern "C" void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef * hadc) { HAL_GPIO_TogglePin(OUT1_GPIO_Port, OUT1_Pin); volatile uint32_t value = HAL_ADC_GetValue(hadc); diff --git a/Core/Src/main.c b/Core/Src/main.c index 2f8f788..50c5fff 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -22,6 +22,9 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ +#include "xf/xf.h" +#include "xf/port/port-functions.h" + /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -58,7 +61,6 @@ TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim3; TIM_HandleTypeDef htim5; TIM_HandleTypeDef htim8; -TIM_HandleTypeDef htim12; UART_HandleTypeDef huart1; @@ -84,7 +86,6 @@ static void MX_TIM2_Init(void); static void MX_TIM3_Init(void); static void MX_TIM5_Init(void); static void MX_TIM8_Init(void); -static void MX_TIM12_Init(void); static void MX_USART1_UART_Init(void); /* USER CODE BEGIN PFP */ @@ -138,7 +139,6 @@ int main(void) MX_TIM3_Init(); MX_TIM5_Init(); MX_TIM8_Init(); - MX_TIM12_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ @@ -678,7 +678,6 @@ static void MX_TIM2_Init(void) TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; - TIM_OC_InitTypeDef sConfigOC = {0}; /* USER CODE BEGIN TIM2_Init 1 */ @@ -698,28 +697,15 @@ static void MX_TIM2_Init(void) { Error_Handler(); } - if (HAL_TIM_PWM_Init(&htim2) != HAL_OK) - { - Error_Handler(); - } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK) { Error_Handler(); } - sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = 0; - sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; - sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; - if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1) != HAL_OK) - { - Error_Handler(); - } /* USER CODE BEGIN TIM2_Init 2 */ /* USER CODE END TIM2_Init 2 */ - HAL_TIM_MspPostInit(&htim2); } @@ -737,7 +723,6 @@ static void MX_TIM3_Init(void) TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; - TIM_OC_InitTypeDef sConfigOC = {0}; /* USER CODE BEGIN TIM3_Init 1 */ @@ -757,28 +742,15 @@ static void MX_TIM3_Init(void) { Error_Handler(); } - if (HAL_TIM_PWM_Init(&htim3) != HAL_OK) - { - Error_Handler(); - } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK) { Error_Handler(); } - sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = 0; - sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; - sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; - if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1) != HAL_OK) - { - Error_Handler(); - } /* USER CODE BEGIN TIM3_Init 2 */ /* USER CODE END TIM3_Init 2 */ - HAL_TIM_MspPostInit(&htim3); } @@ -888,48 +860,6 @@ static void MX_TIM8_Init(void) } -/** - * @brief TIM12 Initialization Function - * @param None - * @retval None - */ -static void MX_TIM12_Init(void) -{ - - /* USER CODE BEGIN TIM12_Init 0 */ - - /* USER CODE END TIM12_Init 0 */ - - TIM_OC_InitTypeDef sConfigOC = {0}; - - /* USER CODE BEGIN TIM12_Init 1 */ - - /* USER CODE END TIM12_Init 1 */ - htim12.Instance = TIM12; - htim12.Init.Prescaler = 0; - htim12.Init.CounterMode = TIM_COUNTERMODE_UP; - htim12.Init.Period = 65535; - htim12.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; - htim12.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; - if (HAL_TIM_PWM_Init(&htim12) != HAL_OK) - { - Error_Handler(); - } - sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = 0; - sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; - sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; - if (HAL_TIM_PWM_ConfigChannel(&htim12, &sConfigOC, TIM_CHANNEL_1) != HAL_OK) - { - Error_Handler(); - } - /* USER CODE BEGIN TIM12_Init 2 */ - - /* USER CODE END TIM12_Init 2 */ - HAL_TIM_MspPostInit(&htim12); - -} - /** * @brief USART1 Initialization Function * @param None @@ -1035,10 +965,13 @@ static void MX_GPIO_Init(void) __HAL_RCC_GPIOH_CLK_ENABLE(); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOI, ARDUINO_D7_Pin|ARDUINO_D8_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOA, LED0_Pin|LED2_Pin, GPIO_PIN_RESET); + + /*Configure GPIO pin Output Level */ + HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_Port, LCD_BL_CTRL_Pin, GPIO_PIN_SET); @@ -1047,14 +980,14 @@ static void MX_GPIO_Init(void) HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_SET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(DCMI_PWR_EN_GPIO_Port, DCMI_PWR_EN_Pin, GPIO_PIN_RESET); - - /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOG, ARDUINO_D4_Pin|ARDUINO_D2_Pin|EXT_RST_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOH, DCMI_PWR_EN_Pin|LED1_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(OUT1_GPIO_Port, OUT1_Pin, GPIO_PIN_RESET); + /*Configure GPIO pin Output Level */ + HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET); + /*Configure GPIO pin : OTG_HS_OverCurrent_Pin */ GPIO_InitStruct.Pin = OTG_HS_OverCurrent_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; @@ -1095,6 +1028,13 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + /*Configure GPIO pin : LED3_Pin */ + GPIO_InitStruct.Pin = LED3_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(LED3_GPIO_Port, &GPIO_InitStruct); + /*Configure GPIO pin : SPDIF_RX0_Pin */ GPIO_InitStruct.Pin = SPDIF_RX0_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; @@ -1113,6 +1053,13 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + /*Configure GPIO pins : LED0_Pin LED2_Pin */ + GPIO_InitStruct.Pin = LED0_Pin|LED2_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + /*Configure GPIO pins : DCMI_D6_Pin DCMI_D7_Pin */ GPIO_InitStruct.Pin = DCMI_D6_Pin|DCMI_D7_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; @@ -1135,12 +1082,6 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(OTG_FS_VBUS_GPIO_Port, &GPIO_InitStruct); - /*Configure GPIO pin : Audio_INT_Pin */ - GPIO_InitStruct.Pin = Audio_INT_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING; - GPIO_InitStruct.Pull = GPIO_NOPULL; - HAL_GPIO_Init(Audio_INT_GPIO_Port, &GPIO_InitStruct); - /*Configure GPIO pins : OTG_FS_P_Pin OTG_FS_N_Pin OTG_FS_ID_Pin */ GPIO_InitStruct.Pin = OTG_FS_P_Pin|OTG_FS_N_Pin|OTG_FS_ID_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; @@ -1180,11 +1121,10 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF13_DCMI; HAL_GPIO_Init(DCMI_D5_GPIO_Port, &GPIO_InitStruct); - /*Configure GPIO pins : ARDUINO_D7_Pin ARDUINO_D8_Pin LCD_DISP_Pin */ - GPIO_InitStruct.Pin = ARDUINO_D7_Pin|ARDUINO_D8_Pin|LCD_DISP_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + /*Configure GPIO pins : BUTTON1_Pin BUTTON0_Pin */ + GPIO_InitStruct.Pin = BUTTON1_Pin|BUTTON0_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; + GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOI, &GPIO_InitStruct); /*Configure GPIO pin : uSD_Detect_Pin */ @@ -1228,12 +1168,19 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); - /*Configure GPIO pin : DCMI_PWR_EN_Pin */ - GPIO_InitStruct.Pin = DCMI_PWR_EN_Pin; + /*Configure GPIO pin : LCD_DISP_Pin */ + GPIO_InitStruct.Pin = LCD_DISP_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(DCMI_PWR_EN_GPIO_Port, &GPIO_InitStruct); + HAL_GPIO_Init(LCD_DISP_GPIO_Port, &GPIO_InitStruct); + + /*Configure GPIO pins : DCMI_PWR_EN_Pin LED1_Pin */ + GPIO_InitStruct.Pin = DCMI_PWR_EN_Pin|LED1_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); /*Configure GPIO pins : DCMI_D4_Pin DCMI_D3_Pin DCMI_D0_Pin DCMI_D2_Pin DCMI_D1_Pin */ @@ -1267,11 +1214,10 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS; HAL_GPIO_Init(ULPI_NXT_GPIO_Port, &GPIO_InitStruct); - /*Configure GPIO pins : ARDUINO_D4_Pin ARDUINO_D2_Pin EXT_RST_Pin */ - GPIO_InitStruct.Pin = ARDUINO_D4_Pin|ARDUINO_D2_Pin|EXT_RST_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + /*Configure GPIO pins : BUTTON2_Pin BUTTON3_Pin */ + GPIO_InitStruct.Pin = BUTTON2_Pin|BUTTON3_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; + GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); /*Configure GPIO pin : OUT1_Pin */ @@ -1313,6 +1259,13 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); + /*Configure GPIO pin : EXT_RST_Pin */ + GPIO_InitStruct.Pin = EXT_RST_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(EXT_RST_GPIO_Port, &GPIO_InitStruct); + /*Configure GPIO pin : RMII_RXER_Pin */ GPIO_InitStruct.Pin = RMII_RXER_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; @@ -1343,6 +1296,16 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + /* EXTI interrupt init*/ + HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(EXTI2_IRQn); + + HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(EXTI3_IRQn); + + HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); + } /* USER CODE BEGIN 4 */ @@ -1367,6 +1330,18 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) } /* USER CODE BEGIN Callback 1 */ +#if (PORT_IDF_STM32CUBE != 0) + if (htim->Instance == TIM6) { + // STM32 HAL tick handler gets called every millisecond (is given by code + // generated by STM32CubeIDE). Check which interval is needed by the + // XF (typically slower) and call XF_tick() accordingly. + if (XF_isRunning() && + (HAL_GetTick() % XF_tickIntervalInMilliseconds()) == 0) { + XF_tick(); + } + } +#endif // PORT_IDF_STM32CUBE + /* USER CODE END Callback 1 */ } diff --git a/Core/Src/stm32f7xx_hal_msp.c b/Core/Src/stm32f7xx_hal_msp.c index 300bf66..aca1b96 100644 --- a/Core/Src/stm32f7xx_hal_msp.c +++ b/Core/Src/stm32f7xx_hal_msp.c @@ -59,7 +59,7 @@ /* USER CODE END 0 */ void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); - /** + /** * Initializes the Global MSP. */ void HAL_MspInit(void) @@ -657,7 +657,6 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi) */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) { - GPIO_InitTypeDef GPIO_InitStruct = {0}; if(htim_base->Instance==TIM1) { /* USER CODE BEGIN TIM1_MspInit 0 */ @@ -665,18 +664,6 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) /* USER CODE END TIM1_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_TIM1_CLK_ENABLE(); - - __HAL_RCC_GPIOA_CLK_ENABLE(); - /**TIM1 GPIO Configuration - PA8 ------> TIM1_CH1 - */ - GPIO_InitStruct.Pin = ARDUINO_PWM_D10_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF1_TIM1; - HAL_GPIO_Init(ARDUINO_PWM_D10_GPIO_Port, &GPIO_InitStruct); - /* USER CODE BEGIN TIM1_MspInit 1 */ /* USER CODE END TIM1_MspInit 1 */ @@ -728,73 +715,10 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) } -/** -* @brief TIM_PWM MSP Initialization -* This function configures the hardware resources used in this example -* @param htim_pwm: TIM_PWM handle pointer -* @retval None -*/ -void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm) -{ - if(htim_pwm->Instance==TIM12) - { - /* USER CODE BEGIN TIM12_MspInit 0 */ - - /* USER CODE END TIM12_MspInit 0 */ - /* Peripheral clock enable */ - __HAL_RCC_TIM12_CLK_ENABLE(); - /* USER CODE BEGIN TIM12_MspInit 1 */ - - /* USER CODE END TIM12_MspInit 1 */ - } - -} - void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) { GPIO_InitTypeDef GPIO_InitStruct = {0}; - if(htim->Instance==TIM2) - { - /* USER CODE BEGIN TIM2_MspPostInit 0 */ - - /* USER CODE END TIM2_MspPostInit 0 */ - __HAL_RCC_GPIOA_CLK_ENABLE(); - /**TIM2 GPIO Configuration - PA15 ------> TIM2_CH1 - */ - GPIO_InitStruct.Pin = ARDUINO_PWM_D9_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF1_TIM2; - HAL_GPIO_Init(ARDUINO_PWM_D9_GPIO_Port, &GPIO_InitStruct); - - /* USER CODE BEGIN TIM2_MspPostInit 1 */ - - /* USER CODE END TIM2_MspPostInit 1 */ - } - else if(htim->Instance==TIM3) - { - /* USER CODE BEGIN TIM3_MspPostInit 0 */ - - /* USER CODE END TIM3_MspPostInit 0 */ - - __HAL_RCC_GPIOB_CLK_ENABLE(); - /**TIM3 GPIO Configuration - PB4 ------> TIM3_CH1 - */ - GPIO_InitStruct.Pin = ARDUINO_PWM_D3_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF2_TIM3; - HAL_GPIO_Init(ARDUINO_PWM_D3_GPIO_Port, &GPIO_InitStruct); - - /* USER CODE BEGIN TIM3_MspPostInit 1 */ - - /* USER CODE END TIM3_MspPostInit 1 */ - } - else if(htim->Instance==TIM5) + if(htim->Instance==TIM5) { /* USER CODE BEGIN TIM5_MspPostInit 0 */ @@ -815,27 +739,6 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) /* USER CODE END TIM5_MspPostInit 1 */ } - else if(htim->Instance==TIM12) - { - /* USER CODE BEGIN TIM12_MspPostInit 0 */ - - /* USER CODE END TIM12_MspPostInit 0 */ - - __HAL_RCC_GPIOH_CLK_ENABLE(); - /**TIM12 GPIO Configuration - PH6 ------> TIM12_CH1 - */ - GPIO_InitStruct.Pin = ARDUINO_PWM_D6_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF9_TIM12; - HAL_GPIO_Init(ARDUINO_PWM_D6_GPIO_Port, &GPIO_InitStruct); - - /* USER CODE BEGIN TIM12_MspPostInit 1 */ - - /* USER CODE END TIM12_MspPostInit 1 */ - } } /** @@ -853,12 +756,6 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) /* USER CODE END TIM1_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_TIM1_CLK_DISABLE(); - - /**TIM1 GPIO Configuration - PA8 ------> TIM1_CH1 - */ - HAL_GPIO_DeInit(ARDUINO_PWM_D10_GPIO_Port, ARDUINO_PWM_D10_Pin); - /* USER CODE BEGIN TIM1_MspDeInit 1 */ /* USER CODE END TIM1_MspDeInit 1 */ @@ -910,28 +807,6 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) } -/** -* @brief TIM_PWM MSP De-Initialization -* This function freeze the hardware resources used in this example -* @param htim_pwm: TIM_PWM handle pointer -* @retval None -*/ -void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm) -{ - if(htim_pwm->Instance==TIM12) - { - /* USER CODE BEGIN TIM12_MspDeInit 0 */ - - /* USER CODE END TIM12_MspDeInit 0 */ - /* Peripheral clock disable */ - __HAL_RCC_TIM12_CLK_DISABLE(); - /* USER CODE BEGIN TIM12_MspDeInit 1 */ - - /* USER CODE END TIM12_MspDeInit 1 */ - } - -} - /** * @brief UART MSP Initialization * This function configures the hardware resources used in this example diff --git a/Core/Src/stm32f7xx_it.c b/Core/Src/stm32f7xx_it.c index 54f847d..915a487 100644 --- a/Core/Src/stm32f7xx_it.c +++ b/Core/Src/stm32f7xx_it.c @@ -202,6 +202,34 @@ void SysTick_Handler(void) /* please refer to the startup file (startup_stm32f7xx.s). */ /******************************************************************************/ +/** + * @brief This function handles EXTI line2 interrupt. + */ +void EXTI2_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI2_IRQn 0 */ + + /* USER CODE END EXTI2_IRQn 0 */ + HAL_GPIO_EXTI_IRQHandler(BUTTON0_Pin); + /* USER CODE BEGIN EXTI2_IRQn 1 */ + + /* USER CODE END EXTI2_IRQn 1 */ +} + +/** + * @brief This function handles EXTI line3 interrupt. + */ +void EXTI3_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI3_IRQn 0 */ + + /* USER CODE END EXTI3_IRQn 0 */ + HAL_GPIO_EXTI_IRQHandler(BUTTON1_Pin); + /* USER CODE BEGIN EXTI3_IRQn 1 */ + + /* USER CODE END EXTI3_IRQn 1 */ +} + /** * @brief This function handles ADC1, ADC2 and ADC3 global interrupts. */ @@ -216,6 +244,21 @@ void ADC_IRQHandler(void) /* USER CODE END ADC_IRQn 1 */ } +/** + * @brief This function handles EXTI line[9:5] interrupts. + */ +void EXTI9_5_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI9_5_IRQn 0 */ + + /* USER CODE END EXTI9_5_IRQn 0 */ + HAL_GPIO_EXTI_IRQHandler(BUTTON3_Pin); + HAL_GPIO_EXTI_IRQHandler(BUTTON2_Pin); + /* USER CODE BEGIN EXTI9_5_IRQn 1 */ + + /* USER CODE END EXTI9_5_IRQn 1 */ +} + /** * @brief This function handles TIM6 global interrupt, DAC1 and DAC2 underrun error interrupts. */ diff --git a/RealtimeOscilloscope.ioc b/RealtimeOscilloscope.ioc index a20b82d..8725edd 100644 --- a/RealtimeOscilloscope.ioc +++ b/RealtimeOscilloscope.ioc @@ -52,8 +52,7 @@ Mcu.IP13=TIM2 Mcu.IP14=TIM3 Mcu.IP15=TIM5 Mcu.IP16=TIM8 -Mcu.IP17=TIM12 -Mcu.IP18=USART1 +Mcu.IP17=USART1 Mcu.IP2=CRC Mcu.IP3=DMA2D Mcu.IP4=FMC @@ -62,99 +61,98 @@ Mcu.IP6=LTDC Mcu.IP7=NVIC Mcu.IP8=RCC Mcu.IP9=RTC -Mcu.IPNb=19 +Mcu.IPNb=18 Mcu.Name=STM32F746NGHx Mcu.Package=TFBGA216 Mcu.Pin0=PE4 Mcu.Pin1=PE3 Mcu.Pin10=PD7 -Mcu.Pin100=PD15 -Mcu.Pin101=PB13 -Mcu.Pin102=PD10 -Mcu.Pin103=PF10 -Mcu.Pin104=PF9 -Mcu.Pin105=PF8 -Mcu.Pin106=PC3 -Mcu.Pin107=PD14 -Mcu.Pin108=PB12 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u.Pin166=VP_CRC_VS_CRC +Mcu.Pin167=VP_DMA2D_VS_DMA2D +Mcu.Pin168=VP_RTC_VS_RTC_Activate +Mcu.Pin169=VP_RTC_VS_RTC_Calendar Mcu.Pin17=PG13 -Mcu.Pin170=VP_RTC_VS_RTC_Calendar -Mcu.Pin171=VP_RTC_VS_RTC_Alarm_B_Intern -Mcu.Pin172=VP_RTC_VS_RTC_Alarm_A_Intern -Mcu.Pin173=VP_SYS_VS_tim6 -Mcu.Pin174=VP_TIM1_VS_ClockSourceINT -Mcu.Pin175=VP_TIM1_VS_no_output1 -Mcu.Pin176=VP_TIM2_VS_ClockSourceINT -Mcu.Pin177=VP_TIM3_VS_ClockSourceINT -Mcu.Pin178=VP_TIM5_VS_ClockSourceINT -Mcu.Pin179=VP_TIM8_VS_ClockSourceINT +Mcu.Pin170=VP_RTC_VS_RTC_Alarm_B_Intern +Mcu.Pin171=VP_RTC_VS_RTC_Alarm_A_Intern +Mcu.Pin172=VP_SYS_VS_tim6 +Mcu.Pin173=VP_TIM1_VS_ClockSourceINT +Mcu.Pin174=VP_TIM1_VS_no_output1 +Mcu.Pin175=VP_TIM2_VS_ClockSourceINT +Mcu.Pin176=VP_TIM3_VS_ClockSourceINT +Mcu.Pin177=VP_TIM5_VS_ClockSourceINT +Mcu.Pin178=VP_TIM8_VS_ClockSourceINT Mcu.Pin18=PB9 Mcu.Pin19=PB7 Mcu.Pin2=PE2 @@ -163,89 +161,89 @@ Mcu.Pin21=PG15 Mcu.Pin22=PG11 Mcu.Pin23=PJ13 Mcu.Pin24=PJ12 -Mcu.Pin25=PD6 -Mcu.Pin26=PD0 -Mcu.Pin27=PC11 -Mcu.Pin28=PC10 -Mcu.Pin29=PA12 +Mcu.Pin25=PD0 +Mcu.Pin26=PC11 +Mcu.Pin27=PC10 +Mcu.Pin28=PA12 +Mcu.Pin29=PI8 Mcu.Pin3=PG14 -Mcu.Pin30=PI8 -Mcu.Pin31=PI4 -Mcu.Pin32=PK7 -Mcu.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6 -Mcu.PinsNb=180 +Mcu.Pin90=PJ7 +Mcu.Pin91=PJ9 +Mcu.Pin92=PG7 +Mcu.Pin93=PG6 +Mcu.Pin94=PF7 +Mcu.Pin95=PF6 +Mcu.Pin96=PF5 +Mcu.Pin97=PH2 +Mcu.Pin98=PJ6 +Mcu.Pin99=PD15 +Mcu.PinsNb=179 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F746NGHx @@ -255,6 +253,9 @@ NVIC.ADC_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.DMA2D_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true +NVIC.EXTI2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true +NVIC.EXTI3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true +NVIC.EXTI9_5_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.LTDC_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true @@ -300,13 +301,10 @@ PA14.GPIO_Label=SWCLK PA14.Locked=true PA14.Mode=Serial_Wire PA14.Signal=SYS_JTCK-SWCLK -PA15.GPIOParameters=GPIO_ModeDefaultPP,GPIO_Speed,GPIO_PuPd,GPIO_Label -PA15.GPIO_Label=ARDUINO PWM/D9 -PA15.GPIO_ModeDefaultPP=GPIO_MODE_AF_PP -PA15.GPIO_PuPd=GPIO_NOPULL -PA15.GPIO_Speed=GPIO_SPEED_FREQ_LOW +PA15.GPIOParameters=GPIO_Label +PA15.GPIO_Label=LED0 PA15.Locked=true -PA15.Signal=S_TIM2_CH1_ETR +PA15.Signal=GPIO_Output PA2.GPIOParameters=GPIO_Label PA2.GPIO_Label=RMII_MDIO [LAN8742A-CZ-TR_MDIO] PA2.Locked=true @@ -331,13 +329,10 @@ PA7.GPIOParameters=GPIO_Label PA7.GPIO_Label=RMII_CRS_DV [LAN8742A-CZ-TR_CRS_DV] PA7.Locked=true PA7.Signal=ETH_CRS_DV -PA8.GPIOParameters=GPIO_ModeDefaultPP,GPIO_Speed,GPIO_PuPd,GPIO_Label -PA8.GPIO_Label=ARDUINO PWM/D10 -PA8.GPIO_ModeDefaultPP=GPIO_MODE_AF_PP -PA8.GPIO_PuPd=GPIO_NOPULL -PA8.GPIO_Speed=GPIO_SPEED_FREQ_LOW +PA8.GPIOParameters=GPIO_Label +PA8.GPIO_Label=LED2 PA8.Locked=true -PA8.Signal=S_TIM1_CH1 +PA8.Signal=GPIO_Output PA9.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode PA9.GPIO_Label=VCP_TX [STM32F103CBT6_PA3] PA9.GPIO_Mode=GPIO_MODE_AF_PP @@ -397,13 +392,10 @@ PB3.GPIOParameters=GPIO_Label PB3.GPIO_Label=SWO PB3.Locked=true PB3.Signal=SYS_JTDO-SWO -PB4.GPIOParameters=GPIO_ModeDefaultPP,GPIO_Speed,GPIO_PuPd,GPIO_Label -PB4.GPIO_Label=ARDUINO PWM/D3 -PB4.GPIO_ModeDefaultPP=GPIO_MODE_AF_PP -PB4.GPIO_PuPd=GPIO_NOPULL -PB4.GPIO_Speed=GPIO_SPEED_FREQ_LOW +PB4.GPIOParameters=GPIO_Label +PB4.GPIO_Label=LED3 PB4.Locked=true -PB4.Signal=S_TIM3_CH1 +PB4.Signal=GPIO_Output PB5.GPIOParameters=GPIO_Label PB5.GPIO_Label=ULPI_D7 [USB3320C-EZK_D7] PB5.Locked=true @@ -549,11 +541,6 @@ PD5.GPIO_Label=OTG_FS_PowerSwitchOn [STMPS2141STR_EN] PD5.Locked=true PD5.PinState=GPIO_PIN_SET PD5.Signal=GPIO_Output -PD6.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI -PD6.GPIO_Label=Audio_INT -PD6.GPIO_ModeDefaultEXTI=GPIO_MODE_EVT_RISING -PD6.Locked=true -PD6.Signal=GPXTI6 PD7.GPIOParameters=GPIO_Label PD7.GPIO_Label=SPDIF_RX0 [74LVC1G04SE_4] PD7.Locked=true @@ -752,14 +739,18 @@ PG5.GPIOParameters=GPIO_Label PG5.GPIO_Label=FMC_BA1 [MT48LC4M32B2B5-6A_BA1] PG5.Locked=true PG5.Signal=FMC_A15_BA1 -PG6.GPIOParameters=GPIO_Label -PG6.GPIO_Label=ARDUINO D2 +PG6.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PG6.GPIO_Label=BUTTON3 +PG6.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PG6.GPIO_PuPd=GPIO_PULLUP PG6.Locked=true -PG6.Signal=GPIO_Output -PG7.GPIOParameters=GPIO_Label -PG7.GPIO_Label=ARDUINO D4 +PG6.Signal=GPXTI6 +PG7.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PG7.GPIO_Label=BUTTON2 +PG7.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PG7.GPIO_PuPd=GPIO_PULLUP PG7.Locked=true -PG7.Signal=GPIO_Output +PG7.Signal=GPXTI7 PG8.GPIOParameters=GPIO_Label PG8.GPIO_Label=FMC_SDCLK [MT48LC4M32B2B5-6A_CLK] PG8.Locked=true @@ -819,9 +810,9 @@ PH5.GPIO_Label=FMC_SDNME [MT48LC4M32B2B5-6A_WE] PH5.Locked=true PH5.Signal=FMC_SDNWE PH6.GPIOParameters=GPIO_Label -PH6.GPIO_Label=ARDUINO PWM/D6 +PH6.GPIO_Label=LED1 PH6.Locked=true -PH6.Signal=S_TIM12_CH1 +PH6.Signal=GPIO_Output PH7.GPIOParameters=GPIO_Label PH7.GPIO_Label=LCD_SCL [RK043FN48H-CT672B_SCL] PH7.Locked=true @@ -876,14 +867,18 @@ PI15.GPIO_Label=LCD_R0 [RK043FN48H-CT672B_R0] PI15.Locked=true PI15.Mode=RGB888 PI15.Signal=LTDC_R0 -PI2.GPIOParameters=GPIO_Label -PI2.GPIO_Label=ARDUINO D8 +PI2.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PI2.GPIO_Label=BUTTON0 +PI2.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PI2.GPIO_PuPd=GPIO_PULLUP PI2.Locked=true -PI2.Signal=GPIO_Output -PI3.GPIOParameters=GPIO_Label -PI3.GPIO_Label=ARDUINO D7 +PI2.Signal=GPXTI2 +PI3.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PI3.GPIO_Label=BUTTON1 +PI3.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PI3.GPIO_PuPd=GPIO_PULLUP PI3.Locked=true -PI3.Signal=GPIO_Output +PI3.Signal=GPXTI3 PI4.GPIOParameters=GPIO_Label PI4.GPIO_Label=SAI2_MCLKA [WM8994ECS/R_MCLK1] PI4.Locked=true @@ -1059,7 +1054,7 @@ ProjectManager.StackSize=0x1000 ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC3_Init-ADC3-false-HAL-true,4-MX_CRC_Init-CRC-false-HAL-true,5-MX_DMA2D_Init-DMA2D-false-HAL-true,6-MX_FMC_Init-FMC-false-HAL-true,7-MX_I2C3_Init-I2C3-false-HAL-true,8-MX_LTDC_Init-LTDC-false-HAL-true,9-MX_RTC_Init-RTC-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true,11-MX_TIM1_Init-TIM1-false-HAL-true,12-MX_TIM2_Init-TIM2-false-HAL-true,13-MX_TIM3_Init-TIM3-false-HAL-true,14-MX_TIM5_Init-TIM5-false-HAL-true,15-MX_TIM8_Init-TIM8-false-HAL-true,16-MX_TIM12_Init-TIM12-false-HAL-true,17-MX_USART1_UART_Init-USART1-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC3_Init-ADC3-false-HAL-true,4-MX_CRC_Init-CRC-false-HAL-true,5-MX_DMA2D_Init-DMA2D-false-HAL-true,6-MX_FMC_Init-FMC-false-HAL-true,7-MX_I2C3_Init-I2C3-false-HAL-true,8-MX_LTDC_Init-LTDC-false-HAL-true,9-MX_RTC_Init-RTC-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true,11-MX_TIM1_Init-TIM1-false-HAL-true,12-MX_TIM2_Init-TIM2-false-HAL-true,13-MX_TIM3_Init-TIM3-false-HAL-true,14-MX_TIM5_Init-TIM5-false-HAL-true,15-MX_TIM8_Init-TIM8-false-HAL-true,16-MX_USART1_UART_Init-USART1-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true RCC.AHBFreq_Value=200000000 RCC.APB1CLKDivider=RCC_HCLK_DIV4 RCC.APB1Freq_Value=50000000 @@ -1206,16 +1201,14 @@ SH.FMC_SDNWE.0=FMC_SDNWE,12b-sda1 SH.FMC_SDNWE.ConfNb=1 SH.GPXTI13.0=GPIO_EXTI13 SH.GPXTI13.ConfNb=1 +SH.GPXTI2.0=GPIO_EXTI2 +SH.GPXTI2.ConfNb=1 +SH.GPXTI3.0=GPIO_EXTI3 +SH.GPXTI3.ConfNb=1 SH.GPXTI6.0=GPIO_EXTI6 SH.GPXTI6.ConfNb=1 -SH.S_TIM12_CH1.0=TIM12_CH1,PWM Generation1 CH1 -SH.S_TIM12_CH1.ConfNb=1 -SH.S_TIM1_CH1.0=TIM1_CH1 -SH.S_TIM1_CH1.ConfNb=1 -SH.S_TIM2_CH1_ETR.0=TIM2_CH1,PWM Generation1 CH1 -SH.S_TIM2_CH1_ETR.ConfNb=1 -SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1 -SH.S_TIM3_CH1.ConfNb=1 +SH.GPXTI7.0=GPIO_EXTI7 +SH.GPXTI7.ConfNb=1 SH.S_TIM5_CH4.0=TIM5_CH4,PWM Generation4 CH4 SH.S_TIM5_CH4.ConfNb=1 SPI2.CalculateBaudRate=25.0 MBits/s @@ -1228,12 +1221,6 @@ TIM1.IPParameters=Prescaler,Period,Channel-Output Compare1 No Output,OCMode_1 TIM1.OCMode_1=TIM_OCMODE_TOGGLE TIM1.Period=99 TIM1.Prescaler=199 -TIM12.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 -TIM12.IPParameters=Channel-PWM Generation1 CH1 -TIM2.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 -TIM2.IPParameters=Channel-PWM Generation1 CH1 -TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 -TIM3.IPParameters=Channel-PWM Generation1 CH1 TIM5.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM5.IPParameters=Channel-PWM Generation4 CH4 USART1.IPParameters=VirtualMode-Asynchronous diff --git a/src/platform/f7-disco-gcc/board/buttonscontroller.h b/src/platform/f7-disco-gcc/board/buttonscontroller.h index 68be19a..0feee0b 100644 --- a/src/platform/f7-disco-gcc/board/buttonscontroller.h +++ b/src/platform/f7-disco-gcc/board/buttonscontroller.h @@ -9,6 +9,8 @@ #include "xf/behavior.h" #include "interface/buttonscontrollercallbackcaller.h" +extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); + /** * @brief ButtonsController handles/generates button pressed- and released pressed events. *