7 #include "InterruptableSensorBase.h"
10 InterruptableSensorBase::InterruptableSensorBase()
16 InterruptableSensorBase::~InterruptableSensorBase()
21 void InterruptableSensorBase::AllocateInterrupts(
bool watcher)
23 wpi_assert(m_interrupt == NULL);
24 wpi_assert(m_manager == NULL);
26 tRioStatusCode localStatus = NiFpga_Status_Success;
27 m_interrupt = tInterrupt::create(m_interruptIndex, &localStatus);
28 m_interrupt->writeConfig_WaitForAck(
false, &localStatus);
29 m_manager =
new tInterruptManager(1 << m_interruptIndex, watcher, &localStatus);
30 wpi_setError(localStatus);
39 wpi_assert(m_manager != NULL);
40 wpi_assert(m_interrupt != NULL);
53 wpi_assert(m_manager != NULL);
54 wpi_assert(m_interrupt != NULL);
55 tRioStatusCode localStatus = NiFpga_Status_Success;
56 m_manager->watch((int32_t)(timeout * 1e3), &localStatus);
57 wpi_setError(localStatus);
67 wpi_assert(m_manager != NULL);
68 wpi_assert(m_interrupt != NULL);
69 tRioStatusCode localStatus = NiFpga_Status_Success;
70 m_manager->enable(&localStatus);
71 wpi_setError(localStatus);
79 wpi_assert(m_manager != NULL);
80 wpi_assert(m_interrupt != NULL);
81 tRioStatusCode localStatus = NiFpga_Status_Success;
82 m_manager->disable(&localStatus);
83 wpi_setError(localStatus);
93 wpi_assert(m_interrupt != NULL);
94 tRioStatusCode localStatus = NiFpga_Status_Success;
95 uint32_t timestamp = m_interrupt->readTimeStamp(&localStatus);
96 wpi_setError(localStatus);
97 return timestamp * 1e-6;
virtual void DisableInterrupts()
Disable, but don't deallocate.
virtual void CancelInterrupts()
Free up the underlying chipobject functions.
virtual void WaitForInterrupt(float timeout)
Synchronus version.
virtual double ReadInterruptTimestamp()
Return the timestamp for the interrupt that occurred.
virtual void EnableInterrupts()
Enable interrupts - after finishing setup.