Remove MotorSafetyHelper, create MotorSafety base class instead (#562)

Most of the MotorSafety implementation was moved into the MotorSafety base
class. SafePWM's inheritance of MotorSafety was moved into PWM to
eliminate Java needing a helper class.

In Java, a helper class for Sendable (SendableImpl) was added due to
lack of multiple inheritance.
This commit is contained in:
Tyler Veness
2018-11-22 21:15:26 -08:00
committed by Peter Johnson
parent df347e3d80
commit acb786a791
39 changed files with 710 additions and 1023 deletions

View File

@@ -10,8 +10,9 @@
#include <stdint.h>
#include <hal/Types.h>
#include <wpi/raw_ostream.h>
#include "frc/ErrorBase.h"
#include "frc/MotorSafety.h"
#include "frc/smartdashboard/SendableBase.h"
namespace frc {
@@ -33,7 +34,7 @@ namespace frc {
* - 1 = minimum pulse width (currently .5ms)
* - 0 = disabled (i.e. PWM output is held low)
*/
class PWM : public ErrorBase, public SendableBase {
class PWM : public MotorSafety, public SendableBase {
public:
/**
* Represents the amount to multiply the minimum servo-pulse pwm period by.
@@ -75,6 +76,10 @@ class PWM : public ErrorBase, public SendableBase {
PWM(PWM&& rhs);
PWM& operator=(PWM&& rhs);
// MotorSafety interface
void StopMotor() override;
void GetDescription(wpi::raw_ostream& desc) const override;
/**
* Set the PWM value directly to the hardware.
*