mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[sim] Add WPILib-class-taking constructors (#2538)
When not direct mapped, make index constructors private and add factory functions for channel and index. Co-authored-by: GabrielDeml <gabrielddeml@gmail.com>
This commit is contained in:
@@ -13,12 +13,30 @@
|
||||
#include <hal/simulation/PDPData.h>
|
||||
|
||||
#include "CallbackStore.h"
|
||||
#include "frc/PowerDistributionPanel.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
|
||||
/**
|
||||
* Class to control a simulated Power Distribution Panel (PDP).
|
||||
*/
|
||||
class PDPSim {
|
||||
public:
|
||||
explicit PDPSim(int index) { m_index = index; }
|
||||
/**
|
||||
* Constructs from a PDP module number (CAN ID).
|
||||
*
|
||||
* @param module module number
|
||||
*/
|
||||
explicit PDPSim(int module = 0) : m_index{module} {}
|
||||
|
||||
/**
|
||||
* Constructs from a PowerDistributionPanel object.
|
||||
*
|
||||
* @param pdp PowerDistributionPanel to simulate
|
||||
*/
|
||||
explicit PDPSim(const PowerDistributionPanel& pdp)
|
||||
: m_index{pdp.GetModule()} {}
|
||||
|
||||
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
|
||||
Reference in New Issue
Block a user