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 COMPRESSOR_H_
|
| 8 | #define COMPRESSOR_H_
|
| 9 |
|
| 10 | #define COMPRESSOR_PRIORITY 90
|
| 11 |
|
| 12 | #include "SensorBase.h"
|
| 13 | #include "Relay.h"
|
| 14 | #include "Task.h"
|
| 15 | #include "LiveWindow/LiveWindowSendable.h"
|
| 16 |
|
| 17 | class DigitalInput;
|
| 18 |
|
| 19 | /**
|
| 20 | * Compressor object.
|
| 21 | * The Compressor object is designed to handle the operation of the compressor, pressure sensor and
|
| 22 | * relay for a FIRST robot pneumatics system. The Compressor object starts a task which runs in the
|
| 23 | * backround and periodically polls the pressure sensor and operates the relay that controls the
|
| 24 | * compressor.
|
| 25 | */
|
| 26 | class Compressor: public SensorBase, public LiveWindowSendable
|
| 27 | {
|
| 28 | public:
|
| 29 | Compressor(UINT32 pressureSwitchChannel, UINT32 compressorRelayChannel);
|
| 30 | Compressor(UINT8 pressureSwitchModuleNumber, UINT32 pressureSwitchChannel,
|
| 31 | UINT8 compresssorRelayModuleNumber, UINT32 compressorRelayChannel);
|
| 32 | ~Compressor();
|
| 33 |
|
| 34 | void Start();
|
| 35 | void Stop();
|
| 36 | bool Enabled();
|
| 37 | UINT32 GetPressureSwitchValue();
|
| 38 | void SetRelayValue(Relay::Value relayValue);
|
| 39 |
|
| 40 | void UpdateTable();
|
| 41 | void StartLiveWindowMode();
|
| 42 | void StopLiveWindowMode();
|
| 43 | std::string GetSmartDashboardType();
|
| 44 | void InitTable(ITable *subTable);
|
| 45 | ITable * GetTable();
|
| 46 |
|
| 47 | private:
|
| 48 | void InitCompressor(UINT8 pressureSwitchModuleNumber, UINT32 pressureSwitchChannel,
|
| 49 | UINT8 compresssorRelayModuleNumber, UINT32 compressorRelayChannel);
|
| 50 |
|
| 51 | DigitalInput *m_pressureSwitch;
|
| 52 | Relay *m_relay;
|
| 53 | bool m_enabled;
|
| 54 | Task m_task;
|
| 55 |
|
| 56 | ITable *m_table;
|
| 57 | };
|
| 58 |
|
| 59 | #endif
|
| 60 |
|