87 lines
3.7 KiB
C
87 lines
3.7 KiB
C
|
|
/*
|
|
* This program source code file is part of SystemK, a library in the KTag project.
|
|
*
|
|
* 🛡️ <https://ktag.clubk.club> 🃞
|
|
*
|
|
* Copyright © 2016-2025 Joseph P. Kearney and the KTag developers.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
* the terms of the GNU Affero General Public License as published by the Free
|
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
|
* later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
* details.
|
|
*
|
|
* There should be a copy of the GNU Affero General Public License in the LICENSE
|
|
* file in the root of this repository. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
|
|
// '||' || '|| '||''|. TM
|
|
// || ... || || || ... .. ... ... .... ...
|
|
// || || || ||'''|. ||' '' || || '|. |
|
|
// || || || || || || || || '|.|
|
|
// .||.....| .||. .||. .||...|' .||. '|..'|. '|
|
|
|
|
|
|
|
|
//! Zero-based index of the Barrel Flash NeoPixel in the sequence of NeoPixels.
|
|
#define BARREL_FLASH_PIXEL 0
|
|
//! Zero-based index of the Heart NeoPixel in the sequence of NeoPixels.
|
|
#define HEART_PIXEL 1
|
|
//! Zero-based index of the Square NeoPixel in the sequence of NeoPixels.
|
|
#define SQUARE_PIXEL 2
|
|
//! Zero-based index of the Circle NeoPixel in the sequence of NeoPixels.
|
|
#define CIRCLE_PIXEL 3
|
|
//! Zero-based index of the Arrow NeoPixel in the sequence of NeoPixels.
|
|
#define ARROW_PIXEL 4
|
|
|
|
//! Sets the color of the Barrel Flash NeoPixel, applying gamma correction.
|
|
/*!
|
|
* \note The diffused 5mm LEDs (from AdaFruit and Ali Express) for barrel flash have a different color order (RGB vs. GRB)!
|
|
*/
|
|
static inline __attribute__((always_inline)) void Set_Barrel_Flash(color_t color)
|
|
{
|
|
HW_NeoPixels_Set_RGB(NEOPIXEL_CHANNEL_BARREL, BARREL_FLASH_PIXEL, Gamma8[Red(color)], Gamma8[Green(color)], Gamma8[Blue(color)]);
|
|
}
|
|
|
|
//! Sets the color of the Heart NeoPixel, applying gamma correction.
|
|
/*!
|
|
* \note The [WS2812B NeoPixels](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf) use a GRB color order.
|
|
*/
|
|
static inline __attribute__((always_inline)) void Set_Heart(color_t color)
|
|
{
|
|
HW_NeoPixels_Set_RGB(NEOPIXEL_CHANNEL_BARREL, HEART_PIXEL, Gamma8[Green(color)], Gamma8[Red(color)], Gamma8[Blue(color)]);
|
|
}
|
|
|
|
//! Sets the color of the Square NeoPixel, applying gamma correction.
|
|
/*!
|
|
* \note The [WS2812B NeoPixels](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf) use a GRB color order.
|
|
*/
|
|
static inline __attribute__((always_inline)) void Set_Square(color_t color)
|
|
{
|
|
HW_NeoPixels_Set_RGB(NEOPIXEL_CHANNEL_BARREL, SQUARE_PIXEL, Gamma8[Green(color)], Gamma8[Red(color)], Gamma8[Blue(color)]);
|
|
}
|
|
|
|
//! Sets the color of the Circle NeoPixel, applying gamma correction.
|
|
/*!
|
|
* \note The [WS2812B NeoPixels](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf) use a GRB color order.
|
|
*/
|
|
static inline __attribute__((always_inline)) void Set_Circle(color_t color)
|
|
{
|
|
HW_NeoPixels_Set_RGB(NEOPIXEL_CHANNEL_BARREL, CIRCLE_PIXEL, Gamma8[Green(color)], Gamma8[Red(color)], Gamma8[Blue(color)]);
|
|
}
|
|
|
|
//! Sets the color of the Arrow NeoPixel, applying gamma correction.
|
|
/*!
|
|
* \note The [WS2812B NeoPixels](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf) use a GRB color order.
|
|
*/
|
|
static inline __attribute__((always_inline)) void Set_Arrow(color_t color)
|
|
{
|
|
HW_NeoPixels_Set_RGB(NEOPIXEL_CHANNEL_BARREL, ARROW_PIXEL, Gamma8[Green(color)], Gamma8[Red(color)], Gamma8[Blue(color)]);
|
|
}
|