REVLib - C++
CANSparkMaxLowLevel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2023 REV Robotics
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of REV Robotics nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#pragma once
30
31#include <stdint.h>
32
33#include <wpi/deprecated.h>
34
35namespace rev {
36
40class WPI_DEPRECATED("Use CANSparkLowLevel instead") CANSparkMaxLowLevel {
41public:
45 enum class WPI_DEPRECATED("Use CANSparkLowLevel::MotorType") MotorType {
46 kBrushed = 0,
47 kBrushless = 1
48 };
49
53 enum class WPI_DEPRECATED("Use CANSparkLowLevel::ControlType instead")
55 kDutyCycle = 0,
56 kVelocity = 1,
57 kVoltage = 2,
58 kPosition = 3,
59 kSmartMotion = 4,
60 kCurrent = 5,
62 };
63
67 enum class WPI_DEPRECATED("Use CANSparkLowLevel::ParameterStatus instead")
69 kOK = 0,
70 kInvalidID = 1,
71 kMismatchType = 2,
72 kAccessMode = 3,
73 kInvalid = 4,
74 kNotImplementedDeprecated = 5,
75 };
76
80 enum class WPI_DEPRECATED("Use CANSparkLowLevel::PeriodicFrame instead")
82 kStatus0 = 0,
83 kStatus1 = 1,
84 kStatus2 = 2,
85 kStatus3 = 3,
86 kStatus4 = 4,
87 kStatus5 = 5,
88 kStatus6 = 6,
89 };
90
96 uint16_t faults;
97 uint16_t stickyFaults;
100 uint8_t lock;
101 uint8_t roboRIO;
102 uint8_t isInverted;
103 uint64_t timestamp;
104 };
105
114 uint64_t timestamp;
115 };
116
122 double iAccum;
123 uint64_t timestamp;
124 };
125
129 enum class TelemetryID {
130 kBusVoltage = 0,
131 kOutputCurrent,
132 kVelocity,
133 kPosition,
134 kIAccum,
135 kAppliedOutput,
136 kMotorTemp,
137 kFaults,
138 kStickyFaults,
139 kAnalogVoltage,
140 kAnalogPosition,
141 kAnalogVelocity,
142 kAltEncPosition,
143 kAltEncVelocity,
144 kTotalStreams
145 };
146
152 float value = 0;
153 uint64_t timestamp = 0;
154 const char* name;
155 const char* units;
156 float lowerBnd;
157 float upperBnd;
158 };
159
164
165private:
167};
168
169} // namespace rev
Definition: CANSparkLowLevel.h:51
Definition: CANSparkMaxLowLevel.h:40
ControlType
Definition: CANSparkMaxLowLevel.h:54
ParameterStatus
Definition: CANSparkMaxLowLevel.h:68
TelemetryID
Definition: CANSparkMaxLowLevel.h:129
PeriodicFrame
Definition: CANSparkMaxLowLevel.h:81
MotorType
Definition: CANSparkMaxLowLevel.h:45
virtual ~CANSparkMaxLowLevel()
Definition: CANSparkMaxLowLevel.h:163
Definition: CANSparkLowLevel.cpp:39
Definition: CANSparkMaxLowLevel.h:94
uint8_t lock
Definition: CANSparkMaxLowLevel.h:100
uint64_t timestamp
Definition: CANSparkMaxLowLevel.h:103
uint8_t roboRIO
Definition: CANSparkMaxLowLevel.h:101
uint8_t isInverted
Definition: CANSparkMaxLowLevel.h:102
MotorType motorType
Definition: CANSparkMaxLowLevel.h:98
bool isFollower
Definition: CANSparkMaxLowLevel.h:99
uint16_t faults
Definition: CANSparkMaxLowLevel.h:96
double appliedOutput
Definition: CANSparkMaxLowLevel.h:95
uint16_t stickyFaults
Definition: CANSparkMaxLowLevel.h:97
Definition: CANSparkMaxLowLevel.h:109
double sensorVelocity
Definition: CANSparkMaxLowLevel.h:110
uint8_t motorTemperature
Definition: CANSparkMaxLowLevel.h:111
double outputCurrent
Definition: CANSparkMaxLowLevel.h:113
double busVoltage
Definition: CANSparkMaxLowLevel.h:112
uint64_t timestamp
Definition: CANSparkMaxLowLevel.h:114
Definition: CANSparkMaxLowLevel.h:120
uint64_t timestamp
Definition: CANSparkMaxLowLevel.h:123
double iAccum
Definition: CANSparkMaxLowLevel.h:122
double sensorPosition
Definition: CANSparkMaxLowLevel.h:121
Definition: CANSparkMaxLowLevel.h:150
float upperBnd
Definition: CANSparkMaxLowLevel.h:157
float lowerBnd
Definition: CANSparkMaxLowLevel.h:156
const char * units
Definition: CANSparkMaxLowLevel.h:155
TelemetryID id
Definition: CANSparkMaxLowLevel.h:151
const char * name
Definition: CANSparkMaxLowLevel.h:154