CTRE_Phoenix 5.20.2
WPI_CANCoder.h
1
10#pragma once
11
12#include "ctre/phoenix/sensors/CANCoder.h"
13#include "ctre/phoenix/WPI_CallbackHelper.h"
14
15#include <mutex>
16
17//Need to disable certain warnings for WPI headers.
18#if __GNUC__
19#pragma GCC diagnostic push
20#pragma GCC diagnostic ignored "-Wconversion"
21#elif _MSC_VER
22#pragma warning(push)
23#pragma warning(disable : 4522 4458 4522)
24#endif
25
26#include "wpi/sendable/Sendable.h"
27#include "wpi/sendable/SendableHelper.h"
28#include "wpi/raw_ostream.h"
29#include <hal/SimDevice.h>
30
31//Put the warning settings back to normal
32#if __GNUC__
33#pragma GCC diagnostic pop
34#elif _MSC_VER
35#pragma warning(pop)
36#endif
37
38namespace ctre
39{
40namespace phoenix
41{
42namespace sensors
43{
44
45class WPI_CANCoder : public CANCoder,
46 public wpi::Sendable,
47 public wpi::SendableHelper<WPI_CANCoder>
48{
49 public:
57 WPI_CANCoder(int deviceNumber, std::string const &canbus = "");
58
60
61 WPI_CANCoder() = delete;
62 WPI_CANCoder(WPI_CANCoder const &) = delete;
63 WPI_CANCoder &operator=(WPI_CANCoder const &) = delete;
64
65 void InitSendable(wpi::SendableBuilder& builder) override;
66
67 private:
68
69 hal::SimDevice m_simCANCoder;
70 hal::SimDouble m_simVbat;
71 hal::SimDouble m_simPosition;
72 hal::SimDouble m_simAbsPosition;
73 hal::SimDouble m_simRawPosition;
74 hal::SimDouble m_simVelocity;
75
76 static void OnValueChanged(const char* name, void* param, HAL_SimValueHandle handle,
77 HAL_Bool readonly, const struct HAL_Value* value);
78 static void OnPeriodic(void* param);
79};
80
81} //namespace sensors
82} //namespace phoenix
83} //namespace ctre
Definition: CANCoder.h:169
Definition: WPI_CANCoder.h:48
WPI_CANCoder(int deviceNumber, std::string const &canbus="")
Definition: ErrorCode.h:5