001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenixpro.wpiutils;
008
009import edu.wpi.first.wpilibj.motorcontrol.MotorController;
010import edu.wpi.first.wpilibj.MotorSafety;
011
012/**
013 * implem of MotorSafety interface in WPI. This also allows late/lazy
014 * construction of WPI's motor safety object (which mitigates late-released bugs from WPI).
015 */
016public class MotorSafetyImplem extends MotorSafety {
017    private final MotorController _motorController;
018    private final String _description;
019
020    /**
021     * Constructor for WPI_MotorSafetyImplem
022     * @param speedController Motor Controller to implement motor safety on
023     * @param description Description of motor controller
024     */
025    public MotorSafetyImplem(MotorController speedController, String description) {
026        _motorController = speedController;
027        _description = description;
028    }
029
030    /**
031     * Stop the controller
032     */
033    public void stopMotor() { _motorController.stopMotor(); }
034
035    /**
036     * @return Description of motor controller
037     */
038    public String getDescription() { return _description; }
039}