3. Analyzing The Demonstration Example
This section analyzes an application example which demonstrates using the GPADC adapters. The example is based on the freertos_retarget sample code found in the SDK. It adds one additional freeRTOS task which is responsible for performing analog-to-digital measurements on a dedicated pin on Pro DevKit (P1_00). Both synchronous and asynchronous GPADC operations are demonstrated.
3.1. Application Structure
The key goal of this demonstration is for the device to perform a few GPADC operations in the task. Depending on the value of the USER_GPADC_SYNC_EN
macro, a synchronous or an asynchronous GPADC operation is selected. At the end of the measurement, the raw ADC value is converted into millivolt (mV) and a debugging message with the converted data is sent to the serial console.
Note
It is essential that developers must not call asynchronous related APIs without guaranteeing that the previous asynchronous transaction is finished. To ensure this, after triggering an asynchronous GPADC operation, the calling task blocks its execution until the arrival of a freeRTOS signal, indicating the end of the current GPADC operation.
Note
The tutorial for freertos_retarget example is recommended for getting start with new project.

Figure 5 GPADC Conversions SW FSM - Main Execution Path