diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 7cb0ef0ee..1c0925050 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -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 diff --git a/lib/toolbox/colors.c b/lib/toolbox/colors.c index 0de9ecf85..612a5f501 100644 --- a/lib/toolbox/colors.c +++ b/lib/toolbox/colors.c @@ -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; diff --git a/lib/toolbox/colors.h b/lib/toolbox/colors.h index 8fc930dbf..2d90a72db 100644 --- a/lib/toolbox/colors.h +++ b/lib/toolbox/colors.h @@ -1,6 +1,7 @@ #pragma once #include +#include #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);