/** * Set the state of a relay. * Set the state of a relay output to be reverse. Relays have two outputs and each is * independently set to 0v or 12v. */ void DigitalModule::SetRelayReverse(uint32_t channel, bool on) { tRioStatusCode localStatus = NiFpga_Status_Success; CheckRelayChannel(channel); { Synchronized sync(m_relaySemaphore); uint8_t reverseRelays = m_fpgaDIO->readSlowValue_RelayRev(&localStatus); if (on) reverseRelays |= 1 << (channel - 1); else reverseRelays &= ~(1 << (channel - 1)); m_fpgaDIO->writeSlowValue_RelayRev(reverseRelays, &localStatus); } wpi_setError(localStatus); }
/** * Set the state of a relay. * Set the state of a relay output to be reverse. Relays have two outputs and each is * independently set to 0v or 12v. */ void DigitalModule::SetRelayReverse(UINT32 channel, bool on) { status = 0; CheckRelayChannel(channel); { Synchronized sync(m_relaySemaphore); UINT8 reverseRelays = m_fpgaDIO->readSlowValue_RelayRev(&status); if (on) reverseRelays |= 1 << (channel - 1); else reverseRelays &= ~(1 << (channel - 1)); m_fpgaDIO->writeSlowValue_RelayRev(reverseRelays, &status); } wpi_assertCleanStatus(status); }