-
Notifications
You must be signed in to change notification settings - Fork 0
CreateSpark #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CreateSpark #124
Changes from all commits
4b8eee7
e7fe9f9
caab1c5
de8900b
7943e8a
3fec01c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,6 +56,37 @@ public static WPI_TalonSRX createTalon(int id) { | |||||||||
|
|
||||||||||
| return talon; | ||||||||||
| } | ||||||||||
| /** | ||||||||||
| * This class returns a SparkBase, initialized to either a SparkMax or SparkFlex depending on the {@link MotorConfig#controllerType}. | ||||||||||
| * Note that SparkBase lacks some of the functionality of SparkMax and SparkFlex, use {@link MotorControllerFactory#createSparkMax(int, MotorConfig)} or {@link MotorControllerFactory#createSparkFlex(int)} to get a SparkMax or SparkFlex object. | ||||||||||
| * To use the configAccessor, use {@link MotorControllerFactory#getConfigAccessor(SparkBase)} | ||||||||||
| * | ||||||||||
| * @param id the port of the motor controller | ||||||||||
| * @param motorConfig the motor configuration to use | ||||||||||
| */ | ||||||||||
| public static SparkBase createSpark(int id, MotorConfig motorConfig) { | ||||||||||
| return createSpark(id, motorConfig, sparkConfig(motorConfig)); | ||||||||||
| } | ||||||||||
| /** | ||||||||||
| * This class returns a SparkBase, initialized to either a SparkMax or SparkFlex depending on the {@link MotorConfig#controllerType}. | ||||||||||
| * Note that SparkBase lacks some of the functionality of SparkMax and SparkFlex, use {@link MotorControllerFactory#createSparkMax(int, MotorConfig, SparkBaseConfig)} or {@link MotorControllerFactory#createSparkFlex(int, MotorConfig, SparkBaseConfig)} to get a SparkMax or SparkFlex object. | ||||||||||
| * To use the configAccessor, use {@link MotorControllerFactory#getConfigAccessor(SparkBase)} | ||||||||||
| * | ||||||||||
| * @param id the port of the motor controller | ||||||||||
| * @param motorConfig the motor configuration to use | ||||||||||
timtogan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| * @param config the custom SparkBase configuration to apply instead of the default for the motorConfig | ||||||||||
| */ | ||||||||||
| public static SparkBase createSpark(int id, MotorConfig motorConfig, SparkBaseConfig config) { | ||||||||||
| switch(motorConfig.controllerType){ | ||||||||||
| case SPARK_MAX: | ||||||||||
| return createSparkMax(id, motorConfig, config); | ||||||||||
| case SPARK_FLEX: | ||||||||||
| return createSparkFlex(id, motorConfig, config); | ||||||||||
| default: | ||||||||||
| return null; | ||||||||||
|
||||||||||
| return null; | |
| throw new IllegalArgumentException( | |
| "Unsupported controllerType in MotorControllerFactory.createSpark: " | |
| + motorConfig.controllerType); |
Uh oh!
There was an error while loading. Please reload this page.