WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Relay.h
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 RELAY_H_
8 #define RELAY_H_
9 
10 #include "SensorBase.h"
11 #include "tables/ITableListener.h"
12 #include "LiveWindow/LiveWindowSendable.h"
13 #include "tables/ITable.h"
14 
15 class DigitalModule;
16 
26 class Relay : public SensorBase, public ITableListener, public LiveWindowSendable {
27 public:
28  typedef enum {kOff, kOn, kForward, kReverse} Value;
29  typedef enum {kBothDirections, kForwardOnly, kReverseOnly} Direction;
30 
31  Relay(uint32_t channel, Direction direction = kBothDirections);
32  Relay(uint8_t moduleNumber, uint32_t channel, Direction direction = kBothDirections);
33  virtual ~Relay();
34 
35  void Set(Value value);
36  Value Get();
37 
38  void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
39  void UpdateTable();
40  void StartLiveWindowMode();
41  void StopLiveWindowMode();
42  std::string GetSmartDashboardType();
43  void InitTable(ITable *subTable);
44  ITable * GetTable();
45 
46  ITable *m_table;
47 
48 private:
49  void InitRelay(uint8_t moduleNumber);
50 
51  uint32_t m_channel;
52  Direction m_direction;
53  DigitalModule *m_module;
54 };
55 
56 #endif
Value Get()
Definition: Relay.cpp:199
virtual ~Relay()
Definition: Relay.cpp:102
void Set(Value value)
Definition: Relay.cpp:131
Definition: SensorBase.h:20
Definition: Relay.h:26
Relay(uint32_t channel, Direction direction=kBothDirections)
Definition: Relay.cpp:91
Definition: DigitalModule.h:17