Analog input with AD converter calibration for STM32F1 and STM32F3 boards.
Diff: AnalogInCal.h
- Revision:
- 1:e4bcfca7d2df
- Parent:
- 0:99f4dfbbb498
--- a/AnalogInCal.h Sat Nov 18 14:26:35 2017 +0000 +++ b/AnalogInCal.h Mon Nov 20 18:37:17 2017 +0000 @@ -2,17 +2,18 @@ #define ANALOGINCAL_H /* Analog input with AD converter calibration for STM32F1 and STM32F3 boards. + * * Substitutes AnalogIn. * */ -#include "mbed.h" +#include "AnalogIn.h" class AnalogInCal : public AnalogIn { public: - /** Creates an AnalogIn, connected to the specified pin + /** Creates an AnalogInCal, connected to the specified pin * * @param pin AnalogIn pin to connect to * @param cal Flag to request calibration. Defaults to true. @@ -28,13 +29,12 @@ void calibrate() { lock(); #if defined(TARGET_STM32F1) - while(HAL_ADCEx_Calibration_Start(&(_adc.handle)) != HAL_OK); + while (HAL_ADCEx_Calibration_Start(&(_adc.handle)) != HAL_OK); #elif defined(TARGET_STM32F3) - while(HAL_ADCEx_Calibration_Start(&(_adc.handle), ADC_SINGLE_ENDED) != HAL_OK); + while (HAL_ADCEx_Calibration_Start(&(_adc.handle), ADC_SINGLE_ENDED) != HAL_OK); #endif unlock(); } - }; #endif // ANALOGINCAL_H