Tue, 26 Sep 2023 14:56:04 +0200
Migrated ADC converter to isp-idf v5.1
/** * @file task_adc.h * @brief The FreeRTOS task to query the pressure sensors connected to * ADC inputs. * The task will update the ADC_State structure. */ #ifndef _TASK_ADC_H #define _TASK_ADC_H /* * Error codes in this task */ #define ADC_ERR_NONE 0 ///< No errors #define ADC_ERR_READ 1 ///< Generic read error /** * @brief Pressure sensors */ typedef struct strPressure { bool valid; ///< Valid measurement adc_channel_t channel; ///< Channel adc_atten_t atten; ///< Attenuation uint32_t voltage; ///< Voltage measured int error; ///< Error result } pressure_t; /** * @brief Structure containing the variables for the ADC task. */ typedef struct { pressure_t Pressure[3]; ///< Pressure sensors uint32_t Batt_voltage; ///< Battery voltage int Batt_error; ///< Battery error state } ADC_State; /** * @brief Request a new measurement */ void request_adc(void); /** * @brief Check if results are ready * @return true of results are ready, else false. */ bool ready_adc(void); /** * @brief The FreeRTOS task to update the pressure sensors on request. * @param pvParameters Parameters for the task. */ void task_adc(void *pvParameters); #endif