[wpilib] Make solenoids exclusive use, PCM act like old sendable compressor (#3464)

This commit is contained in:
Thad House
2021-07-09 15:11:12 -07:00
committed by GitHub
parent 6ddef1cca6
commit c154e5262e
9 changed files with 166 additions and 8 deletions

View File

@@ -5,20 +5,23 @@
#pragma once
#include <hal/Types.h>
#include <wpi/mutex.h>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "PneumaticsBase.h"
namespace frc {
class PneumaticsControlModule : public PneumaticsBase {
class PneumaticsControlModule
: public PneumaticsBase,
public wpi::Sendable,
public wpi::SendableHelper<PneumaticsControlModule> {
public:
PneumaticsControlModule();
explicit PneumaticsControlModule(int module);
~PneumaticsControlModule() override;
PneumaticsControlModule(PneumaticsControlModule&&) = default;
PneumaticsControlModule& operator=(PneumaticsControlModule&&) = default;
bool GetCompressor();
void SetClosedLoopControl(bool enabled);
@@ -55,8 +58,16 @@ class PneumaticsControlModule : public PneumaticsBase {
bool CheckSolenoidChannel(int channel) const override;
int CheckAndReserveSolenoids(int mask) override;
void UnreserveSolenoids(int mask) override;
void InitSendable(wpi::SendableBuilder& builder) override;
private:
int m_module;
hal::Handle<HAL_CTREPCMHandle> m_handle;
uint32_t m_reservedMask;
wpi::mutex m_reservedLock;
};
} // namespace frc