ssd1327_a.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef __SSD1327__
  2. #define __SSD1327__
  3. #define FONT_NORMAL 0
  4. #define FONT_LARGE 1
  5. #define FONT_SMALL 2
  6. enum {
  7. OLED_128x128 = 0, // SSD1327
  8. OLED_256x64 // SSD1322
  9. };
  10. #if defined(_LINUX_) && defined(__cplusplus)
  11. extern "C" {
  12. #endif
  13. //
  14. // Draw an outline or filled Ellipse
  15. //
  16. void ssd1327Ellipse(int32_t iCenterX, int32_t iCenterY, int32_t iRadiusX, int32_t iRadiusY, uint8_t ucColor, int bFilled);
  17. //
  18. // Initializes the OLED controller into "page mode" on I2C
  19. // If SDAPin and SCLPin are not -1, then bit bang I2C on those pins
  20. // Otherwise use the Wire library
  21. //
  22. void ssd1327Init(int iType, int iAddr, int bFlip, int bInvert, int iSDAPin, int iSCLPin, int32_t iSpeed);
  23. //
  24. // Initialize an SPI version of the display
  25. //
  26. void ssd1327SPIInit(int iType, int iDC, int iCS, int iReset, int bFlip, int bInvert, int32_t iSpeed);
  27. //
  28. // Sets the brightness (0=off, 255=brightest)
  29. //
  30. void ssd1327SetContrast(unsigned char ucContrast);
  31. //
  32. // Sends a command to turn off the OLED display
  33. //
  34. void ssd1327Shutdown(void);
  35. //
  36. // Power up/down the display
  37. // useful for low power situations
  38. //
  39. void ssd1327Power(unsigned char bOn);
  40. //
  41. // Draw a string of normal (8x8), small (6x8) or large (16x32) characters
  42. // At the given col+row with the given foreground (MSN) and background (LSN) colors
  43. //
  44. void ssd1327WriteString(uint8_t x, uint8_t y, char *szMsg, uint8_t iSize, int ucFGColor, int ucBGColor);
  45. //
  46. // Fill the frame buffer with a color
  47. // e.g. black (0x00) or white (0xf)
  48. //
  49. void ssd1327Fill(unsigned char ucColor);
  50. // non-AVR MCUs have enough RAM to support a 8k back buffer
  51. // and additional functions that require it
  52. #ifndef __AVR__
  53. //
  54. // Set an individual pixel to a specific color
  55. // The pixel is only set in the back buffer and some time
  56. // later the display buffer will need to be dumped to the physical display
  57. //
  58. void ssd1327SetPixel(int x, int y, unsigned char ucColor);
  59. //
  60. // Copy part or whole of the backbuffer or custom bitmap to the physical display
  61. // Pass a NULL pointer to use the backbuffer
  62. //
  63. void ssd1327ShowBitmap(uint8_t *pBuffer, int iLocalPitch, int x, int y, int w, int h);
  64. //
  65. // Return a pointer to the back buffer for direct manipulation
  66. //
  67. uint8_t * ssd1327GetBackbuffer(void);
  68. //
  69. // Draw a Bresenham line from point 1 to point 2
  70. //
  71. void ssd1327DrawLine(int x1, int y1, int x2, int y2, uint8_t ucColor);
  72. //
  73. // Rotate a 1-bpp or 4-bpp image around a given center point
  74. // valid angles are 0-359
  75. //
  76. void ssd1327RotateBitmap(uint8_t *pSrc, uint8_t *pDest, int iBpp, int iWidth, int iHeight, int iPitch, int iCenterX, int iCenterY, int iAngle);
  77. //
  78. // Draw 1-bpp image pattern with transparency
  79. //
  80. void ssd1327DrawPattern(uint8_t *pPattern, int iSrcPitch, int iDestX, int iDestY, int iCX, int iCY, uint8_t ucColor);
  81. void ssd1327Rectangle(int x, int y, int w, int h, uint8_t ucColor, int bFill);
  82. #endif // __AVR__
  83. #if defined(_LINUX_) && defined(__cplusplus)
  84. }
  85. #endif
  86. #endif // __SSD1327__