blob: 9bd16435f707bbb6a283766af1a08319f42e3831 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5/*----------------------------------------------------------------------------*/
6
7#ifndef INTERRUPTABLE_SENSORBASE_H_
8#define INTERRUPTABLE_SENSORBASE_H_
9
10#include "ChipObject.h"
11#include "SensorBase.h"
12
13class InterruptableSensorBase : public SensorBase
14{
15public:
16 InterruptableSensorBase();
17 virtual ~InterruptableSensorBase();
18 virtual void RequestInterrupts(tInterruptHandler handler, void *param) = 0; ///< Asynchronus handler version.
19 virtual void RequestInterrupts() = 0; ///< Synchronus Wait version.
20 virtual void CancelInterrupts(); ///< Free up the underlying chipobject functions.
21 virtual void WaitForInterrupt(float timeout); ///< Synchronus version.
22 virtual void EnableInterrupts(); ///< Enable interrupts - after finishing setup.
23 virtual void DisableInterrupts(); ///< Disable, but don't deallocate.
24 virtual double ReadInterruptTimestamp(); ///< Return the timestamp for the interrupt that occurred.
25protected:
26 tInterrupt *m_interrupt;
27 tInterruptManager *m_manager;
28 UINT32 m_interruptIndex;
29 void AllocateInterrupts(bool watcher);
30};
31
32#endif
33