Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ad5940.h File Reference
AD5940 library. More...
Go to the source code of this file.
| Data Structures | |
| struct | ADCBaseCfg_Type | 
| Structure for ADC Basic settings include MUX and PGA.  More... | |
| struct | ADCFilterCfg_Type | 
| Structure for ADC filter settings.  More... | |
| struct | DFTCfg_Type | 
| DFT Configuration structure.  More... | |
| struct | ADCDigComp_Type | 
| ADC digital comparator.  More... | |
| struct | StatCfg_Type | 
| Statistic function.  More... | |
| struct | SWMatrixCfg_Type | 
| Switch matrix configure.  More... | |
| struct | HSTIACfg_Type | 
| HSTIA Configure.  More... | |
| struct | HSDACCfg_Type | 
| HSDAC Configure.  More... | |
| struct | LPDACCfg_Type | 
| LPDAC Configure.  More... | |
| struct | LPAmpCfg_Type | 
| Low power amplifiers(PA and TIA)  More... | |
| struct | WGTrapzCfg_Type | 
| Trapezoid Generator parameters The definition of the Trapezoid waveform is shown below.  More... | |
| struct | WGSinCfg_Type | 
| Sin wave generator parameters.  More... | |
| struct | WGCfg_Type | 
| Waveform generator configuration.  More... | |
| struct | HSLoopCfg_Type | 
| High speed loop configuration.  More... | |
| struct | LPLoopCfg_Type | 
| Low power loop Configure.  More... | |
| struct | DSPCfg_Type | 
| DSP Configure.  More... | |
| struct | AGPIOCfg_Type | 
| GPIO Configure.  More... | |
| struct | FIFOCfg_Type | 
| FIFO configure.  More... | |
| struct | SEQCfg_Type | 
| Sequencer configure.  More... | |
| struct | SEQInfo_Type | 
| Sequence info structure.  More... | |
| struct | WUPTCfg_Type | 
| Wakeup Timer Configure.  More... | |
| struct | CLKCfg_Type | 
| Clock configure.  More... | |
| struct | HSRTIACal_Type | 
| HSTIA internal RTIA calibration structure.  More... | |
| struct | LPRTIACal_Type | 
| LPTIA internal RTIA calibration structure.  More... | |
| struct | HSDACCal_Type | 
| HSDAC calibration structure.  More... | |
| struct | LPDACCal_Type | 
| LPDAC calibration structure.  More... | |
| struct | LPDACPara_Type | 
| LPDAC parameters: LPDAC code to voltage transfer function.  More... | |
| struct | LFOSCMeasure_Type | 
| LFOSC frequency measure structure.  More... | |
| struct | ADCPGACal_Type | 
| ADC PGA calibration type.  More... | |
| struct | LPTIAOffsetCal_Type | 
| LPTIA Offset calibration type.  More... | |
| struct | ClksCalInfo_Type | 
| Structure for calculating how much system clocks needed for specified number of data.  More... | |
| struct | SoftSweepCfg_Type | 
| Software controlled Sweep Function.  More... | |
| struct | fImpPol_Type | 
| Impedance result in Polar coordinate.  More... | |
| struct | fImpCar_Type | 
| Impedance result in Cartesian coordinate.  More... | |
| struct | iImpCar_Type | 
| int32_t type Impedance result in Cartesian coordinate  More... | |
| struct | FreqParams_Type | 
| FreqParams_Type - Structure to store optimum filter settings.  More... | |
| Typedefs | |
| typedef int32_t | AD5940Err | 
| error number defination | |
| Enumerations | |
| enum | BoolFlag { , bTRUE = !bFALSE } | 
| bool definition for ad5940lib.More... | |
| Functions | |
| void | AD5940_WriteReg (uint16_t RegAddr, uint32_t RegData) | 
| SPI_Block. | |
| uint32_t | AD5940_ReadReg (uint16_t RegAddr) | 
| Read register. | |
| void | AD5940_FIFORd (uint32_t *pBuffer, uint32_t uiReadCount) | 
| Read specific number of data from FIFO with optimized SPI access. | |
| void | AD5940_Initialize (void) | 
| Initialize AD5940. | |
| void | AD5940_AFECtrlS (uint32_t AfeCtrlSet, BoolFlag State) | 
| Control most AFE digital and analog block within one register access. | |
| AD5940Err | AD5940_LPModeCtrlS (uint32_t EnSet) | 
| When LP mode is enabled, some functions are under control of LPMODECON, rather than original registers. | |
| void | AD5940_AFEPwrBW (uint32_t AfePwr, uint32_t AfeBw) | 
| Set AFE power mode and system bandwidth include HSDAC, Excitation-buffer, HSTIA and ADC etc. | |
| void | AD5940_REFCfgS (AFERefCfg_Type *pBufCfg) | 
| Configure reference buffer include 1.8V/1.1V high/low power buffers. | |
| void | AD5940_HSLoopCfgS (HSLoopCfg_Type *pHsLoopCfg) | 
| Configure High speed loop(high bandwidth loop or called excitation loop). | |
| void | AD5940_SWMatrixCfgS (SWMatrixCfg_Type *pSwMatrix) | 
| Initialize switch matrix. | |
| void | AD5940_HSDacCfgS (HSDACCfg_Type *pHsDacCfg) | 
| Initialize HSDAC. | |
| AD5940Err | AD5940_HSTIACfgS (HSTIACfg_Type *pHsTiaCfg) | 
| Initialize High speed TIA amplifier. | |
| void | AD5940_HSRTIACfgS (uint32_t HSTIARtia) | 
| Configure HSTIA RTIA resistor and keep other parameters unchanged. | |
| void | AD5940_LPLoopCfgS (LPLoopCfg_Type *pLpLoopCfg) | 
| Configure low power loop include LPDAC LPAmp(PA and TIA) | |
| void | AD5940_LPDACCfgS (LPDACCfg_Type *pLpDacCfg) | 
| Initialize LPDAC. | |
| void | AD5940_LPDAC0WriteS (uint16_t Data12Bit, uint8_t Data6Bit) | 
| Write LPDAC0 data. | |
| void | AD5940_LPDAC1WriteS (uint16_t Data12Bit, uint8_t Data6Bit) | 
| Write LPDAC1 data. | |
| void | AD5940_LPAMPCfgS (LPAmpCfg_Type *pLpAmpCfg) | 
| Initialize LP TIA and PA. | |
| void | AD5940_DSPCfgS (DSPCfg_Type *pDSPCfg) | 
| Configure low power loop include LPDAC LPAmp(PA and TIA) | |
| uint32_t | AD5940_ReadAfeResult (uint32_t AfeResultSel) | 
| Read AD5940 generated data like ADC and DFT etc. | |
| void | AD5940_ADCBaseCfgS (ADCBaseCfg_Type *pADCInit) | 
| Initializes ADC peripheral according to the specified parameters in the pADCInit. | |
| void | AD5940_ADCFilterCfgS (ADCFilterCfg_Type *pFiltCfg) | 
| Initializes ADC filter according to the specified parameters in the pFiltCfg. | |
| void | AD5940_ADCPowerCtrlS (BoolFlag State) | 
| Power up or power down ADC block(including ADC PGA and FRONTBUF). | |
| void | AD5940_ADCConvtCtrlS (BoolFlag State) | 
| Start or stop ADC convert. | |
| void | AD5940_ADCMuxCfgS (uint32_t ADCMuxP, uint32_t ADCMuxN) | 
| Configure ADC input MUX. | |
| void | AD5940_ADCDigCompCfgS (ADCDigComp_Type *pCompCfg) | 
| Set ADC digital comparator function. | |
| void | AD5940_StatisticCfgS (StatCfg_Type *pStatCfg) | 
| Configure statistic functions. | |
| void | AD5940_ADCRepeatCfgS (uint32_t Number) | 
| Set ADC Repeat convert function number. | |
| void | AD5940_DFTCfgS (DFTCfg_Type *pDftCfg) | 
| Configure DFT number and source and hanning window. | |
| void | AD5940_WGCfgS (WGCfg_Type *pWGInit) | 
| Initialize waveform generator. | |
| AD5940Err | AD5940_WGDACCodeS (uint32_t code) | 
| Write HSDAC code directly when WG configured to MMR type. | |
| void | AD5940_WGFreqCtrlS (float SinFreqHz, float WGClock) | 
| Update WG SIN wave frequency in Hz. | |
| uint32_t | AD5940_WGFreqWordCal (float SinFreqHz, float WGClock) | 
| Calculate sine wave generator frequency word. | |
| void | AD5940_FIFOCfg (FIFOCfg_Type *pFifoCfg) | 
| Configure AD5940 FIFO. | |
| AD5940Err | AD5940_FIFOGetCfg (FIFOCfg_Type *pFifoCfg) | 
| Read current FIFO configuration. | |
| void | AD5940_FIFOCtrlS (uint32_t FifoSrc, BoolFlag FifoEn) | 
| Configure AD5940 FIFO Source and enable or disable FIFO. | |
| void | AD5940_FIFOThrshSet (uint32_t FIFOThresh) | 
| Configure AD5940 Data FIFO threshold value. | |
| uint32_t | AD5940_FIFOGetCnt (void) | 
| Get Data count in FIFO. | |
| void | AD5940_SEQCfg (SEQCfg_Type *pSeqCfg) | 
| Initialize Sequencer. | |
| AD5940Err | AD5940_SEQGetCfg (SEQCfg_Type *pSeqCfg) | 
| Read back current sequencer configuration and store it to pSeqCfg. | |
| void | AD5940_SEQCtrlS (BoolFlag SeqEn) | 
| Enable or Disable sequencer. | |
| void | AD5940_SEQHaltS (void) | 
| Halt sequencer immediately. | |
| void | AD5940_SEQMmrTrig (uint32_t SeqId) | 
| Trigger sequencer by register write. | |
| void | AD5940_SEQCmdWrite (uint32_t StartAddr, const uint32_t *pCommand, uint32_t CmdCnt) | 
| Write sequencer commands to AD5940 SRAM. | |
| void | AD5940_SEQInfoCfg (SEQInfo_Type *pSeq) | 
| Initialize Sequence INFO. | |
| AD5940Err | AD5940_SEQInfoGet (uint32_t SeqId, SEQInfo_Type *pSeqInfo) | 
| Get sequence info: start address and sequence length. | |
| void | AD5940_SEQGpioCtrlS (uint32_t GpioSet) | 
| Control GPIO with register SYNCEXTDEVICE. | |
| uint32_t | AD5940_SEQTimeOutRd (void) | 
| Read back current count down timer value for Sequencer Timer Out command. | |
| AD5940Err | AD5940_SEQGpioTrigCfg (SeqGpioTrig_Cfg *pSeqGpioTrigCfg) | 
| Configure GPIO to allow it to trigger corresponding sequence(SEQ0/1/2/3). | |
| void | AD5940_WUPTCfg (WUPTCfg_Type *pWuptCfg) | 
| Configure Wakeup Timer. | |
| void | AD5940_WUPTCtrl (BoolFlag Enable) | 
| Enable or disable wakeup timer. | |
| AD5940Err | AD5940_WUPTTime (uint32_t SeqId, uint32_t SleepTime, uint32_t WakeupTime) | 
| Configure WakeupTimer. | |
| void | AD5940_CLKCfg (CLKCfg_Type *pClkCfg) | 
| Configure AD5940 clock. | |
| void | AD5940_HFOSC32MHzCtrl (BoolFlag Mode32MHz) | 
| Configure Internal HFOSC to output 32MHz or 16MHz. | |
| void | AD5940_HPModeEn (BoolFlag Enable) | 
| Enable high power mode for high frequency EIS. | |
| void | AD5940_INTCCfg (uint32_t AfeIntcSel, uint32_t AFEIntSrc, BoolFlag State) | 
| Enable or Disable selected interrupt source(s) | |
| uint32_t | AD5940_INTCGetCfg (uint32_t AfeIntcSel) | 
| Check if current interrupt configuration. | |
| void | AD5940_INTCClrFlag (uint32_t AfeIntSrcSel) | 
| Clear selected interrupt(s) flag(INTC0Flag and INTC1Flag are both cleared). | |
| BoolFlag | AD5940_INTCTestFlag (uint32_t AfeIntcSel, uint32_t AfeIntSrcSel) | 
| Test if selected interrupt source(s) is(are) bTRUE. | |
| uint32_t | AD5940_INTCGetFlag (uint32_t AfeIntcSel) | 
| return register value of REG_INTC_INTCFLAGx | |
| void | AD5940_AGPIOCfg (AGPIOCfg_Type *pAgpioCfg) | 
| Initialize AFE GPIO. | |
| void | AD5940_AGPIOFuncCfg (uint32_t uiCfgSet) | 
| Configure the function of GP0 to GP7. | |
| void | AD5940_AGPIOOen (uint32_t uiPinSet) | 
| Enable GPIO output mode on selected pins. | |
| void | AD5940_AGPIOIen (uint32_t uiPinSet) | 
| Enable input on selected pins while disable others. | |
| uint32_t | AD5940_AGPIOIn (void) | 
| Read the GPIO status. | |
| void | AD5940_AGPIOPen (uint32_t uiPinSet) | 
| Enable pull-up or down on selected pins while disable other pins. | |
| void | AD5940_AGPIOSet (uint32_t uiPinSet) | 
| Put selected GPIOs to high level. | |
| void | AD5940_AGPIOClr (uint32_t uiPinSet) | 
| Put selected GPIOs to low level. | |
| void | AD5940_AGPIOToggle (uint32_t uiPinSet) | 
| Toggle selected GPIOs. | |
| AD5940Err | AD5940_LPModeEnS (BoolFlag LPModeEn) | 
| Enter or leave LPMODE. | |
| void | AD5940_LPModeClkS (uint32_t LPModeClk) | 
| Select system clock source for LPMODE. | |
| void | AD5940_SleepKeyCtrlS (uint32_t SlpKey) | 
| LPMode_Block_Functions. | |
| void | AD5940_EnterSleepS (void) | 
| Put AFE to hibernate. | |
| void | AD5940_ShutDownS (void) | 
| Turn off LP-Loop and put AFE to hibernate mode;. | |
| uint32_t | AD5940_WakeUp (int32_t TryCount) | 
| Try to wakeup AD5940 by read register. | |
| uint32_t | AD5940_GetADIID (void) | 
| Read ADIID register, the value for current version is AD5940_ADIID. | |
| uint32_t | AD5940_GetChipID (void) | 
| Read CHIPID register, the value for current version is 0x5501. | |
| AD5940Err | AD5940_SoftRst (void) | 
| Reset AD5940 by register. | |
| void | AD5940_HWReset (void) | 
| Reset AD5940 with RESET pin. | |
| AD5940Err | AD5940_ADCPGACal (ADCPGACal_Type *ADCPGACal) | 
| Calibrate ADC PGA. | |
| AD5940Err | AD5940_LPDACCal (LPDACCal_Type *pCalCfg, LPDACPara_Type *pResult) | 
| Use ADC to measure LPDAC offset and gain factor. | |
| AD5940Err | AD5940_LPTIAOffsetCal (LPTIAOffsetCal_Type *pLPTIAOffsetCal) | 
| Calibrate LPTIA offset. | |
| AD5940Err | AD5940_HSRtiaCal (HSRTIACal_Type *pCalCfg, void *pResult) | 
| Measure HSTIA internal RTIA impedance. | |
| AD5940Err | AD5940_HSDACCal (HSDACCal_Type *pCalCfg) | 
| calibrate HSDAC output voltage using ADC. | |
| AD5940Err | AD5940_LPRtiaCal (LPRTIACal_Type *pCalCfg, void *pResult) | 
| Measure LPTIA internal RTIA impedance with HSTIA. | |
| AD5940Err | AD5940_LFOSCMeasure (LFOSCMeasure_Type *pCfg, float *pFreq) | 
| Use system clock to measure LFOSC frequency. | |
| void | AD5940_SEQGenInit (uint32_t *pBuffer, uint32_t BufferSize) | 
| Initialize sequencer generator with specified buffer. | |
| void | AD5940_SEQGenCtrl (BoolFlag bFlag) | 
| Start or stop the sequencer generator. | |
| void | AD5940_SEQGenInsert (uint32_t CmdWord) | 
| Manually input a command to sequencer generator. | |
| AD5940Err | AD5940_SEQGenFetchSeq (const uint32_t **ppSeqCmd, uint32_t *pSeqCount) | 
| Get sequencer command generated. | |
| 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. | |
| uint32_t | AD5940_SEQCycleTime (void) | 
| Calculate the number of cycles in the sequence. | |
| 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. | |
| 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. | |
| 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. | |
| void | AD5940_ReadWriteNBytes (unsigned char *pSendBuffer, unsigned char *pRecvBuff, unsigned long length) | 
| Using SPI to transmit N bytes and return the received bytes. | |
Detailed Description
AD5940 library.
This file contains all AD5940 library functions.
- Date:
- March 2019
- Revision History:
Copyright (c) 2017-2019 Analog Devices, Inc. All Rights Reserved.
This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.
Definition in file ad5940.h.
Generated on Tue Jul 12 2022 21:32:08 by
 1.7.2
 1.7.2