2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-05-25 22:38:11 -07:00
|
|
|
#include <memory>
|
2016-09-05 13:55:31 -07:00
|
|
|
#include <string>
|
2016-05-25 22:38:11 -07:00
|
|
|
|
2016-07-12 10:45:14 -07:00
|
|
|
#include "HAL/Types.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "LiveWindow/LiveWindowSendable.h"
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "SolenoidBase.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "tables/ITableListener.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DoubleSolenoid class for running 2 channels of high voltage Digital Output
|
2014-08-25 15:32:49 -07:00
|
|
|
* (PCM).
|
2014-08-05 14:42:37 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* The DoubleSolenoid class is typically used for pneumatics solenoids that
|
|
|
|
|
* have two positions controlled by two separate channels.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
class DoubleSolenoid : public SolenoidBase,
|
|
|
|
|
public LiveWindowSendable,
|
|
|
|
|
public ITableListener {
|
|
|
|
|
public:
|
|
|
|
|
enum Value { kOff, kForward, kReverse };
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-09-06 00:01:45 -07:00
|
|
|
explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
|
|
|
|
|
DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual ~DoubleSolenoid();
|
|
|
|
|
virtual void Set(Value value);
|
|
|
|
|
virtual Value Get() const;
|
|
|
|
|
bool IsFwdSolenoidBlackListed() const;
|
|
|
|
|
bool IsRevSolenoidBlackListed() const;
|
2014-05-02 17:54:01 -04:00
|
|
|
|
2015-08-13 23:17:19 -07:00
|
|
|
void ValueChanged(ITable* source, llvm::StringRef key,
|
|
|
|
|
std::shared_ptr<nt::Value> value, bool isNew);
|
2015-06-25 15:07:55 -04:00
|
|
|
void UpdateTable();
|
|
|
|
|
void StartLiveWindowMode();
|
|
|
|
|
void StopLiveWindowMode();
|
|
|
|
|
std::string GetSmartDashboardType() const;
|
2015-07-29 16:48:04 -04:00
|
|
|
void InitTable(std::shared_ptr<ITable> subTable);
|
|
|
|
|
std::shared_ptr<ITable> GetTable() const;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
private:
|
2016-09-06 00:01:45 -07:00
|
|
|
int m_forwardChannel; ///< The forward channel on the module to control.
|
|
|
|
|
int m_reverseChannel; ///< The reverse channel on the module to control.
|
|
|
|
|
int m_forwardMask; ///< The mask for the forward channel.
|
|
|
|
|
int m_reverseMask; ///< The mask for the reverse channel.
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
|
|
|
|
|
HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
|
2014-08-05 14:42:37 -04:00
|
|
|
|
2015-11-23 00:46:05 -08:00
|
|
|
std::shared_ptr<ITable> m_table;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|