brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame^] | 1 | #include "aos/crio/Talon.h" |
| 2 | #include "WPILib/DigitalModule.h" |
| 3 | |
| 4 | Talon::Talon(UINT32 channel) : SafePWM(channel) { |
| 5 | // 255 = 2.5ms, 0 = 0.5ms (or something close to that) |
| 6 | // these numbers were determined empirically with real hardware by Brian |
| 7 | // on 11/23/12 |
| 8 | // got 211->210 as first transition that made a speed difference and |
| 9 | // 53->54 on the other side |
| 10 | // going 2 to each side to make sure we get the full range |
| 11 | SetBounds(213, 137, 132, 127, 50); |
| 12 | // 1X = every 5.05ms, 2X and 4x are multiples of that |
| 13 | SetPeriodMultiplier(kPeriodMultiplier_1X); |
| 14 | SetRaw(m_centerPwm); |
| 15 | } |
| 16 | |
| 17 | void Talon::Set(float speed, UINT8 /*syncGroup*/) { SetSpeed(speed); } |
| 18 | float Talon::Get() { return GetSpeed(); } |
| 19 | void Talon::Disable() { SetRaw(kPwmDisabled); } |
| 20 | |
| 21 | void Talon::PIDWrite(float output) { Set(output); } |