From a68b9176cb797144ba05b7e14b331cae386cd4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Tue, 11 Aug 2020 23:21:14 +0200 Subject: [PATCH] Move ADC_TO_RES macro to header file --- stm-firmware/include/reflow-controller/adc-meas.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stm-firmware/include/reflow-controller/adc-meas.h b/stm-firmware/include/reflow-controller/adc-meas.h index 6e8e850..248fd5d 100644 --- a/stm-firmware/include/reflow-controller/adc-meas.h +++ b/stm-firmware/include/reflow-controller/adc-meas.h @@ -94,6 +94,11 @@ */ #define ADC_PT1000_WATCHDOG_SAMPLE_COUNT 25U +/** + * @brief Conversion macro: ADC value to resistance + */ +#define ADC_TO_RES(adc) ((float)(adc) / 4096.0f * 2500.0f) + /** * @brief This function sets up the ADC measurement fo the external PT1000 temperature sensor * @@ -160,6 +165,16 @@ int adc_pt1000_get_current_resistance(float *resistance); */ int adc_pt1000_stream_raw_value_to_memory(volatile float *adc_array, uint32_t length, volatile int *flag_to_set); +/** + * @brief Convert an array of raw adc values to resistance values + * + * In case \p resistance_dest is NULL, the conversion is done inplace in the + * \p raw_source array. + * + * @param resistance_dest Destination. Maybe NULL. + * @param raw_source Source array + * @param count Number of values to convert + */ void adc_pt1000_convert_raw_value_array_to_resistance(float *resistance_dest, float *raw_source, uint32_t count); /**