code/WPILib/DigitalModule.cpp
/**
 * Write a digital I/O bit to the FPGA.
 * Set a single value on a digital I/O channel.
 */
Write a digital I/O bit to the FPGA.
Set a single value on a digital I/O channel.
Write a digital I / O bit to the FPGA . Set a single value on a digital I / O channel .
void DigitalModule::SetDIO(UINT32 channel, short value)
{
	status = 0;
	if (value != 0 && value != 1)
	{
		wpi_fatal(NonBinaryDigitalValue);
		if (value != 0)
			value = 1;
	}
	UINT16 currentDIO = m_fpgaDIO->readDO(&status);
	if(value == 0)
	{
		currentDIO = currentDIO & ~(1 << RemapDigitalChannel(channel - 1));
	}
	else if (value == 1)
	{
		currentDIO = currentDIO | (1 << RemapDigitalChannel(channel - 1));
	} 
	m_fpgaDIO->writeDO(currentDIO, &status);
	wpi_assertCleanStatus(status);
}
void DigitalModule :: SetDIO ( UINT32 channel , short value ) { status = 0 ; if ( value != 0 && value != 1 ) { wpi_fatal ( NonBinaryDigitalValue ) ; if ( value != 0 ) value = 1 ; } UINT16 currentDIO = m_fpgaDIO -> readDO ( & status ) ; if ( value == 0 ) { currentDIO = currentDIO & ~ ( 1 << RemapDigitalChannel ( channel - 1 ) ) ; } else if ( value == 1 ) { currentDIO = currentDIO | ( 1 << RemapDigitalChannel ( channel - 1 ) ) ; } m_fpgaDIO -> writeDO ( currentDIO , & status ) ; wpi_assertCleanStatus ( status ) ; }
Write a digital I/O bit to the FPGA.
Write a digital I / O bit to the FPGA .