ADC PT1000 Measurement progress

This commit is contained in:
2020-02-02 20:24:44 +01:00
parent 8af10dd52c
commit 850d84140e
3 changed files with 186 additions and 117 deletions

View File

@@ -19,7 +19,9 @@
#define ADC_PT1000_PIN 2
#define ADC_FILTER_STARTUP_CYCLES 200
#define ADC_FILTER_STARTUP_CYCLES 800
#define ADC_PT1000_SAMPLE_CNT_DELAY 2000
/**
* @brief Lower value for valid input range for PT1000 measurement
@@ -35,7 +37,7 @@
*/
#define ADC_PT1000_UPPER_WATCHDOG 4000
enum adc_p1000_error {ADC_PT1000_NO_ERR= 0, ADC_PT1000_WATCHDOG_ERROR=-1, ADC_PT1000_OVERFLOW=2};
enum adc_pt1000_error {ADC_PT1000_NO_ERR= 0, ADC_PT1000_WATCHDOG_ERROR=(1UL<<0), ADC_PT1000_OVERFLOW=(1UL<<1)};
/**
* @brief This function sets up the ADC measurement fo the external PT1000 temperature sensor
@@ -86,8 +88,7 @@ void adc_pt1000_get_resistance_calibration(float *offset, float *sensitivity_dev
* If the reistance calibration is enabled, this function applies the calculations of the raw reistance reading and
* returns the corrected value.
*
* If an ADC error is set, the status is negative. If the ADC is in streaming mode, the reistance reading is disabled and
* the status is 1. The status is 2 during the first measurements with a given filter setting. Technically, the resistance value is
* If an ADC error is set, the status is negative. The status is 2 during the first measurements with a given filter setting. Technically, the resistance value is
* correct but the filter is not stable yet.
* Use adc_pt1000_check_error to check the error and reinitialize the ADC.
*
@@ -102,7 +103,6 @@ int adc_pt1000_get_current_resistance(float *resistance);
*
* Streaming is done using DMA2 Stream0.
* This function is used for gathering fullspeed sampling data for external interfaces or calibration
* During streaming, the adc_pt1000_get_current_resistance() function will return an error
*
* @param adc_array Array to stream data to
* @param length Amount of data points to be measured
@@ -118,8 +118,10 @@ void adc_pt1000_convert_raw_value_array_to_resistance(float *resistance_dest, ui
*
* In case of an error, it may be necessary to call adc_pt1000_setup_meas() again in order to recover from the error
*/
enum adc_p1000_error adc_pt1000_check_error();
enum adc_pt1000_error adc_pt1000_check_error();
void adc_pt1000_clear_error();
void adc_pt1000_disable();
#endif // __ADCMEAS_H__