code/WPILib/DigitalModule.cpp
/**
 * Change the frequency of the DO PWM generator.
 * 
 * The valid range is from 0.6 Hz to 19 kHz.  The frequency resolution is logarithmic.
 * 
 * @param rate The frequency to output all digital output PWM signals on this module.
 */
Change the frequency of the DO PWM generator.

The valid range is from 0.6 Hz to 19 kHz.  The frequency resolution is logarithmic.

@param rate The frequency to output all digital output PWM signals on this module.
Change the frequency of the DO PWM generator . The valid range is from 0 . 6 Hz to 19 kHz . The frequency resolution is logarithmic . @param rate The frequency to output all digital output PWM signals on this module .
void DigitalModule::SetDO_PWMRate(float rate)
{
	UINT8 pwmPeriodPower = (UINT8)(log(1.0 / (m_fpgaDIO->readLoopTiming(&status) * 0.25E-6 * rate))/log(2.0) + 0.5);
	m_fpgaDIO->writeDO_PWMConfig_PeriodPower(pwmPeriodPower, &status);
	wpi_assertCleanStatus(status);
}
void DigitalModule :: SetDO_PWMRate ( float rate ) { UINT8 pwmPeriodPower = ( UINT8 ) ( log ( 1.0 / ( m_fpgaDIO -> readLoopTiming ( & status ) * 0.25E-6 * rate ) ) / log ( 2.0 ) + 0.5 ) ; m_fpgaDIO -> writeDO_PWMConfig_PeriodPower ( pwmPeriodPower , & status ) ; wpi_assertCleanStatus ( status ) ; }
Change the frequency of the DO PWM generator.
Change the frequency of the DO PWM generator .
// Currently rounding in the log rate domain... heavy weight toward picking a higher freq. // TODO: Round in the linear rate domain.