color_utils.h 839 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef APP_MODULES_COLOR_UTILS_H_
  2. #define APP_MODULES_COLOR_UTILS_H_
  3. #include "module.h"
  4. #include "lauxlib.h"
  5. #include "lmem.h"
  6. #include "platform.h"
  7. #include <stdlib.h>
  8. #include <math.h>
  9. #include <string.h>
  10. #include "user_interface.h"
  11. #include "osapi.h"
  12. /**
  13. * Convert hsv to grb
  14. * hue is 0-360, sat and val are 0-255
  15. */
  16. uint32_t hsv2grb(uint16_t hue, uint8_t sat, uint8_t val);
  17. /**
  18. * Convert hsv to grbw
  19. * hue is 0-360, sat and val are 0-255
  20. */
  21. uint32_t hsv2grbw(uint16_t hue, uint8_t sat, uint8_t val);
  22. /**
  23. * Convert grb to hsv
  24. * g, r, b are 0-255
  25. */
  26. uint32_t grb2hsv(uint8_t g, uint8_t r, uint8_t b);
  27. /**
  28. * The color wheel function provides colors from r -> g -> b -> r.
  29. * They are fully saturated and with full brightness.
  30. * degree is from 0-360
  31. */
  32. uint32_t color_wheel(uint16_t degree);
  33. #endif /* APP_MODULES_COLOR_UTILS_H_ */