DEV_Config.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*****************************************************************************
  2. * | File : DEV_Config.c
  3. * | Author : Waveshare team
  4. * | Function : Hardware underlying interface
  5. * | Info :
  6. * Used to shield the underlying layers of each master
  7. * and enhance portability
  8. *----------------
  9. * | This version: V1.0
  10. * | Date : 2018-11-22
  11. * | Info :
  12. # Permission is hereby granted, free of charge, to any person obtaining a copy
  13. # of this software and associated documnetation files (the "Software"), to deal
  14. # in the Software without restriction, including without limitation the rights
  15. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16. # copies of the Software, and to permit persons to whom the Software is
  17. # furished to do so, subject to the following conditions:
  18. #
  19. # The above copyright notice and this permission notice shall be included in
  20. # all copies or substantial portions of the Software.
  21. #
  22. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  25. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  27. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  28. # THE SOFTWARE.
  29. #
  30. ******************************************************************************/
  31. #ifndef _DEV_CONFIG_H_
  32. #define _DEV_CONFIG_H_
  33. #include <stdint.h>
  34. #include <stdio.h>
  35. #include <SPI.h>
  36. #include "Debug.h"
  37. #include <avr/pgmspace.h>
  38. #define UBYTE uint8_t
  39. #define UWORD uint16_t
  40. #define UDOUBLE uint32_t
  41. /**
  42. * GPIO config
  43. **/
  44. #define EPD_RST_PIN 8
  45. #define EPD_DC_PIN 9
  46. #define EPD_CS_PIN 10
  47. #define EPD_BUSY_PIN 7
  48. /**
  49. * GPIO read and write
  50. **/
  51. #define DEV_Digital_Write(_pin, _value) digitalWrite(_pin, _value == 0? LOW:HIGH)
  52. #define DEV_Digital_Read(_pin) digitalRead(_pin)
  53. /**
  54. * SPI
  55. **/
  56. #define DEV_SPI_WriteByte(_dat) SPI.transfer(_dat)
  57. /**
  58. * delay x ms
  59. **/
  60. #define DEV_Delay_ms(__xms) delay(__xms)
  61. /*-----------------------------------------------------------------------------*/
  62. void Config_Init();
  63. #endif