jerrym | f157933 | 2013-02-07 01:56:28 +0000 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/
|
| 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 |
|
| 13 | class InterruptableSensorBase : public SensorBase
|
| 14 | {
|
| 15 | public:
|
| 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.
|
| 25 | protected:
|
| 26 | tInterrupt *m_interrupt;
|
| 27 | tInterruptManager *m_manager;
|
| 28 | UINT32 m_interruptIndex;
|
| 29 | void AllocateInterrupts(bool watcher);
|
| 30 | };
|
| 31 |
|
| 32 | #endif
|
| 33 |
|