2
0

epd4in2_V2.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * @filename : epd4in2_V2.h
  3. * @brief : Header file for Dual-color e-paper library epd4in2.cpp
  4. * @author : Yehui from Waveshare
  5. *
  6. * Copyright (C) Waveshare August 10 2017
  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 EPD4IN2_H
  27. #define EPD4IN2_H
  28. #include "epdif.h"
  29. // Display resolution
  30. #define EPD_WIDTH 400
  31. #define EPD_HEIGHT 300
  32. #define Seconds_1_5S 0
  33. #define Seconds_1S 1
  34. extern const unsigned char LUT_ALL[];
  35. class Epd : EpdIf {
  36. public:
  37. unsigned int width;
  38. unsigned int height;
  39. Epd();
  40. ~Epd();
  41. int Init(void);
  42. int Init_Fast(char mode);
  43. void Lut(void);
  44. int Init_4Gray(void);
  45. void SendCommand(unsigned char command);
  46. void SendData(unsigned char data);
  47. void ReadBusy(void);
  48. void Reset(void);
  49. void TurnOnDisplay(void);
  50. void TurnOnDisplay_Fast(void);
  51. void TurnOnDisplay_Partial(void);
  52. void TurnOnDisplay_4Gray(void);
  53. void Clear(void);
  54. void Display(const unsigned char* Image);
  55. void Display_Fast(const unsigned char* Image);
  56. void Display_Base(const unsigned char* Image);
  57. void Display_Partial(unsigned char* Image, unsigned int Xstart, unsigned int Ystart, unsigned int Xend, unsigned int Yend);
  58. void Display_Partial_Not_refresh(unsigned char* Image, unsigned int Xstart, unsigned int Ystart, unsigned int Xend, unsigned int Yend);
  59. void Set_4GrayDisplay(const unsigned char *Image, int x, int y, int w, int l);
  60. void Sleep(void);
  61. private:
  62. unsigned int reset_pin;
  63. unsigned int dc_pin;
  64. unsigned int cs_pin;
  65. unsigned int busy_pin;
  66. };
  67. #endif /* EPD4IN2_H */
  68. /* END OF FILE */