Skip to content

Commit

Permalink
Convert AnalogTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Aug 28, 2024
1 parent a09c3f2 commit 0aa4c3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions wpilibc/src/main/native/cpp/AnalogTrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ AnalogTrigger::AnalogTrigger(DutyCycle* input) {
wpi::SendableRegistry::AddLW(this, "AnalogTrigger", index);
}

AnalogTrigger::~AnalogTrigger() {
HAL_CleanAnalogTrigger(m_trigger);
}

void AnalogTrigger::SetLimitsVoltage(double lower, double upper) {
int32_t status = 0;
HAL_SetAnalogTriggerLimitsVoltage(m_trigger, lower, upper, &status);
Expand Down
5 changes: 3 additions & 2 deletions wpilibc/src/main/native/include/frc/AnalogTrigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <memory>

#include <hal/AnalogTrigger.h>
#include <hal/Types.h>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
Expand Down Expand Up @@ -60,7 +61,7 @@ class AnalogTrigger : public wpi::Sendable,
AnalogTrigger(AnalogTrigger&&) = default;
AnalogTrigger& operator=(AnalogTrigger&&) = default;

~AnalogTrigger() override;
~AnalogTrigger() override = default;

/**
* Set the upper and lower limits of the analog trigger.
Expand Down Expand Up @@ -162,7 +163,7 @@ class AnalogTrigger : public wpi::Sendable,

std::shared_ptr<AnalogInput> m_analogInput = nullptr;
DutyCycle* m_dutyCycle = nullptr;
hal::Handle<HAL_AnalogTriggerHandle> m_trigger;
hal::Handle<HAL_AnalogTriggerHandle, HAL_CleanAnalogTrigger> m_trigger;
bool m_ownsAnalog = false;
};

Expand Down

0 comments on commit 0aa4c3c

Please sign in to comment.