max7219.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __MAX7219_LIBRARY__
  2. #define __MAX7219_LIBRARY__
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. //
  17. //
  18. // Power on or off the LED controllers
  19. //
  20. void maxPowerUp(uint8_t bPowerUp);
  21. //
  22. // Set the intensity (duty cycle of PWM signal) for the LED segments
  23. // valid values are 0 (dimmest) to 15 (brightest)
  24. //
  25. void maxSetIntensity(uint8_t bIntensity);
  26. //
  27. // Set the segment decode mode (BCD or none)
  28. //
  29. void maxSetSegmentMode(uint8_t bMode);
  30. //
  31. // Send image data to the array of controllers
  32. // The image data is transmitted as N by 8 lines tall (N is the number of MAX7219 controllers)
  33. // The pitch (uint8_ts per line) can be any value
  34. //
  35. void maxSendImage(uint8_t *pImage, int iPitch, uint8_t rotated);
  36. //
  37. // Enable (1) or disable (0) test mode
  38. // This mode lights up every LED at max brightness
  39. // It can sometimes power up in test mode
  40. //
  41. void maxSetTestMode(uint8_t bOn);
  42. //
  43. // Number of "digits/rows" to control
  44. // valid values are 1-8 active digits/rows
  45. //
  46. void maxSetLimit(uint8_t bLimit);
  47. //
  48. // Send an ASCII string of digits to a 7-segment display
  49. //
  50. void maxSegmentString(char *pString);
  51. //
  52. // Draw a string of characters into the image buffer
  53. // Normal characters are 8x8 and drawn on uint8_t boundaries
  54. // Small characters are 6x8 and drawn on bit boundaries
  55. //
  56. void maxDrawString(char *pString, uint8_t *pImage, uint8_t iPitch, uint8_t bSmall);
  57. //
  58. // Scroll a bitmap N bits left (positive) or right (negative)
  59. // Valid scroll values are +1 to +7 and -1 to -7
  60. // A bitmap is assumed to be iPitch uint8_ts wide by 8 rows tall
  61. // Bits which scroll off one end are added back to the other end
  62. //
  63. void maxScrollBitmap(uint8_t *pBitmap, int iPitch, int iScroll);
  64. //
  65. // Initialize the controllers
  66. // returns 0 for success, -1 for failure
  67. //
  68. int maxInit(uint8_t iNum, uint8_t bDecodeMode, uint8_t iChannel, uint8_t iSelect);
  69. //
  70. // Turn off the LED controllers and free resources
  71. //
  72. void maxShutdown(void);
  73. #endif // __MAX7219_LIBRARY__