mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
7c15452c1e
## Link to GitHub Issue, if one exists #41 (partially) ## Description of change This PR adds support for outputting IIDX tape LED data via spiceapi (`iidx_tapeled_get()`). It returns the data as a `dict`, with the key being the LED name and the value being the list of RGB values. You can optionally pass in a variadic list of names to filter the returned data. The new API function is only implemented in Python since I'm not able to test the wrappers in other languages. An example script using the new API is available in this Beef Board PR: https://github.com/HWXLR8/beef-board/pull/133. Demo use case: https://streamable.com/pq5e1e ## Testing Tested in IIDX 32 with custom Beef Board firmware along with a Python script to read and send the tape LED data over USB.
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace tapeledutils {
|
|
|
|
enum led_tape_color_pick_algorithm {
|
|
TAPE_LED_USE_NONE = 0,
|
|
TAPE_LED_USE_FIRST = 1,
|
|
TAPE_LED_USE_MIDDLE = 2,
|
|
TAPE_LED_USE_LAST = 3,
|
|
TAPE_LED_USE_AVERAGE = 4,
|
|
};
|
|
|
|
extern led_tape_color_pick_algorithm TAPE_LED_ALGORITHM;
|
|
|
|
typedef struct {
|
|
float r;
|
|
float g;
|
|
float b;
|
|
} rgb_float3_t;
|
|
|
|
struct tape_led {
|
|
std::vector<rgb_float3_t> data;
|
|
int index_r, index_g, index_b; // Averaged RGB light output indexes
|
|
std::string lightName;
|
|
|
|
tape_led(size_t data_size, int index_r, int index_g, int index_b, std::string lightName)
|
|
: data(std::vector<rgb_float3_t>(data_size)), index_r(index_r), index_g(index_g), index_b(index_b), lightName(std::move(lightName)) {}
|
|
};
|
|
|
|
bool is_enabled();
|
|
rgb_float3_t pick_color_from_led_tape(uint8_t *data, size_t data_size);
|
|
size_t get_led_index_using_avg_algo(size_t data_size);
|
|
}
|