WPILibC++ 2024.3.2
Relay.h
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 <stdint.h>
8
9#include "hal/Types.h"
10
11/**
12 * @defgroup hal_relay Relay Output Functions
13 * @ingroup hal_capi
14 * @{
15 */
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/**
22 * Initializes a relay.
23 *
24 * Note this call will only initialize either the forward or reverse port of the
25 * relay. If you need both, you will need to initialize 2 relays.
26 *
27 * @param[in] portHandle the port handle to initialize
28 * @param[in] fwd true for the forward port, false for the
29 * reverse port
30 * @param[in] allocationLocation the location where the allocation is occurring
31 * (can be null)
32 * @param[out] status Error status variable. 0 on success.
33 * @return the created relay handle
34 */
36 const char* allocationLocation,
37 int32_t* status);
38
39/**
40 * Frees a relay port.
41 *
42 * @param relayPortHandle the relay handle
43 */
44void HAL_FreeRelayPort(HAL_RelayHandle relayPortHandle);
45
46/**
47 * Checks if a relay channel is valid.
48 *
49 * @param channel the channel to check
50 * @return true if the channel is valid, otherwise false
51 */
53
54/**
55 * Sets the state of a relay output.
56 *
57 * @param[in] relayPortHandle the relay handle
58 * @param[in] on true for on, false for off
59 * @param[out] status Error status variable. 0 on success.
60 */
62 int32_t* status);
63
64/**
65 * Gets the current state of the relay channel.
66 *
67 * @param[in] relayPortHandle the relay handle
68 * @param[out] status Error status variable. 0 on success.
69 * @return true for on, false for off
70 */
71HAL_Bool HAL_GetRelay(HAL_RelayHandle relayPortHandle, int32_t* status);
72#ifdef __cplusplus
73} // extern "C"
74#endif
75/** @} */
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based on(or derived from) the Work and for which the editorial revisions
void HAL_SetRelay(HAL_RelayHandle relayPortHandle, HAL_Bool on, int32_t *status)
Sets the state of a relay output.
void HAL_FreeRelayPort(HAL_RelayHandle relayPortHandle)
Frees a relay port.
HAL_Bool HAL_GetRelay(HAL_RelayHandle relayPortHandle, int32_t *status)
Gets the current state of the relay channel.
HAL_Bool HAL_CheckRelayChannel(int32_t channel)
Checks if a relay channel is valid.
HAL_RelayHandle HAL_InitializeRelayPort(HAL_PortHandle portHandle, HAL_Bool fwd, const char *allocationLocation, int32_t *status)
Initializes a relay.
int32_t HAL_Bool
Definition: Types.h:73
HAL_Handle HAL_PortHandle
Definition: Types.h:19
HAL_Handle HAL_RelayHandle
Definition: Types.h:45