WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
DigitalOutput.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 DIGITAL_OUTPUT_H_
8 #define DIGITAL_OUTPUT_H_
9 
10 #include "DigitalSource.h"
11 #include "LiveWindow/LiveWindowSendable.h"
12 #include "tables/ITableListener.h"
13 
14 class DigitalModule;
15 
21 class DigitalOutput : public DigitalSource, public ITableListener, public LiveWindowSendable
22 {
23 public:
24  explicit DigitalOutput(uint32_t channel);
25  DigitalOutput(uint8_t moduleNumber, uint32_t channel);
26  virtual ~DigitalOutput();
27  void Set(uint32_t value);
28  uint32_t GetChannel();
29  void Pulse(float length);
30  bool IsPulsing();
31  void SetPWMRate(float rate);
32  void EnablePWM(float initialDutyCycle);
33  void DisablePWM();
34  void UpdateDutyCycle(float dutyCycle);
35 
36  // Digital Source Interface
37  virtual uint32_t GetChannelForRouting();
38  virtual uint32_t GetModuleForRouting();
39  virtual bool GetAnalogTriggerForRouting();
40  virtual void RequestInterrupts(tInterruptHandler handler, void *param);
41  virtual void RequestInterrupts();
42 
43  void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
44 
45  virtual void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
46  void UpdateTable();
47  void StartLiveWindowMode();
48  void StopLiveWindowMode();
49  std::string GetSmartDashboardType();
50  void InitTable(ITable *subTable);
51  ITable * GetTable();
52 
53 private:
54  void InitDigitalOutput(uint8_t moduleNumber, uint32_t channel);
55 
56  uint32_t m_channel;
57  uint32_t m_pwmGenerator;
58  DigitalModule *m_module;
59 
60  ITable *m_table;
61 };
62 
63 #endif
virtual uint32_t GetChannelForRouting()
Definition: DigitalOutput.cpp:185
void SetPWMRate(float rate)
Definition: DigitalOutput.cpp:127
virtual bool GetAnalogTriggerForRouting()
Definition: DigitalOutput.cpp:202
Definition: DigitalSource.h:19
Definition: DigitalOutput.h:21
uint32_t GetChannel()
Definition: DigitalOutput.cpp:91
void DisablePWM()
Definition: DigitalOutput.cpp:159
void Pulse(float length)
Definition: DigitalOutput.cpp:102
DigitalOutput(uint32_t channel)
Definition: DigitalOutput.cpp:50
virtual void RequestInterrupts()
Definition: DigitalOutput.cpp:246
void Set(uint32_t value)
Definition: DigitalOutput.cpp:82
void UpdateDutyCycle(float dutyCycle)
Definition: DigitalOutput.cpp:176
virtual ~DigitalOutput()
Definition: DigitalOutput.cpp:70
virtual uint32_t GetModuleForRouting()
Definition: DigitalOutput.cpp:193
void EnablePWM(float initialDutyCycle)
Definition: DigitalOutput.cpp:145
Definition: DigitalModule.h:17
bool IsPulsing()
Definition: DigitalOutput.cpp:112