blob: 977ae7bbd7c142ee5ca1033c39c19ca44cebf60b [file] [log] [blame]
Brian Silverman41cdd3e2019-01-19 19:48:58 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#include "frc/SD540.h"
9
10#include <hal/HAL.h>
11
12using namespace frc;
13
14SD540::SD540(int channel) : PWMSpeedController(channel) {
15 /* Note that the SD540 uses the following bounds for PWM values. These values
16 * should work reasonably well for most controllers, but if users experience
17 * issues such as asymmetric behavior around the deadband or inability to
18 * saturate the controller in either direction, calibration is recommended.
19 * The calibration procedure can be found in the SD540 User Manual available
20 * from Mindsensors.
21 *
22 * 2.05ms = full "forward"
23 * 1.55ms = the "high end" of the deadband range
24 * 1.50ms = center of the deadband range (off)
25 * 1.44ms = the "low end" of the deadband range
26 * 0.94ms = full "reverse"
27 */
28 SetBounds(2.05, 1.55, 1.50, 1.44, .94);
29 SetPeriodMultiplier(kPeriodMultiplier_1X);
30 SetSpeed(0.0);
31 SetZeroLatch();
32
33 HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel());
34 SetName("SD540", GetChannel());
35}