2021-06-05 22:36:39 -07:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <hal/Types.h>
|
2021-07-09 15:11:12 -07:00
|
|
|
#include <wpi/mutex.h>
|
|
|
|
|
#include <wpi/sendable/Sendable.h>
|
|
|
|
|
#include <wpi/sendable/SendableHelper.h>
|
2021-06-05 22:36:39 -07:00
|
|
|
|
|
|
|
|
#include "PneumaticsBase.h"
|
|
|
|
|
|
|
|
|
|
namespace frc {
|
2021-07-09 15:11:12 -07:00
|
|
|
class PneumaticsControlModule
|
|
|
|
|
: public PneumaticsBase,
|
|
|
|
|
public wpi::Sendable,
|
|
|
|
|
public wpi::SendableHelper<PneumaticsControlModule> {
|
2021-06-05 22:36:39 -07:00
|
|
|
public:
|
|
|
|
|
PneumaticsControlModule();
|
|
|
|
|
explicit PneumaticsControlModule(int module);
|
|
|
|
|
|
|
|
|
|
~PneumaticsControlModule() override;
|
|
|
|
|
|
|
|
|
|
bool GetCompressor();
|
|
|
|
|
|
|
|
|
|
void SetClosedLoopControl(bool enabled);
|
|
|
|
|
|
|
|
|
|
bool GetClosedLoopControl();
|
|
|
|
|
|
|
|
|
|
bool GetPressureSwitch();
|
|
|
|
|
|
|
|
|
|
double GetCompressorCurrent();
|
|
|
|
|
|
|
|
|
|
bool GetCompressorCurrentTooHighFault();
|
|
|
|
|
bool GetCompressorCurrentTooHighStickyFault();
|
|
|
|
|
bool GetCompressorShortedFault();
|
|
|
|
|
bool GetCompressorShortedStickyFault();
|
|
|
|
|
bool GetCompressorNotConnectedFault();
|
|
|
|
|
bool GetCompressorNotConnectedStickyFault();
|
|
|
|
|
|
|
|
|
|
bool GetSolenoidVoltageFault();
|
|
|
|
|
bool GetSolenoidVoltageStickyFault();
|
|
|
|
|
|
|
|
|
|
void ClearAllStickyFaults();
|
|
|
|
|
|
|
|
|
|
void SetSolenoids(int mask, int values) override;
|
|
|
|
|
|
|
|
|
|
int GetSolenoids() const override;
|
|
|
|
|
|
|
|
|
|
int GetModuleNumber() const override;
|
|
|
|
|
|
|
|
|
|
int GetSolenoidDisabledList() const override;
|
|
|
|
|
|
|
|
|
|
void FireOneShot(int index) override;
|
|
|
|
|
|
|
|
|
|
void SetOneShotDuration(int index, units::second_t duration) override;
|
|
|
|
|
|
|
|
|
|
bool CheckSolenoidChannel(int channel) const override;
|
|
|
|
|
|
2021-07-09 15:11:12 -07:00
|
|
|
int CheckAndReserveSolenoids(int mask) override;
|
|
|
|
|
|
|
|
|
|
void UnreserveSolenoids(int mask) override;
|
|
|
|
|
|
|
|
|
|
void InitSendable(wpi::SendableBuilder& builder) override;
|
|
|
|
|
|
2021-06-05 22:36:39 -07:00
|
|
|
private:
|
|
|
|
|
int m_module;
|
|
|
|
|
hal::Handle<HAL_CTREPCMHandle> m_handle;
|
2021-07-09 15:11:12 -07:00
|
|
|
uint32_t m_reservedMask;
|
|
|
|
|
wpi::mutex m_reservedLock;
|
2021-06-05 22:36:39 -07:00
|
|
|
};
|
|
|
|
|
} // namespace frc
|