mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-17 04:34:44 -07:00
Add color compare api
This commit is contained in:
@@ -1734,6 +1734,7 @@ Function,+,hex_char_to_uint8,_Bool,"char, char, uint8_t*"
|
||||
Function,+,hex_chars_to_uint64,_Bool,"const char*, uint64_t*"
|
||||
Function,+,hex_chars_to_uint8,_Bool,"const char*, uint8_t*"
|
||||
Function,+,hsv2rgb,RgbColor,HsvColor
|
||||
Function,+,hsvcmp,int,"HsvColor*, HsvColor*"
|
||||
Function,-,hypot,double,"double, double"
|
||||
Function,-,hypotf,float,"float, float"
|
||||
Function,-,hypotl,long double,"long double, long double"
|
||||
@@ -2571,6 +2572,7 @@ Function,+,rgb_backlight_set_rainbow_interval,void,uint32_t
|
||||
Function,+,rgb_backlight_set_rainbow_mode,void,RGBBacklightRainbowMode
|
||||
Function,+,rgb_backlight_set_rainbow_speed,void,uint8_t
|
||||
Function,-,rgb_backlight_update,void,"uint8_t, _Bool"
|
||||
Function,+,rgbcmp,int,"RgbColor*, RgbColor*"
|
||||
Function,-,rindex,char*,"const char*, int"
|
||||
Function,-,rint,double,double
|
||||
Function,-,rintf,float,float
|
||||
|
||||
|
@@ -2,6 +2,14 @@
|
||||
|
||||
#include "colors.h"
|
||||
|
||||
inline int rgbcmp(RgbColor* a, RgbColor* b) {
|
||||
return memcmp(a, b, sizeof(RgbColor));
|
||||
}
|
||||
|
||||
inline int hsvcmp(HsvColor* a, HsvColor* b) {
|
||||
return memcmp(a, b, sizeof(HsvColor));
|
||||
}
|
||||
|
||||
RgbColor hsv2rgb(HsvColor hsv) {
|
||||
RgbColor rgb;
|
||||
uint8_t region, remainder, p, q, t;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -18,6 +19,10 @@ typedef struct HsvColor {
|
||||
uint8_t v;
|
||||
} HsvColor;
|
||||
|
||||
int rgbcmp(RgbColor* a, RgbColor* b);
|
||||
|
||||
int hsvcmp(HsvColor* a, HsvColor* b);
|
||||
|
||||
RgbColor hsv2rgb(HsvColor hsv);
|
||||
|
||||
HsvColor rgb2hsv(RgbColor rgb);
|
||||
|
||||
Reference in New Issue
Block a user