FIX&ENH: rotary driver works!

ADD: three pins for current strength values

FIX: ADC1->ADC2

ENH: prepare for UART

FIX&ADD: add USART print, add extra_script to print floats to COM port #2

ADD: some func #2

Rebuild project structure

ADD: .clang-format file

ENG: use flag

ADD: USART1

FIX: .ioc

FIX: .ioc

ADD: debug script to angle value

ADD: gitlab-ci

ADD: gitlab CI

ADD: gitlab-ci

FIX: gitlab-ci

ADD&FIX: all sensors work! (or not?)
This commit is contained in:
vanyabeat 2024-01-17 19:33:35 +03:00
parent d1b0ed0858
commit 8157b41ea9
23 changed files with 673 additions and 339 deletions

View file

@ -1,20 +1,20 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2024 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) 2024 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 ------------------------------------------------------------------*/
@ -55,10 +55,11 @@
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern ADC_HandleTypeDef hadc2;
extern SPI_HandleTypeDef hspi2;
extern TIM_HandleTypeDef htim3;
extern bool tim3_semaphore;
/* USER CODE BEGIN EV */
volatile FlagStatus flag_10kHz = RESET;
/* USER CODE END EV */
/******************************************************************************/
@ -207,7 +208,7 @@ void ADC_IRQHandler(void)
/* USER CODE BEGIN ADC_IRQn 0 */
/* USER CODE END ADC_IRQn 0 */
HAL_ADC_IRQHandler(&hadc2);
/* USER CODE BEGIN ADC_IRQn 1 */
/* USER CODE END ADC_IRQn 1 */
@ -246,7 +247,7 @@ void TIM1_CC_IRQHandler(void)
void TIM2_IRQHandler(void)
{
/* USER CODE BEGIN TIM2_IRQn 0 */
/* USER CODE END TIM2_IRQn 0 */
/* USER CODE BEGIN TIM2_IRQn 1 */
@ -259,23 +260,39 @@ void TIM2_IRQHandler(void)
void TIM3_IRQHandler(void)
{
/* USER CODE BEGIN TIM3_IRQn 0 */
// BLink Led1
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
if (__HAL_TIM_GET_FLAG(&htim3, TIM_FLAG_UPDATE) != RESET)
// Check if update interrupt flag is set
if (__HAL_TIM_GET_FLAG(&htim3, TIM_FLAG_UPDATE) != RESET)
{
if (__HAL_TIM_GET_IT_SOURCE(&htim3, TIM_IT_UPDATE) != RESET)
{
if (__HAL_TIM_GET_IT_SOURCE(&htim3, TIM_IT_UPDATE) != RESET)
{
__HAL_TIM_CLEAR_IT(&htim3, TIM_IT_UPDATE);
tim3_semaphore = true;
}
// Clear update interrupt flag
__HAL_TIM_CLEAR_IT(&htim3, TIM_IT_UPDATE);
// Toggle or set the flag
flag_10kHz = SET;
}
}
/* USER CODE END TIM3_IRQn 0 */
HAL_TIM_IRQHandler(&htim3);
/* USER CODE BEGIN TIM3_IRQn 1 */
/* USER CODE END TIM3_IRQn 1 */
}
/**
* @brief This function handles SPI2 global interrupt.
*/
void SPI2_IRQHandler(void)
{
/* USER CODE BEGIN SPI2_IRQn 0 */
/* USER CODE END SPI2_IRQn 0 */
HAL_SPI_IRQHandler(&hspi2);
/* USER CODE BEGIN SPI2_IRQn 1 */
/* USER CODE END SPI2_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */