James Reynolds / AD594x Driver
Embed: (wiki syntax)

« Back to documentation index

Function_Helpers

Function_Helpers
[AD5940_Functions]

The functions with no hardware access. More...

Modules

 Sequencer_Generator_Functions
 

The set of function used to track all register read and write once it's enabled.


Functions

static int32_t _is_value_in_table (uint8_t value, const uint8_t *table, uint8_t len, uint8_t *index)
 Sequencer_Generator_Functions.
BoolFlag AD5940_Notch50HzAvailable (ADCFilterCfg_Type *pFilterInfo, uint8_t *dl)
 return if the SINC3/SINC2 combination is available for notch 50Hz filter.
BoolFlag AD5940_Notch60HzAvailable (ADCFilterCfg_Type *pFilterInfo, uint8_t *dl)
 return if the SINC3/SINC2 combination is available for notch 60Hz filter.
void AD5940_ClksCalculate (ClksCalInfo_Type *pFilterInfo, uint32_t *pClocks)
 Calculate how many clocks are needed in sequencer wait command to generate required number of data from filter output.
void AD5940_SweepNext (SoftSweepCfg_Type *pSweepCfg, float *pNextFreq)
 void AD5940_SweepNext(SoftSweepCfg_Type *pSweepCfg, float *pNextFreq) For sweep function, calculate next frequency point according to pSweepCfg info.
void AD5940_StructInit (void *pStruct, uint32_t StructSize)
 Initialize Structure members to zero.
float AD5940_ADCCode2Volt (uint32_t code, uint32_t ADCPga, float VRef1p82)
 Convert ADC Code to voltage.
fImpCar_Type AD5940_ComplexDivFloat (fImpCar_Type *a, fImpCar_Type *b)
 Do complex number division.
fImpCar_Type AD5940_ComplexMulFloat (fImpCar_Type *a, fImpCar_Type *b)
 Do complex number multiplication.
fImpCar_Type AD5940_ComplexAddFloat (fImpCar_Type *a, fImpCar_Type *b)
 Do complex number addition.
fImpCar_Type AD5940_ComplexSubFloat (fImpCar_Type *a, fImpCar_Type *b)
 Do complex number subtraction.
fImpCar_Type AD5940_ComplexDivInt (iImpCar_Type *a, iImpCar_Type *b)
 Do complex number division.
fImpCar_Type AD5940_ComplexMulInt (iImpCar_Type *a, iImpCar_Type *b)
 Do complex number multiplication.
float AD5940_ComplexMag (fImpCar_Type *a)
 Calculate the complex number magnitude.
float AD5940_ComplexPhase (fImpCar_Type *a)
 Calculate the complex number phase.
FreqParams_Type AD5940_GetFreqParameters (float freq)
 Calculate the optimum filter settings based on signal frequency.

Detailed Description

The functions with no hardware access.

They are helpers.


Function Documentation

static int32_t _is_value_in_table ( uint8_t  value,
const uint8_t *  table,
uint8_t  len,
uint8_t *  index 
) [static]

Sequencer_Generator_Functions.

Check if an uint8_t value exist in table.

Definition at line 351 of file ad5940.c.

float AD5940_ADCCode2Volt ( uint32_t  code,
uint32_t  ADCPga,
float  VRef1p82 
)

Convert ADC Code to voltage.

Parameters:
ADCPga,:The ADC PGA used for this result.
code,:ADC code.
VRef1p82,:the actual 1.82V reference voltage.
Returns:
Voltage in volt.

Definition at line 628 of file ad5940.c.

void AD5940_ClksCalculate ( ClksCalInfo_Type pFilterInfo,
uint32_t *  pClocks 
)

Calculate how many clocks are needed in sequencer wait command to generate required number of data from filter output.

Note:
When measurement is done, it's recommend to disable blocks like ADCPWR, ADCCNV, SINC2, DFT etc. If blocks remain powered up, they may need less clocks to generate required number of output. Use function AD5940_AFECtrlS to control these blocks.
Parameters:
pFilterInfo,:Pointer to configuration structure.
pClocks,:pointer used to store results.
Returns:
return none.

Definition at line 480 of file ad5940.c.

fImpCar_Type AD5940_ComplexAddFloat ( fImpCar_Type a,
fImpCar_Type b 
)

Do complex number addition.

Parameters:
a,:The addend.
b,:The addend .
Returns:
Return result.

Definition at line 695 of file ad5940.c.

fImpCar_Type AD5940_ComplexDivFloat ( fImpCar_Type a,
fImpCar_Type b 
)

Do complex number division.

Parameters:
a,:The dividend.
b,:The divisor.
Returns:
Return result.

Definition at line 662 of file ad5940.c.

fImpCar_Type AD5940_ComplexDivInt ( iImpCar_Type a,
iImpCar_Type b 
)

Do complex number division.

Parameters:
a,:The dividend.
b,:The divisor.
Returns:
Return result.

Definition at line 727 of file ad5940.c.

float AD5940_ComplexMag ( fImpCar_Type a )

Calculate the complex number magnitude.

Parameters:
a,:The complex number.
Returns:
Return magnitude.

Definition at line 760 of file ad5940.c.

fImpCar_Type AD5940_ComplexMulFloat ( fImpCar_Type a,
fImpCar_Type b 
)

Do complex number multiplication.

Parameters:
a,:The multiplicand.
b,:The multiplier .
Returns:
Return result.

Definition at line 680 of file ad5940.c.

fImpCar_Type AD5940_ComplexMulInt ( iImpCar_Type a,
iImpCar_Type b 
)

Do complex number multiplication.

Parameters:
a,:The multiplicand.
b,:The multiplier .
Returns:
Return result.

Definition at line 745 of file ad5940.c.

float AD5940_ComplexPhase ( fImpCar_Type a )

Calculate the complex number phase.

Parameters:
a,:The complex number.
Returns:
Return phase.

Definition at line 770 of file ad5940.c.

fImpCar_Type AD5940_ComplexSubFloat ( fImpCar_Type a,
fImpCar_Type b 
)

Do complex number subtraction.

Parameters:
a,:The minuend.
b,:The subtrahend .
Returns:
Return result.

Definition at line 711 of file ad5940.c.

FreqParams_Type AD5940_GetFreqParameters ( float  freq )

Calculate the optimum filter settings based on signal frequency.

Parameters:
freq,:Frequency of signalr.
Returns:
Return FreqParams.

Definition at line 780 of file ad5940.c.

BoolFlag AD5940_Notch50HzAvailable ( ADCFilterCfg_Type pFilterInfo,
uint8_t *  dl 
)

return if the SINC3/SINC2 combination is available for notch 50Hz filter.

If it's not availabe, hardware automatically bypass Notch even if it's enabled.

Parameters:
pFilterInfothe filter configuration, only need sinc2/sinc3 osr and adc data rate information.
Returns:
return bTRUE if notch 50Hz filter is available.

Definition at line 370 of file ad5940.c.

BoolFlag AD5940_Notch60HzAvailable ( ADCFilterCfg_Type pFilterInfo,
uint8_t *  dl 
)

return if the SINC3/SINC2 combination is available for notch 60Hz filter.

If it's not availabe, hardware automatically bypass Notch even if it's enabled.

Parameters:
pFilterInfothe filter configuration, need sinc2/sinc3 osr and adc data rate information.
Returns:
return bTRUE if notch 60Hz filter is available.

Definition at line 424 of file ad5940.c.

void AD5940_StructInit ( void *  pStruct,
uint32_t  StructSize 
)

Initialize Structure members to zero.

Parameters:
pStruct,:Pointer to the structure.
StructSize,:The structure size in Byte.
Returns:
Return None.

Definition at line 616 of file ad5940.c.

void AD5940_SweepNext ( SoftSweepCfg_Type pSweepCfg,
float *  pNextFreq 
)

void AD5940_SweepNext(SoftSweepCfg_Type *pSweepCfg, float *pNextFreq) For sweep function, calculate next frequency point according to pSweepCfg info.

Returns:
Return next frequency point in Hz.

Definition at line 569 of file ad5940.c.