WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
AddressableLED.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
10#include "wpi/hal/Types.h"
11
12/**
13 * @defgroup hal_addressable Addressable LED Functions
14 * @ingroup hal_capi
15 * @{
16 */
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * Creates a new instance of an addressable LED.
24 *
25 * @param[in] channel the smartio channel
26 * @param[in] allocationLocation the location where the allocation is occurring
27 * (can be null)
28 * @param[out] status the error code, or 0 for success
29 * @return Addressable LED handle
30 */
32 int32_t channel, const char* allocationLocation, int32_t* status);
33
34/**
35 * Free the Addressable LED Handle.
36 *
37 * @param[in] handle the Addressable LED handle to free
38 */
40
41/**
42 * Sets the start buffer location used for the LED strip.
43 *
44 * <p>All addressable LEDs use a single backing buffer 1024 LEDs in size.
45 * The max length for a single output is 1024 LEDs (with an offset of zero).
46 *
47 * @param[in] handle the Addressable LED handle
48 * @param[in] start the strip start, in LEDs
49 * @param[out] status the error code, or 0 for success
50 */
52 int32_t* status);
53
54/**
55 * Sets the length of the LED strip.
56 *
57 * <p>All addressable LEDs use a single backing buffer 1024 LEDs in size.
58 * The max length for a single output is 1024 LEDs (with an offset of zero).
59 *
60 * @param[in] handle the Addressable LED handle
61 * @param[in] length the strip length, in LEDs
62 * @param[out] status the error code, or 0 for success
63 */
65 int32_t length, int32_t* status);
66
67/**
68 * Sets the led output data.
69 *
70 * <p>All addressable LEDs use a single backing buffer 1024 LEDs in size.
71 * This function may be used to set part of or all of the buffer.
72 *
73 * @param[in] start the strip start, in LEDs
74 * @param[in] length the strip length, in LEDs
75 * @param[in] colorOrder the color order
76 * @param[in] data the buffer to write
77 * @param[out] status the error code, or 0 for success
78 */
79void HAL_SetAddressableLEDData(int32_t start, int32_t length,
81 const struct HAL_AddressableLEDData* data,
82 int32_t* status);
83
84#ifdef __cplusplus
85} // extern "C"
86#endif
87/** @} */
HAL_AddressableLEDColorOrder
Order that color data is sent over the wire.
Definition AddressableLEDTypes.h:24
void HAL_SetAddressableLEDData(int32_t start, int32_t length, HAL_AddressableLEDColorOrder colorOrder, const struct HAL_AddressableLEDData *data, int32_t *status)
Sets the led output data.
HAL_AddressableLEDHandle HAL_InitializeAddressableLED(int32_t channel, const char *allocationLocation, int32_t *status)
Creates a new instance of an addressable LED.
void HAL_SetAddressableLEDLength(HAL_AddressableLEDHandle handle, int32_t length, int32_t *status)
Sets the length of the LED strip.
void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle)
Free the Addressable LED Handle.
void HAL_SetAddressableLEDStart(HAL_AddressableLEDHandle handle, int32_t start, int32_t *status)
Sets the start buffer location used for the LED strip.
HAL_Handle HAL_AddressableLEDHandle
Definition Types.h:61
structure for holding one LED's color data.
Definition AddressableLEDTypes.h:15