Skip to content
Snippets Groups Projects
AWG.cpp 21.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • xiyehu2's avatar
    xiyehu2 committed
    		this->pCardHandle,
    		SPC_CLOCKMODE,
    		int32(cm)
    	);
    	this->checkError();
    }
    
    int32 AWG::getClockMode() {
    	if (!this->isOpen()) { return -1; }
    	int32 cm;
    	spcm_dwGetParam_i32(
    		this->pCardHandle,
    		SPC_CLOCKMODE,
    		&cm
    	);
    	this->checkError();
    	return cm;
    }
    
    void AWG::setRefClkFreq(int64 frequency) {
    	/**
    	 * if using EXTREFCLK mode, set the external clock frequency.
    	 * 
    	 * @param frequency Hz
    	 */
    	if (!this->isOpen()) { return; }
    	spcm_dwSetParam_i64(
    		this->pCardHandle,
    		SPC_REFERENCECLOCK,
    		frequency
    	);
    	this->checkError();
    }
    
    void AWG::setClockOut(bool enable) {
    	/**
    	 * enable/disable clock output.
    	 * 
    	 * @param enable true/false
    	 */
    	if (!this->isOpen()) { return; }
    	spcm_dwSetParam_i32(
    		this->pCardHandle,
    		SPC_CLOCKOUT,
    		enable
    	);
    	this->checkError();
    }
    
    int64 AWG::getClockOutFreq() {
    	/**
    	 * Read out frequency of internally synthesized clock.
    	 * 
    	 * @return frequency (Hz)
    	 */
    	if (!this->isOpen()) { return -1; }
    	int64 freq;
    	spcm_dwGetParam_i64(
    		this->pCardHandle,
    		SPC_CLOCKOUTFREQUENCY,
    		&freq
    	);
    	this->checkError();
    	return freq;
    }