WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
XRPOnBoardIO.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <memory>
8
11#include "wpi/units/time.hpp"
12
13namespace wpi::xrp {
14
15/**
16 * @ingroup xrp_api
17 * @{
18 */
19
20/**
21 * This class represents the onboard IO of the XRP
22 * reference robot. This the USER push button and
23 * LED.
24 *
25 * <p>DIO 0 - USER Button (input only)
26 * DIO 1 - LED (output only)
27 */
29 public:
30 XRPOnBoardIO() {} // No need to do anything. No configurable IO
31
32 static constexpr auto kMessageInterval = 1_s;
33 wpi::units::second_t m_nextMessageTime = 0_s;
34
35 /**
36 * Gets if the USER button is pressed.
37 *
38 * @return True if the USER button is currently pressed.
39 */
41
42 /**
43 * Sets the yellow LED.
44 *
45 * @param value True to activate LED, false otherwise.
46 */
47 void SetLed(bool value);
48
49 /**
50 * Gets the state of the yellow LED.
51 *
52 * @return True if LED is active, false otherwise.
53 */
54 bool GetLed() const;
55
56 private:
57 wpi::DigitalInput m_userButton{0};
58 wpi::DigitalOutput m_led{1};
59};
60
61/** @} */
62
63} // namespace wpi::xrp
Class to read a digital input.
Definition DigitalInput.hpp:24
Class to write to digital outputs.
Definition DigitalOutput.hpp:23
static constexpr auto kMessageInterval
Definition XRPOnBoardIO.hpp:32
bool GetUserButtonPressed()
Gets if the USER button is pressed.
bool GetLed() const
Gets the state of the yellow LED.
void SetLed(bool value)
Sets the yellow LED.
XRPOnBoardIO()
Definition XRPOnBoardIO.hpp:30
wpi::units::second_t m_nextMessageTime
Definition XRPOnBoardIO.hpp:33
Definition XRPOnBoardIO.hpp:13