MPM controlled 16ch RGB LED dimmer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6KB

  1. #ifndef _RGB16MPM_H_
  2. #define _RGB16MPM_H_
  3. #define F_CPU 8000000
  4. #include <util/delay.h>
  5. #define ROW1 PORTB1 /* RED */
  6. #define ROW2 PORTB0 /* GREEN */
  7. #define ROW3 PORTB3 /* BLUE */
  8. #define ROW4 PORTB2 /* not used */
  9. #define RXTX PORTD2 /* RS485 TX enable */
  10. #define LED PORTD3
  11. /* running without mpmboot? */
  12. #define STANDALONE 0
  13. #if (STANDALONE)
  14. #define OSCCAL 0xAA
  15. #define BAUDRATE 115200
  16. #define MPM_ADDRESS 0x11
  17. #endif /* STANDALONE */
  18. #define COLOR_RED 0
  19. #define COLOR_GREEN 1
  20. #define COLOR_BLUE 2
  21. #define COLOR_MASK ((1<<COLOR_RED) | (1<<COLOR_GREEN) | (1<<COLOR_BLUE))
  22. struct _nvdata {
  23. uint16_t nvram_size; /* first */
  24. uint8_t initialRGB[3][16]; /* initial color values */
  25. uint16_t nvram_crc; /* last */
  26. };
  27. #define NVRAM_DEFAULTS {\
  28. .initialRGB = { { 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x20, 0x40, 0x80, 0xFF, }, \
  29. { 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x80, 0xFF, }, \
  30. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20, 0x40, 0x80, 0xFF, } }, \
  31. };
  32. /* eeprom.c vars */
  33. extern struct _nvdata nvram_data;
  34. /* eeprom.c funcs */
  35. void eeprom_write(void);
  36. void eeprom_read(void);
  37. /* mpmctrl.c funcs */
  38. void mpm_init(void);
  39. /* rgbctrl.c vars */
  40. extern uint8_t chan_value[3][16];
  41. /* rgbctrl.c funcs */
  42. void rgb_init(void);
  43. uint8_t rgb_update(uint8_t dirty_mask, uint8_t blocking);
  44. #endif /* _RGB16MPM_H_ */