epdif.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @filename : epdif.h
  3. * @brief : Header file of epdif.cpp providing EPD interface functions
  4. * Users have to implement all the functions in epdif.cpp
  5. * @author : Yehui from Waveshare
  6. *
  7. * Copyright (C) Waveshare August 10 2017
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documnetation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. */
  27. #ifndef EPDIF_H
  28. #define EPDIF_H
  29. #include <Arduino.h>
  30. // Pin definition
  31. #define MOSI_PIN 11
  32. #define SCLK_PIN 13
  33. #define RST_PIN 8
  34. #define DC_PIN 9
  35. #define CS_PIN 10
  36. #define BUSY_PIN 7
  37. #define PWR_PIN 6
  38. class EpdIf {
  39. public:
  40. EpdIf(void);
  41. ~EpdIf(void);
  42. static int IfInit(void);
  43. static void EPD_GPIO_Init();
  44. static void EPD_SPI_Init();
  45. static void EPD_Mode(int pin, char mode);
  46. static void EPD_SendData(unsigned char data);
  47. static unsigned char EPD_ReadData();
  48. static void DigitalWrite(int pin, int value);
  49. static int DigitalRead(int pin);
  50. static void DelayMs(unsigned int delaytime);
  51. static void SpiTransfer(unsigned char data);
  52. };
  53. #endif