Compare commits
No commits in common. "2d3b61550bdded263cd1f33e9ce94fc08a9d7312" and "ffe195d7b27faef5c7b3a8fa161c75a58110a672" have entirely different histories.
2d3b61550b
...
ffe195d7b2
@ -36,7 +36,6 @@ static volatile int * volatile streaming_flag_ptr = NULL;
|
||||
static uint32_t filter_startup_cnt;
|
||||
static volatile float adc_pt1000_raw_reading_hf;
|
||||
static volatile uint16_t dma_sample_buffer[ADC_PT1000_DMA_AVG_SAMPLES];
|
||||
static volatile uint32_t adc_watchdog_counter = 0UL;
|
||||
|
||||
volatile float * volatile stream_buffer = NULL;
|
||||
volatile uint32_t stream_count;
|
||||
@ -323,6 +322,7 @@ static inline __attribute__((optimize("O3"))) float adc_pt1000_dma_avg_pre_filte
|
||||
void ADC_IRQHandler(void)
|
||||
{
|
||||
uint32_t adc1_sr;
|
||||
static uint32_t watchdog_errors;
|
||||
|
||||
adc1_sr = ADC1->SR;
|
||||
|
||||
@ -331,12 +331,16 @@ void ADC_IRQHandler(void)
|
||||
pt1000_error |= ADC_PT1000_OVERFLOW;
|
||||
/* Disable ADC in case of overrrun*/
|
||||
adc_pt1000_disable();
|
||||
|
||||
if (!(adc1_sr & ADC_SR_AWD)) {
|
||||
watchdog_errors = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (adc1_sr & ADC_SR_AWD) {
|
||||
ADC1->SR &= ~ADC_SR_AWD;
|
||||
adc_watchdog_counter++;
|
||||
if (adc_watchdog_counter >= ADC_PT1000_WATCHDOG_SAMPLE_COUNT)
|
||||
watchdog_errors++;
|
||||
if (watchdog_errors >= ADC_PT1000_WATCHDOG_SAMPLE_COUNT)
|
||||
pt1000_error |= ADC_PT1000_WATCHDOG_ERROR;
|
||||
}
|
||||
}
|
||||
@ -372,9 +376,6 @@ void DMA2_Stream0_IRQHandler()
|
||||
if (streaming_flag_ptr)
|
||||
append_stream_buffer(adc_val);
|
||||
|
||||
if (adc_watchdog_counter > 0UL)
|
||||
adc_watchdog_counter--;
|
||||
|
||||
/* Call moving average filter */
|
||||
adc_pt1000_filter(adc_val);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@
|
||||
* @brief Number of ADC samples the value has to be outside the Watchdog limit (@ref ADC_PT1000_UPPER_WATCHDOG and @ref ADC_PT1000_LOWER_WATCHDOG)
|
||||
* in order to produce a watchdog error
|
||||
*/
|
||||
#define ADC_PT1000_WATCHDOG_SAMPLE_COUNT 25U
|
||||
#define ADC_PT1000_WATCHDOG_SAMPLE_COUNT 10U
|
||||
|
||||
enum adc_pt1000_error {ADC_PT1000_NO_ERR= 0, ADC_PT1000_WATCHDOG_ERROR=(1UL<<0), ADC_PT1000_OVERFLOW=(1UL<<1), ADC_PT1000_INACTIVE = (1UL<<2)};
|
||||
|
||||
|
@ -274,11 +274,8 @@ static shellmatta_retCode_t shell_cmd_pt1000_res_loop(const shellmatta_handle_t
|
||||
shellmatta_printf(handle, "\x1b[1A\x1b[150D\x1b[K");
|
||||
shell_cmd_pt1000_res(handle, "", 0UL);
|
||||
|
||||
led_set(1, led_status);
|
||||
if (adc_pt1000_check_error() & ADC_PT1000_WATCHDOG_ERROR) {
|
||||
led_set(0, 1);
|
||||
}
|
||||
|
||||
led_set(0, led_status);
|
||||
led_set(1, !led_status);
|
||||
led_status ^= 0x1;
|
||||
|
||||
systick_wait_ms(150);
|
||||
|
Loading…
x
Reference in New Issue
Block a user