epd2in13b_V4.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * @filename : epd2in13b_V4.h
  3. * @brief : Header file for Three-color e-paper library epd2in13b_V4.cpp
  4. * @author : Yehui from Waveshare
  5. *
  6. * Copyright (C) Waveshare April 25 2022
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documnetation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #ifndef EPD2IN13B_V4_H
  27. #define EPD2IN13B_V4_H
  28. #include "epdif.h"
  29. // Display resolution
  30. #define EPD_WIDTH 122
  31. #define EPD_HEIGHT 250
  32. #define UBYTE uint8_t
  33. #define UWORD uint16_t
  34. #define UDOUBLE uint32_t
  35. class Epd : EpdIf {
  36. public:
  37. int width;
  38. int bufwidth;
  39. int height;
  40. int bufheight;
  41. int count;
  42. Epd();
  43. ~Epd();
  44. int Init(void);
  45. void SendCommand(unsigned char command);
  46. void SendData(unsigned char data);
  47. void WaitUntilIdle(void);
  48. void Reset(void);
  49. void SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend);
  50. void SetCursor(UWORD Xstart, UWORD Ystart);
  51. void DisplayFrame(const unsigned char* frame_buffer_black, const unsigned char* frame_buffer_red);
  52. void DisplayFrame(void);
  53. void Display(const unsigned char* frame_buffer) ;
  54. void ClearFrame(void);
  55. void Sleep(void);
  56. private:
  57. unsigned int reset_pin;
  58. unsigned int dc_pin;
  59. unsigned int cs_pin;
  60. unsigned int busy_pin;
  61. };
  62. #endif
  63. /* END OF FILE */