This commit is contained in:
2023-11-08 20:06:03 +01:00
parent a7ccf2ce66
commit 53e8d774c8
7 changed files with 61 additions and 60 deletions

File diff suppressed because one or more lines are too long

6
.vscode/launch.json vendored
View File

@@ -6,8 +6,8 @@
"configurations": [
{
"name": "Cortex Debug Nucloe",
"cwd": "${workspaceFolder}/func_gen_stm32f303re_nucleo/",
"executable": "./build/func_gen_stm32f303re_nucleo.elf",
"cwd": "${workspaceFolder}",
"executable": "${workspaceFolder}/build/${workspaceFolderBasename}.elf",
"request": "launch",
"type": "cortex-debug",
"runToEntryPoint": "main",
@@ -24,7 +24,7 @@
"label": "RTT stdout",
"port": 0,
"type": "console",
"timestamp": true
"timestamp": false
},
// {
// "label": "RTT graph",

View File

@@ -54,7 +54,7 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin : PC13 */
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

View File

@@ -47,7 +47,7 @@
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
uint8_t data_ready;
uint8_t data_ready = 1;
uint32_t soft_timer;
uint16_t adc_data[ADC_DATA_LENGHT];
/* USER CODE END PV */
@@ -101,7 +101,7 @@ int main(void)
MX_NVIC_Init();
/* USER CODE BEGIN 2 */
soft_timer = HAL_GetTick();
// HAL_ADC_Start_DMA(&hadc1, adc_data, ADC_DATA_LENGHT);
HAL_ADC_Start_DMA(&hadc1, adc_data, ADC_DATA_LENGHT);
HAL_TIM_OnePulse_Start(&htim15, TIM_CHANNEL_1);
/* USER CODE END 2 */
@@ -114,7 +114,7 @@ int main(void)
data_ready = 0;
for (uint8_t i = 0; i < ADC_DATA_LENGHT; i++)
{
SEGGER_RTT_printf(0, "%02d: %d\n", i, adc_data[i]);
SEGGER_RTT_printf(0, "%02d %d\n", i, adc_data[i]);
}
}
/* USER CODE END WHILE */
@@ -191,7 +191,7 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
void HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == 13 && soft_timer + 50 < HAL_GetTick())
if (GPIO_Pin == GPIO_PIN_13 && soft_timer + 50 < HAL_GetTick())
{
soft_timer = HAL_GetTick();
__HAL_TIM_ENABLE(&htim15);

View File

@@ -43,7 +43,7 @@ void MX_TIM15_Init(void)
/* USER CODE END TIM15_Init 1 */
htim15.Instance = TIM15;
htim15.Init.Prescaler = 19999;
htim15.Init.Prescaler = 124;
htim15.Init.CounterMode = TIM_COUNTERMODE_UP;
htim15.Init.Period = 31;
htim15.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
@@ -99,7 +99,6 @@ void MX_TIM15_Init(void)
/* USER CODE END TIM15_Init 2 */
HAL_TIM_MspPostInit(&htim15);
}
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *tim_baseHandle)
@@ -153,7 +152,6 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
/* USER CODE END TIM15_MspPostInit 1 */
}
}
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *tim_baseHandle)

View File

@@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Mon Nov 06 20:23:19 CET 2023]
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Mon Nov 06 21:32:00 CET 2023]
##########################################################################################################################
# ------------------------------------------------
@@ -129,6 +129,7 @@ C_INCLUDES = \
-IDrivers/STM32G0xx_HAL_Driver/Inc \
-IDrivers/STM32G0xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32G0xx/Include \
-IDrivers/CMSIS/Include \
-IDrivers/CMSIS/Include
C_INCLUDES += -Iutils/rtt

View File

@@ -101,6 +101,8 @@ PA5.GPIO_Speed=GPIO_SPEED_FREQ_LOW
PA5.Locked=true
PA5.Signal=GPIO_Output
PC1.Signal=S_TIM15_CH1
PC13.GPIOParameters=GPIO_ModeDefaultEXTI
PC13.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
PC13.Locked=true
PC13.Signal=GPXTI13
PC14-OSC32_IN\ (PC14).Locked=true