001/*
002 * Copyright (c) 2018-2021 REV Robotics
003 *
004 * Redistribution and use in source and binary forms, with or without
005 * modification, are permitted provided that the following conditions are met:
006 *
007 * 1. Redistributions of source code must retain the above copyright notice,
008 *    this list of conditions and the following disclaimer.
009 * 2. Redistributions in binary form must reproduce the above copyright
010 *    notice, this list of conditions and the following disclaimer in the
011 *    documentation and/or other materials provided with the distribution.
012 * 3. Neither the name of REV Robotics nor the names of its
013 *    contributors may be used to endorse or promote products derived from
014 *    this software without specific prior written permission.
015 *
016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
017 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
018 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
019 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
020 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
021 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
022 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
023 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
024 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
025 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
026 * POSSIBILITY OF SUCH DAMAGE.
027 */
028
029package com.revrobotics;
030
031/** @deprecated Use {@link SparkMaxLimitSwitch} instead. */
032@Deprecated(forRemoval = true)
033public interface CANDigitalInput {
034  /** @deprecated Use {@link SparkMaxLimitSwitch.Type} instead. */
035  @Deprecated(forRemoval = true)
036  public enum LimitSwitchPolarity {
037    kNormallyOpen(0),
038    kNormallyClosed(1);
039
040    @SuppressWarnings("MemberName")
041    public final int value;
042
043    LimitSwitchPolarity(int value) {
044      this.value = value;
045    }
046  }
047
048  /**
049   * Returns {@code true} if the limit switch is pressed, based on the selected polarity.
050   *
051   * <p>This method works even if the limit switch is not enabled.
052   *
053   * @return {@code true} if the limit switch is pressed
054   */
055  public boolean get();
056
057  /**
058   * Enables or disables controller shutdown based on limit switch.
059   *
060   * @param enable Enable/disable motor shutdown based on limit switch state. This does not affect
061   *     the result of the get() command.
062   * @return {@link REVLibError#kOk} if successful
063   */
064  public REVLibError enableLimitSwitch(boolean enable);
065
066  /** @return {@code true} if limit switch is enabled */
067  public boolean isLimitSwitchEnabled();
068}