OLED_SSD1306_ATY.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @file OLED_SSD1306_ATY.h
  3. *
  4. * @param Project DEVICE_GENERAL_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2023 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Base functions of GP22 for all embedded device
  20. *
  21. * @version
  22. * - 1_01_220901 > ATY
  23. * -# Preliminary version, first Release
  24. ********************************************************************************
  25. */
  26. #ifndef __OLED_SSD1306_ATY_H
  27. #define __OLED_SSD1306_ATY_H
  28. #include "INCLUDE_ATY.h"
  29. #include "HW_GPIO_ATY.h"
  30. #include "HW_I2C_ATY.h"
  31. #include "OLED_FONT_ATY.h"
  32. /******************************* For user *************************************/
  33. // #define __DEBUG_OLED_SSD1306_ATY
  34. /******************************************************************************/
  35. #define BRIGHTNESS 0xCF
  36. #define X_WIDTH 128
  37. // #define X_WIDTH 128
  38. #define Y_WIDTH 32
  39. // #define Y_WIDTH 64
  40. #define MENU_IN 0
  41. #define MENU_OUT 1
  42. void OLED_WriteData(uint8_t oledData);
  43. void OLED_WriteCmd(uint8_t oledCmd);
  44. void OLED_SetPos(uint8_t x, uint8_t y);
  45. void OLED_FillScreen(uint8_t fillData);
  46. void OLED_Init(void);
  47. void OLED_DrawChar8x16(uint8_t x, uint8_t y, uint8_t symbol[]);
  48. void OLED_DrawChar16x16(uint8_t x, uint8_t y, uint8_t symbol[]);
  49. // void OLED_DrawString8x16(uint8_t x, uint8_t y, uint8_t* str, uint8_t len, uint8_t* font);
  50. #define OLED_DrawString8x16(x, y, str, font) \
  51. do{ \
  52. uint8_t i = 0, xi = x, yi = y; \
  53. for(i = 0; i < (sizeof(str) - 1); i++) { \
  54. if(xi > 120) { \
  55. xi = 0; \
  56. yi += 2; \
  57. } \
  58. if(yi > 6) \
  59. break; \
  60. OLED_DrawChar8x16(xi, yi, font + (((str)[i] - 32) * 16)); \
  61. xi += 8; \
  62. } \
  63. }while(0)
  64. uint8_t NumToChar(uint8_t num);
  65. void OLED_Dis_Welcom(void);
  66. #endif /* __OLED_SSD1306_ATY_H */