Advertisement
Guest User

tlc5940.h

a guest
Mar 29th, 2014
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.56 KB | None | 0 0
  1.  
  2.  
  3. #ifndef TEENSY_TLC5940_h
  4. #define TEENSY_TLC5940_h
  5.  
  6. #include <Arduino.h>
  7. #include <inttypes.h>
  8.  
  9.  
  10. ////////////////////////////////////////////////////////////////////////////////
  11. /// Configuration
  12. ///
  13. /// Timers and Pins on the Teensy 3
  14. /// - Timer 0:
  15. /// -- ch 0 = pin 22 (native pin 44)
  16. /// -- ch 1 = pin 23 (native pin 45)
  17. /// -- ch 2 = pin  9 (native pin 46)
  18. /// -- ch 3 = pin 10 (native pin 49)
  19. /// -- ch 4 = pin  6 (native pin 61)
  20. /// -- ch 5 = pin 20 (native pin 62)
  21. /// -- ch 6 = pin 21 (native pin 63)
  22. /// -- ch 7 = pin  5 (native pin 64)
  23. /// - Timer 1:
  24. /// -- ch 0 = pin 3 (native pin 28)
  25. /// -- ch 1 = pin 4 (native pin 29)
  26. ///
  27.  
  28. // # of TLC5940 chips daisy-chained:
  29. #define NUM_TLCS 3
  30.  
  31.  
  32. // The following array specifies the initial dot-correction data for the
  33. // TLC5940 output channels.  0 disables all output on that channel, 63 means
  34. // that maximum output is allowed.  There should be as many entries as there
  35. // are TLC5940 output channels (i.e. NUM_TLCS * 16).  The first entry is
  36. // channel 0.
  37.  
  38. #define INITIAL_DCDATA {23, 23, 23, \
  39.                         23, 23, 23, \
  40.                         23, 23, 23, \
  41.                         23, 23, 23, \
  42.                         23, 23, 23, \
  43.                         23, 23, 23, \
  44.                         23, 23, 23, \
  45.                         23, 23, 23, \
  46.                         23, 23, 23, \
  47.                         23, 23, 23, \
  48.                         23, 23, 23, \
  49.                         23, 23, 23, \
  50.                         23, 23, 23, \
  51.                         23, 23, 23, \
  52.                         23, 23, 23, \
  53.                         23, 23, 23 }
  54.  
  55. //#define INITIAL_DCDATA {63, 63, 63, \
  56. //                        63, 63, 63, \
  57. //                        63, 63, 63, \
  58. //                        63, 63, 63, \
  59. //                        63, 63, 63, \
  60. //                        63}
  61.  
  62.  
  63. ////////////////////////////////////////////////////////////////////////////////
  64. /// External functions
  65.  
  66. extern void initTLC5940 ();
  67. extern void sleepTLC5940 ();
  68. extern void wakeTLC5940 ();
  69.  
  70. extern void setGSData(int tlcOutput, uint16_t value);
  71. extern uint16_t getGSData(int tlcOutput);
  72. extern void setAllGSData(uint16_t value);
  73. extern void sendGSData (byte leds);
  74. extern boolean unlatchedGSData();
  75. extern volatile boolean tlc_needXLAT;
  76.  
  77. extern void setDCData(int tlcOutput, uint8_t value);
  78. extern uint8_t getDCData(int tlcOutput);
  79. extern void sendDCData ();
  80.  
  81.  
  82. #endif  // TEENSY_TLC5940_h
  83.  
  84. ////////////////////////////////////////////////////////////////////////////////
  85. /// End of Code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement