コード例 #1
0
/**
 * Get the current sample rate on the module.
 * 
 * This assumes one entry in the scan list.
 * This is a global setting for the module and effects all channels.
 * 
 * @return Sample rate.
 */
float AnalogModule::GetSampleRate()
{
	UINT32 ticksPerConversion = m_module->readLoopTiming(&status);
	wpi_assertCleanStatus(status);
	UINT32 ticksPerSample = ticksPerConversion * GetNumActiveChannels();
	wpi_assertCleanStatus(status);
	return (float)kTimebase / (float)ticksPerSample;
}
コード例 #2
0
ファイル: AnalogModule.cpp プロジェクト: 128keaton/wpilib
/**
 * Get the current sample rate on the module.
 * 
 * This assumes one entry in the scan list.
 * This is a global setting for the module and effects all channels.
 * 
 * @return Sample rate.
 */
float AnalogModule::GetSampleRate()
{
	tRioStatusCode localStatus = NiFpga_Status_Success;
	UINT32 ticksPerConversion = m_module->readLoopTiming(&localStatus);
	wpi_setError(localStatus);
	UINT32 ticksPerSample = ticksPerConversion * GetNumActiveChannels();
	return (float)kTimebase / (float)ticksPerSample;
}
コード例 #3
0
/**
 * Get the number of active channels.
 * 
 * This is an internal function to allow the atomic update of both the 
 * number of active channels and the sample rate.
 * 
 * When the number of channels changes, use the new value.  Otherwise,
 * return the curent value.
 * 
 * @return Value to write to the active channels field.
 */
UINT32 AnalogModule::GetNumChannelsToActivate()
{
	if(m_numChannelsToActivate == 0) return GetNumActiveChannels();
	return m_numChannelsToActivate;
}