Тесты фильтрования

Оно добавляют задержку и сдвиг по фазе надо чет думать
This commit is contained in:
2025-11-10 07:50:18 +03:00
parent 79ff2667c4
commit 4491f11b3d
21 changed files with 471 additions and 87 deletions

View File

@@ -27,7 +27,7 @@
#endif
#ifndef __STATIC_FORCEINLINE
#define __STATIC_FORCEINLINE static __forceinline
#define __STATIC_FORCEINLINE //static __forceinline
#endif
#ifndef __NO_RETURN

View File

@@ -311,21 +311,6 @@ uint32_t ADC_Get_Sequence_Channel(ADC_TypeDef* ADCx, uint32_t rank)
}
}
/////////////////////////////---DMA FUNCTIONS---///////////////////////////////
void ADC_DMA_Sim_Transfer(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS)
{
if (!ADCS->dma_buffer || ADCS->dma_buffer_size == 0) return;
ADCS->dma_buffer[ADCS->dma_current_index] = ADCx->DR;
ADCS->dma_current_index++;
if (ADCS->dma_current_index >= ADCS->dma_buffer_size) {
if (ADCS->dma_circular) {
ADCS->dma_current_index = 0;
}
}
}
/////////////////////////////---CHANNEL FUNCTIONS---///////////////////////////
void ADC_Set_Channel_Value(ADC_TypeDef* ADCx, uint32_t channel, double voltage)
{

View File

@@ -9,7 +9,7 @@
#endif
#ifdef STM32F4
#define ADC_NOISE_LSB 10 // Шум в LSB (квантах АЦП)
#define ADC_NOISE_LSB 20 // Шум в LSB (квантах АЦП)
#endif
/////////////////////////////---STRUCTURES---///////////////////////////
@@ -23,12 +23,6 @@ struct ADC_Sim
double channel_values[19];
uint8_t channel_connected[19];
// DMA
uint32_t* dma_buffer;
uint32_t dma_buffer_size;
uint32_t dma_current_index;
uint8_t dma_circular;
// Timing
double simulation_step;
double adc_clock_freq;

View File

@@ -65,6 +65,9 @@ void Overflow_Check(TIM_TypeDef* TIMx, struct TIM_Sim* TIMS)
else if (TIMS->tx_cnt < 0)
TIMS->tx_cnt += TIMS->RELOAD+1;
if(TIMS->tx_step > TIMS->RELOAD)
TIMS->tx_cnt = 0;
TIM_Call_IRQHandller(TIMx); // call HANDLER
}
}