001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
006
007package edu.wpi.first.wpilibj.motorcontrol;
008
009import edu.wpi.first.hal.HAL;
010import edu.wpi.first.wpilibj.PWM;
011
012/**
013 * REV Robotics SPARKMini Motor Controller.
014 *
015 * <p>Note that the SPARKMini uses the following bounds for PWM values. These values should work
016 * reasonably well for most controllers, but if users experience issues such as asymmetric behavior
017 * around the deadband or inability to saturate the controller in either direction, calibration is
018 * recommended. The calibration procedure can be found in the SPARKMini User Manual available from
019 * REV Robotics.
020 *
021 * <ul>
022 *   <li>2.500ms = full "forward"
023 *   <li>1.510ms = the "high end" of the deadband range
024 *   <li>1.500ms = center of the deadband range (off)
025 *   <li>1.490ms = the "low end" of the deadband range
026 *   <li>0.500ms = full "reverse"
027 * </ul>
028 */
029public class SparkMini extends PWMMotorController {
030  /**
031   * Constructor.
032   *
033   * @param channel The PWM channel that the SPARKMini is attached to. 0-9 are on-board, 10-19
034   *     are on the MXP port
035   */
036  @SuppressWarnings("this-escape")
037  public SparkMini(final int channel) {
038    super("SparkMini", channel);
039
040    setBoundsMicroseconds(2500, 1510, 1500, 1490, 500);
041    m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
042    setSpeed(0.0);
043
044    HAL.reportUsage("IO", getChannel(), "RevSPARK");
045  }
046}