|
|
@@ -27,6 +27,7 @@
|
|
|
#include "../scope_app_i.h"
|
|
|
#include "flipperscope_icons.h"
|
|
|
|
|
|
+#define USE_TIMEOUT 0
|
|
|
#define DIGITAL_SCALE_12BITS ((uint32_t)0xFFF)
|
|
|
#define VAR_CONVERTED_DATA_INIT_VALUE (DIGITAL_SCALE_12BITS + 1)
|
|
|
#define VAR_CONVERTED_DATA_INIT_VALUE_16BITS (0xFFFF + 1U)
|
|
|
@@ -294,7 +295,7 @@ void AdcDmaTransferHalf_Callback() {
|
|
|
|
|
|
void Activate_ADC(void) {
|
|
|
__IO uint32_t wait_loop_index = 0U;
|
|
|
-#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
|
|
|
+#if(USE_TIMEOUT == 1)
|
|
|
uint32_t Timeout = 0U; /* Variable used for timeout management */
|
|
|
#endif /* USE_TIMEOUT */
|
|
|
if(LL_ADC_IsEnabled(ADC1) == 0) {
|
|
|
@@ -307,12 +308,12 @@ void Activate_ADC(void) {
|
|
|
}
|
|
|
LL_ADC_StartCalibration(ADC1, LL_ADC_SINGLE_ENDED);
|
|
|
|
|
|
-#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
|
|
|
+#if(USE_TIMEOUT == 1)
|
|
|
Timeout = ADC_CALIBRATION_TIMEOUT_MS;
|
|
|
#endif /* USE_TIMEOUT */
|
|
|
|
|
|
while(LL_ADC_IsCalibrationOnGoing(ADC1) != 0) {
|
|
|
-#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
|
|
|
+#if(USE_TIMEOUT == 1)
|
|
|
if(LL_SYSTICK_IsActiveCounterFlag()) {
|
|
|
if(Timeout-- == 0) {
|
|
|
}
|
|
|
@@ -324,11 +325,11 @@ void Activate_ADC(void) {
|
|
|
wait_loop_index--;
|
|
|
}
|
|
|
LL_ADC_Enable(ADC1);
|
|
|
-#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
|
|
|
+#if(USE_TIMEOUT == 1)
|
|
|
Timeout = ADC_ENABLE_TIMEOUT_MS;
|
|
|
#endif /* USE_TIMEOUT */
|
|
|
while(LL_ADC_IsActiveFlag_ADRDY(ADC1) == 0) {
|
|
|
-#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
|
|
|
+#if(USE_TIMEOUT == 1)
|
|
|
/* Check Systick counter flag to decrement the time-out value */
|
|
|
if(LL_SYSTICK_IsActiveCounterFlag()) {
|
|
|
if(Timeout-- == 0) {
|