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 DOUBLE_SOLENOID_H_
|
| 8 | #define DOUBLE_SOLENOID_H_
|
| 9 |
|
| 10 | #include "SolenoidBase.h"
|
| 11 | #include "LiveWindow/LiveWindowSendable.h"
|
| 12 | #include "tables/ITableListener.h"
|
| 13 |
|
| 14 |
|
| 15 | /**
|
| 16 | * DoubleSolenoid class for running 2 channels of high voltage Digital Output
|
| 17 | * (9472 module).
|
| 18 | *
|
| 19 | * The DoubleSolenoid class is typically used for pneumatics solenoids that
|
| 20 | * have two positions controlled by two separate channels.
|
| 21 | */
|
| 22 | class DoubleSolenoid : public SolenoidBase, public LiveWindowSendable, public ITableListener {
|
| 23 | public:
|
| 24 | typedef enum {kOff, kForward, kReverse} Value;
|
| 25 |
|
| 26 | explicit DoubleSolenoid(UINT32 forwardChannel, UINT32 reverseChannel);
|
| 27 | DoubleSolenoid(UINT8 moduleNumber, UINT32 forwardChannel, UINT32 reverseChannel);
|
| 28 | virtual ~DoubleSolenoid();
|
| 29 | virtual void Set(Value value);
|
| 30 | virtual Value Get();
|
| 31 |
|
| 32 | void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
|
| 33 | void UpdateTable();
|
| 34 | void StartLiveWindowMode();
|
| 35 | void StopLiveWindowMode();
|
| 36 | std::string GetSmartDashboardType();
|
| 37 | void InitTable(ITable *subTable);
|
| 38 | ITable * GetTable();
|
| 39 |
|
| 40 | private:
|
| 41 | virtual void InitSolenoid();
|
| 42 |
|
| 43 | UINT32 m_forwardChannel; ///< The forward channel on the module to control.
|
| 44 | UINT32 m_reverseChannel; ///< The reverse channel on the module to control.
|
| 45 | UINT8 m_forwardMask; ///< The mask for the forward channel.
|
| 46 | UINT8 m_reverseMask; ///< The mask for the reverse channel.
|
| 47 |
|
| 48 | ITable *m_table;
|
| 49 | };
|
| 50 |
|
| 51 | #endif
|