Got a timer up and going, and it's firing interrupts! Next up is to change the audio capture to use the interrupt and some buffers. Basically separate the display loop stuff.
This commit is contained in:
parent
54c72734a0
commit
8c308e12c0
9 changed files with 140 additions and 48 deletions
Binary file not shown.
|
@ -181,8 +181,8 @@
|
|||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1815660056" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.1053910009" name="misc.c" rcbsApplicability="disable" resourcePath="src/misc.c" toolsToInvoke="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731.344517310">
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731.344517310" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731"/>
|
||||
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.664833074" name="stm32f4xx_hal_tim_ex.c" rcbsApplicability="disable" resourcePath="system/src/stm32f4-hal/stm32f4xx_hal_tim_ex.c" toolsToInvoke="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731.495344797">
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731.495344797" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731"/>
|
||||
</fileInfo>
|
||||
<folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.608015733" name="/" resourcePath="DSP_Lib">
|
||||
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug.425450735" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug" unusedChildren="">
|
||||
|
@ -765,7 +765,7 @@
|
|||
<sourceEntries>
|
||||
<entry excluding="Source/TransformFunctions/arm_cfft_radix2_q31.c|Source/TransformFunctions/arm_cfft_radix2_q15.c|Source/TransformFunctions/arm_cfft_radix2_init_q31.c|Source/TransformFunctions/arm_cfft_radix2_init_q15.c|Source/TransformFunctions/arm_cfft_radix2_init_f32.c|Source/TransformFunctions/arm_cfft_radix2_f32.c|Source/FastMathFunctions|Source/FilteringFunctions|Source/ControllerFunctions|Source/MatrixFunctions|Source/StatisticsFunctions|Source/SupportFunctions|Source/BasicMathFunctions" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="DSP_Lib"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry excluding="src/stm32f4-hal/stm32f4xx_hal_adc_ex.c|src/stm32f4-hal/stm32f4xx_hal_can.c|src/stm32f4-hal/stm32f4xx_hal_crc.c|src/stm32f4-hal/stm32f4xx_hal_cryp.c|src/stm32f4-hal/stm32f4xx_hal_cryp_ex.c|src/stm32f4-hal/stm32f4xx_hal_dac_ex.c|src/stm32f4-hal/stm32f4xx_hal_dcmi.c|src/stm32f4-hal/stm32f4xx_hal_dma2d.c|src/stm32f4-hal/stm32f4xx_hal_dma_ex.c|src/stm32f4-hal/stm32f4xx_hal_eth.c|src/stm32f4-hal/stm32f4xx_hal_hash.c|src/stm32f4-hal/stm32f4xx_hal_hash_ex.c|src/stm32f4-hal/stm32f4xx_hal_hcd.c|src/stm32f4-hal/stm32f4xx_hal_i2c.c|src/stm32f4-hal/stm32f4xx_hal_i2c_ex.c|src/stm32f4-hal/stm32f4xx_hal_i2s.c|src/stm32f4-hal/stm32f4xx_hal_i2s_ex.c|src/stm32f4-hal/stm32f4xx_hal_irda.c|src/stm32f4-hal/stm32f4xx_hal_ltdc.c|src/stm32f4-hal/stm32f4xx_hal_msp_template.c|src/stm32f4-hal/stm32f4xx_hal_nand.c|src/stm32f4-hal/stm32f4xx_hal_nor.c|src/stm32f4-hal/stm32f4xx_hal_pccard.c|src/stm32f4-hal/stm32f4xx_hal_pcd.c|src/stm32f4-hal/stm32f4xx_hal_rng.c|src/stm32f4-hal/stm32f4xx_hal_rtc.c|src/stm32f4-hal/stm32f4xx_hal_rtc_ex.c|src/stm32f4-hal/stm32f4xx_hal_sai.c|src/stm32f4-hal/stm32f4xx_hal_sd.c|src/stm32f4-hal/stm32f4xx_hal_sdram.c|src/stm32f4-hal/stm32f4xx_hal_smartcard.c|src/stm32f4-hal/stm32f4xx_hal_sram.c|src/stm32f4-hal/stm32f4xx_hal_tim_ex.c|src/stm32f4-hal/stm32f4xx_hal_uart.c|src/stm32f4-hal/stm32f4xx_hal_usart.c|src/stm32f4-hal/stm32f4xx_hal_wwdg.c|src/stm32f4-hal/stm32f4xx_ll_fmc.c|src/stm32f4-hal/stm32f4xx_ll_fsmc.c|src/stm32f4-hal/stm32f4xx_ll_sdmmc.c|src/stm32f4-hal/stm32f4xx_ll_usb.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
|
||||
<entry excluding="src/stm32f4-hal/stm32f4xx_hal_adc_ex.c|src/stm32f4-hal/stm32f4xx_hal_can.c|src/stm32f4-hal/stm32f4xx_hal_crc.c|src/stm32f4-hal/stm32f4xx_hal_cryp.c|src/stm32f4-hal/stm32f4xx_hal_cryp_ex.c|src/stm32f4-hal/stm32f4xx_hal_dac_ex.c|src/stm32f4-hal/stm32f4xx_hal_dcmi.c|src/stm32f4-hal/stm32f4xx_hal_dma2d.c|src/stm32f4-hal/stm32f4xx_hal_dma_ex.c|src/stm32f4-hal/stm32f4xx_hal_eth.c|src/stm32f4-hal/stm32f4xx_hal_hash.c|src/stm32f4-hal/stm32f4xx_hal_hash_ex.c|src/stm32f4-hal/stm32f4xx_hal_hcd.c|src/stm32f4-hal/stm32f4xx_hal_i2c.c|src/stm32f4-hal/stm32f4xx_hal_i2c_ex.c|src/stm32f4-hal/stm32f4xx_hal_i2s.c|src/stm32f4-hal/stm32f4xx_hal_i2s_ex.c|src/stm32f4-hal/stm32f4xx_hal_irda.c|src/stm32f4-hal/stm32f4xx_hal_ltdc.c|src/stm32f4-hal/stm32f4xx_hal_msp_template.c|src/stm32f4-hal/stm32f4xx_hal_nand.c|src/stm32f4-hal/stm32f4xx_hal_nor.c|src/stm32f4-hal/stm32f4xx_hal_pccard.c|src/stm32f4-hal/stm32f4xx_hal_pcd.c|src/stm32f4-hal/stm32f4xx_hal_rng.c|src/stm32f4-hal/stm32f4xx_hal_rtc.c|src/stm32f4-hal/stm32f4xx_hal_rtc_ex.c|src/stm32f4-hal/stm32f4xx_hal_sai.c|src/stm32f4-hal/stm32f4xx_hal_sd.c|src/stm32f4-hal/stm32f4xx_hal_sdram.c|src/stm32f4-hal/stm32f4xx_hal_smartcard.c|src/stm32f4-hal/stm32f4xx_hal_sram.c|src/stm32f4-hal/stm32f4xx_hal_uart.c|src/stm32f4-hal/stm32f4xx_hal_usart.c|src/stm32f4-hal/stm32f4xx_hal_wwdg.c|src/stm32f4-hal/stm32f4xx_ll_fmc.c|src/stm32f4-hal/stm32f4xx_ll_fsmc.c|src/stm32f4-hal/stm32f4xx_ll_sdmmc.c|src/stm32f4-hal/stm32f4xx_ll_usb.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>test</name>
|
||||
<name>PSDR</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-45507388147428524" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1219008118595482184" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="11201525484003179" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1162299204964050481" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "stm32f4xx.h"
|
||||
//#include "core_cmInstr.h"
|
||||
#include <stdio.h>
|
||||
#include "stddef.h"
|
||||
#include "diag/Trace.h"
|
||||
#include "hal.h"
|
||||
#include "adc.h"
|
||||
|
@ -24,3 +25,4 @@
|
|||
#include "stm32f4xx_hal_cortex.h"
|
||||
#include "misc.h"
|
||||
|
||||
TIM_HandleTypeDef TimHandle;
|
||||
|
|
|
@ -288,9 +288,9 @@ Adafruit_GFX_drawTriangle(121,119,131,124,131,114,ILI9340_WHITE);
|
|||
Adafruit_GFX_write('.');
|
||||
|
||||
|
||||
TIM_setup();
|
||||
TIM_Config();
|
||||
|
||||
//TIM_setup();
|
||||
//TIM_Config();
|
||||
TIM_Try();
|
||||
Adafruit_ILI9340_setVerticalScrollDefinition(200,120,0);
|
||||
long long timeMeasurement = 0;
|
||||
while(1)
|
||||
|
@ -506,8 +506,9 @@ counter = 0;
|
|||
}
|
||||
|
||||
//TIM_TimeBaseInitTypeDef timeBaseStructure;
|
||||
TIM_HandleTypeDef TimHandle;
|
||||
//TIM_OC_InitTypeDef tsConfig;
|
||||
|
||||
TIM_OC_InitTypeDef tsConfig;
|
||||
#define PULSE1_VALUE 40961 /* Capture Compare 1 Value */
|
||||
uint32_t uwPrescalerValue = 0;
|
||||
void TIM_setup()
|
||||
{
|
||||
|
@ -555,6 +556,30 @@ void TIM_setup()
|
|||
doNothing();
|
||||
}
|
||||
|
||||
/*##-2- Configure the PWM channels #########################################*/
|
||||
/* Common configuration */
|
||||
tsConfig.OCMode = TIM_OCMODE_TIMING;
|
||||
tsConfig.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
tsConfig.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
|
||||
/* Set the pulse value for channel 1 */
|
||||
tsConfig.Pulse = PULSE1_VALUE;
|
||||
if(HAL_TIM_OC_ConfigChannel(&TimHandle, &tsConfig, TIM_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
/* Initialization Error */
|
||||
//Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
/*##-4- Start the Output Compare mode in interrupt mode ####################*/
|
||||
/* Start Channel1 */
|
||||
if(HAL_TIM_OC_Start_IT(&TimHandle, TIM_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
/* Initialization Error */
|
||||
//Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -581,7 +606,58 @@ void TIM_Config(void)
|
|||
|
||||
}
|
||||
|
||||
TIM_TypeDef timTimBase;
|
||||
//TIM_HandleTypeDef timHandle;
|
||||
/* Definition for TIMx's NVIC */
|
||||
#define TIMx_IRQn TIM3_IRQn
|
||||
#define TIMx_IRQHandler TIM3_IRQHandler
|
||||
void TIM_Try(void)
|
||||
{
|
||||
|
||||
uwPrescalerValue = (uint32_t) ((SystemCoreClock/2) / 60000) - 1;
|
||||
|
||||
//NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
|
||||
__TIM3_CLK_ENABLE();
|
||||
TimHandle.Instance = TIM3;
|
||||
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
TimHandle.Init.Period = 65535;
|
||||
TimHandle.Init.Prescaler = uwPrescalerValue;
|
||||
TimHandle.Init.ClockDivision = 0;
|
||||
HAL_TIM_Base_Init(&TimHandle);
|
||||
|
||||
HAL_TIM_Base_Start_IT(&TimHandle);
|
||||
|
||||
/*##-2- Configure the NVIC for TIMx #########################################*/
|
||||
/* Set the TIMx priority */
|
||||
HAL_NVIC_SetPriority(TIMx_IRQn, 0, 1);
|
||||
|
||||
/* Enable the TIMx global Interrupt */
|
||||
HAL_NVIC_EnableIRQ(TIMx_IRQn);
|
||||
|
||||
|
||||
// int tim3;
|
||||
// while(1)
|
||||
// {
|
||||
// tim3 = timTryHandle.Instance->CNT;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
int ledState = 0;
|
||||
HAL_TIM_PeriodElapsedCallback(htim)
|
||||
{
|
||||
doNothing();
|
||||
if(ledState)
|
||||
{
|
||||
blink_led_off();
|
||||
ledState = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
blink_led_on();
|
||||
ledState = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
|
|
|
@ -149,6 +149,8 @@ __attribute__((weak)) void SysTick_Handler(void)
|
|||
/* STM32F4xx Peripherals Interrupt Handlers */
|
||||
/******************************************************************************/
|
||||
|
||||
extern TIM_HandleTypeDef TimHandle;
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM3 global interrupt request.
|
||||
* @param None
|
||||
|
@ -156,44 +158,54 @@ __attribute__((weak)) void SysTick_Handler(void)
|
|||
*/
|
||||
void TIM3_IRQHandler(void)
|
||||
{
|
||||
doNothing();
|
||||
// if (TIM_GetITStatus(TIM3, TIM_IT_CC1) != RESET)
|
||||
// {
|
||||
// TIM_ClearITPendingBit(TIM3, TIM_IT_CC1);
|
||||
//
|
||||
// /* LED1 toggling with frequency = 73.24 Hz */
|
||||
// //STM_EVAL_LEDToggle(LED1);
|
||||
// capture = TIM_GetCapture1(TIM3);
|
||||
// TIM_SetCompare1(TIM3, capture + CCR1_Val);
|
||||
// }
|
||||
// else if (TIM_GetITStatus(TIM3, TIM_IT_CC2) != RESET)
|
||||
// {
|
||||
// TIM_ClearITPendingBit(TIM3, TIM_IT_CC2);
|
||||
//
|
||||
// /* LED2 toggling with frequency = 109.8 Hz */
|
||||
// //STM_EVAL_LEDToggle(LED2);
|
||||
// capture = TIM_GetCapture2(TIM3);
|
||||
// TIM_SetCompare2(TIM3, capture + CCR2_Val);
|
||||
// }
|
||||
// else if (TIM_GetITStatus(TIM3, TIM_IT_CC3) != RESET)
|
||||
// {
|
||||
// TIM_ClearITPendingBit(TIM3, TIM_IT_CC3);
|
||||
//
|
||||
// /* LED3 toggling with frequency = 219.7 Hz */
|
||||
// //STM_EVAL_LEDToggle(LED3);
|
||||
// capture = TIM_GetCapture3(TIM3);
|
||||
// TIM_SetCompare3(TIM3, capture + CCR3_Val);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TIM_ClearITPendingBit(TIM3, TIM_IT_CC4);
|
||||
//
|
||||
// /* LED4 toggling with frequency = 439.4 Hz */
|
||||
// // STM_EVAL_LEDToggle(LED4);
|
||||
// capture = TIM_GetCapture4(TIM3);
|
||||
// TIM_SetCompare4(TIM3, capture + CCR4_Val);
|
||||
// }
|
||||
HAL_TIM_IRQHandler(&TimHandle);
|
||||
}
|
||||
//void TIM3_IRQHandler(void)
|
||||
//{
|
||||
// __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);
|
||||
// doNothing();
|
||||
//// if (TIM_GetITStatus(TIM3, TIM_IT_CC1) != RESET)
|
||||
//// {
|
||||
//// TIM_ClearITPendingBit(TIM3, TIM_IT_CC1);
|
||||
////
|
||||
//// /* LED1 toggling with frequency = 73.24 Hz */
|
||||
//// //STM_EVAL_LEDToggle(LED1);
|
||||
//// capture = TIM_GetCapture1(TIM3);
|
||||
//// TIM_SetCompare1(TIM3, capture + CCR1_Val);
|
||||
//// }
|
||||
//// else if (TIM_GetITStatus(TIM3, TIM_IT_CC2) != RESET)
|
||||
//// {
|
||||
//// TIM_ClearITPendingBit(TIM3, TIM_IT_CC2);
|
||||
////
|
||||
//// /* LED2 toggling with frequency = 109.8 Hz */
|
||||
//// //STM_EVAL_LEDToggle(LED2);
|
||||
//// capture = TIM_GetCapture2(TIM3);
|
||||
//// TIM_SetCompare2(TIM3, capture + CCR2_Val);
|
||||
//// }
|
||||
//// else if (TIM_GetITStatus(TIM3, TIM_IT_CC3) != RESET)
|
||||
//// {
|
||||
//// TIM_ClearITPendingBit(TIM3, TIM_IT_CC3);
|
||||
////
|
||||
//// /* LED3 toggling with frequency = 219.7 Hz */
|
||||
//// //STM_EVAL_LEDToggle(LED3);
|
||||
//// capture = TIM_GetCapture3(TIM3);
|
||||
//// TIM_SetCompare3(TIM3, capture + CCR3_Val);
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// TIM_ClearITPendingBit(TIM3, TIM_IT_CC4);
|
||||
////
|
||||
//// /* LED4 toggling with frequency = 439.4 Hz */
|
||||
//// // STM_EVAL_LEDToggle(LED4);
|
||||
//// capture = TIM_GetCapture4(TIM3);
|
||||
//// TIM_SetCompare4(TIM3, capture + CCR4_Val);
|
||||
//// }
|
||||
//}
|
||||
|
||||
//void TIM3_IRQn(void)
|
||||
//{
|
||||
// doNothing();
|
||||
//}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32F4xx Peripherals Interrupt Handlers */
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stddef.h"
|
||||
|
||||
/** @addtogroup STM32F4xx_HAL_Driver
|
||||
* @{
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stddef.h"
|
||||
|
||||
/** @addtogroup STM32F4xx_HAL_Driver
|
||||
* @{
|
||||
|
|
Loading…
Reference in a new issue