stripe.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * stripe.h
  3. *
  4. * Created on: Sep 25, 2017
  5. * Author: Philipp Hinz
  6. */
  7. #ifndef STRIPE_H_
  8. #define STRIPE_H_
  9. // i2c
  10. #define I2C_ADDRESS_STRIPE 0x69
  11. #define STRIPE_CMD_SETR 0x01
  12. #define STRIPE_CMD_SETG 0x02
  13. #define STRIPE_CMD_SETB 0x03
  14. #define STRIPE_CMD_SETW 0x04
  15. #define STRIPE_CMD_SETDIM 0x05
  16. #define STRIPE_CMD_SET 0x06 // Bytes: DIM R G B W
  17. #define STRIPE_CMD_SET2 0x07 // Bytes: DIM R G B
  18. #define STRIPE_CMD_RESET 0x09
  19. #define STRIPE_CMD_FADEOUT 0x0A // Bytes: TIMEH TIMEL
  20. #define STRIPE_CMD_FADETO 0x0B // Bytes: R G B W TIMEH TIMEL
  21. #define STRIPE_CMD_FADESTOP 0x0C
  22. // Color transient (fading) parameters
  23. typedef enum {
  24. TRANS_DIRECT = 0,
  25. TRANS_FAST = 6,
  26. TRANS_MEDIUM = 35,
  27. TRANS_SLOW = 100
  28. } stripe_transient_t;
  29. struct stripe_color {
  30. int red = 0;
  31. int green = 0;
  32. int blue = 0;
  33. };
  34. void *stripeThread(void *threadid);
  35. void *stripeTimerHandler(void *threadid);
  36. void stripeInit(void);
  37. int stripeCommand(int len, char* data);
  38. void stripeUpdate(void);
  39. void stripeUpdateDim(void);
  40. void stripeFadeOut(void);
  41. void stripeSetRGB(int red, int green, int blue);
  42. void stripeSetColor(stripe_color color);
  43. void stripeSetTransient(stripe_transient_t transient);
  44. void stripeSetDim(int dim);
  45. void stripeSetWhite(int white);
  46. void stripeOn(void);
  47. void stripeOff(void);
  48. void stripeGetRGB(int* red, int* green, int* blue);
  49. void stripeGetDim(int* dim);
  50. void stripeGetWhite(int* white);
  51. void stripeEffectDisable(void);
  52. void stripeEffectHeating(int percent);
  53. void stripeEffectPulse(stripe_color color);
  54. #endif /* STRIPE_H_ */