no-OS
|
Functions | |
int | pqm_measurement_init (void) |
Initializes Power Quality Measurement. More... | |
int | pqm_start_measurement (bool waitingForSync) |
Starts Power Quality measurement as per configured cycles. More... | |
int | pqm_one_cycle (void) |
One complete cycle for IIO callback function. More... | |
int | open_pqlib (PQLIB_EXAMPLE *pExample) |
Call adi_pqlib_Open with required buffers. Serves as an example how to call adi_pqlib_Open API. More... | |
int | config_measurement (PQLIB_EXAMPLE *pExample) |
Configures AFE and the library . This serves as an example on how to call APIs adi_pqlib_SetConfig and adi_pqlib_SetCorrectionCoefficients. More... | |
int | process_and_prepare_output () |
The function gets AFE input and calls main processing APIs of the library. This also gets the measurement parameter output from the library and displays it on the console. More... | |
int | cpy_correction_coeffs (ADI_PQLIB_NOMINAL_FREQUENCY nominalFrequency, ADI_PQLIB_CORR_COEF *pCorrCoef) |
Copies the user provided correction factors to the interface structure. This shows how floating point correction factors can be converted to the format required by adi_pqlib_SetCorrectionCoefficients Requires both current and voltage pointers should be populated. The code assumes numCorrCoef is same for both and if it is less than 40 these are last 'N' coefficients. More... | |
void | populate_event_config (EXAMPLE_CONFIG *pExampleConfig) |
Populates event configuration using user configuration Serves as an example on how to convert thresholds and hysteresis to the form required by the API. More... | |
int | wait_for_zero_crossing (PQLIB_EXAMPLE *pExample, ADI_PQLIB_RESULT pqlibStatus) |
Looks at the return code from library and checks whether there is a zero crossing timeout. This is only needed for testing. We wanted to know when actual signal comes and start monitoring test output only after a predefined settling time. More... | |
int | process_pqlib_error (PQLIB_EXAMPLE *pExample, ADI_PQLIB_RESULT pqlibStatus) |
Prints error message for errors from the library. Serves as an examples on how to handle the errors from the library. More... | |
void | set_default_config (EXAMPLE_CONFIG *pConfig) |
Sets default configuration of the example as floating points Note that this function doesn't configure the library or AFE. More... | |
int | SyncLibTime (PQLIB_EXAMPLE *pExample, bool checkRtcTime) |
Sets library internal time using RTC time. Serves as an example how to call the APIs. This also syncs the library time to the user provided time. More... | |
void | SyncToDip (PQLIB_EXAMPLE *pExample, ADI_PQLIB_RESULT pqlibStatus) |
Sync the time to a dip or interruption event. Serves as an example how to sync to an external time event. More... | |
Variables | |
PQLIB_EXAMPLE | pqlibExample |
volatile uint8_t | newSyncTimeAvailable = 0 |
volatile bool | configChanged |
int config_measurement | ( | PQLIB_EXAMPLE * | pExample | ) |
Configures AFE and the library . This serves as an example on how to call APIs adi_pqlib_SetConfig and adi_pqlib_SetCorrectionCoefficients.
[in] | pExample | - Pointer to structure for example configurations. |
int cpy_correction_coeffs | ( | ADI_PQLIB_NOMINAL_FREQUENCY | nominalFrequency, |
ADI_PQLIB_CORR_COEF * | pCorrCoef | ||
) |
Copies the user provided correction factors to the interface structure. This shows how floating point correction factors can be converted to the format required by adi_pqlib_SetCorrectionCoefficients Requires both current and voltage pointers should be populated. The code assumes numCorrCoef is same for both and if it is less than 40 these are last 'N' coefficients.
[in] | nominalFrequency | - structure for nominal frequency |
[in] | pCorrCoef | - pointer to structure for correctionCoefficients |
int open_pqlib | ( | PQLIB_EXAMPLE * | pExample | ) |
Call adi_pqlib_Open with required buffers. Serves as an example how to call adi_pqlib_Open API.
[in] | pExample | - Pointer to main example structure. |
void populate_event_config | ( | EXAMPLE_CONFIG * | pExampleConfig | ) |
Populates event configuration using user configuration Serves as an example on how to convert thresholds and hysteresis to the form required by the API.
[in] | pExampleConfig | - pointer to structure for example configurations. |
int pqm_measurement_init | ( | void | ) |
Initializes Power Quality Measurement.
int pqm_one_cycle | ( | void | ) |
One complete cycle for IIO callback function.
int pqm_start_measurement | ( | bool | waitingForSync | ) |
Starts Power Quality measurement as per configured cycles.
[in] | waitingForSync | - Flag to indicate whether the code should look for a sync event to synchronize the RTC time. |
int process_and_prepare_output | ( | ) |
The function gets AFE input and calls main processing APIs of the library. This also gets the measurement parameter output from the library and displays it on the console.
This serves as an example for the APIs adi_pqlib_ProcessOneCycle adi_pqlib_ProcessWaveform adi_pqlib_Process1012Cycles adi_pqlib_GetOutputStatus
int process_pqlib_error | ( | PQLIB_EXAMPLE * | pExample, |
ADI_PQLIB_RESULT | pqlibStatus | ||
) |
Prints error message for errors from the library. Serves as an examples on how to handle the errors from the library.
[in] | pExample | - Pointer to PQLIB_EXAMPLE structure. |
[in] | pqlibStatus | - return code for the library. |
void set_default_config | ( | EXAMPLE_CONFIG * | pConfig | ) |
Sets default configuration of the example as floating points Note that this function doesn't configure the library or AFE.
[in] | pConfig | - Pointer to example configuration structure. |
int SyncLibTime | ( | PQLIB_EXAMPLE * | pExample, |
bool | checkRtcTime | ||
) |
Sets library internal time using RTC time. Serves as an example how to call the APIs. This also syncs the library time to the user provided time.
[in] | pExample | - Pointer to example structure. |
[in] | checkRtcTime | - Checks RTC time. |
void SyncToDip | ( | PQLIB_EXAMPLE * | pExample, |
ADI_PQLIB_RESULT | pqlibStatus | ||
) |
Sync the time to a dip or interruption event. Serves as an example how to sync to an external time event.
[in] | pExample | - Pointer to example structure. |
[in] | pqlibStatus | - Status from adi_pqlib_ProcessOneCycle. |
int wait_for_zero_crossing | ( | PQLIB_EXAMPLE * | pExample, |
ADI_PQLIB_RESULT | pqlibStatus | ||
) |
Looks at the return code from library and checks whether there is a zero crossing timeout. This is only needed for testing. We wanted to know when actual signal comes and start monitoring test output only after a predefined settling time.
[in] | pExample | - Pointer to PQLIB_EXAMPLE structure |
[in] | pqlibStatus | - return code for the library |
volatile bool configChanged |
volatile uint8_t newSyncTimeAvailable = 0 |
PQLIB_EXAMPLE pqlibExample |