epd_config.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*****************************************************************************
  2. * | File : DEV_Config.h
  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: V2.0
  10. * | Date : 2018-10-30
  11. * | Info :
  12. * 1.add:
  13. * UBYTE\UWORD\UDOUBLE
  14. * 2.Change:
  15. * EPD_RST -> EPD_RST_PIN
  16. * EPD_DC -> EPD_DC_PIN
  17. * EPD_CS -> EPD_CS_PIN
  18. * EPD_BUSY -> EPD_BUSY_PIN
  19. * 3.Remote:
  20. * EPD_RST_1\EPD_RST_0
  21. * EPD_DC_1\EPD_DC_0
  22. * EPD_CS_1\EPD_CS_0
  23. * EPD_BUSY_1\EPD_BUSY_0
  24. * 3.add:
  25. * #define DEV_Digital_Write(_pin, _value) bcm2835_gpio_write(_pin, _value)
  26. * #define DEV_Digital_Read(_pin) bcm2835_gpio_lev(_pin)
  27. * #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value)
  28. #
  29. # Permission is hereby granted, free of charge, to any person obtaining a copy
  30. # of this software and associated documnetation files (the "Software"), to deal
  31. # in the Software without restriction, including without limitation the rights
  32. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33. # copies of the Software, and to permit persons to whom the Software is
  34. # furished to do so, subject to the following conditions:
  35. #
  36. # The above copyright notice and this permission notice shall be included in
  37. # all copies or substantial portions of the Software.
  38. #
  39. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41. # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43. # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45. # THE SOFTWARE.
  46. #
  47. ******************************************************************************/
  48. #ifndef _DEV_CONFIG_H_
  49. #define _DEV_CONFIG_H_
  50. #include "main.h"
  51. #include "stm32f1xx_hal.h"
  52. #include "stm32f1xx_hal_gpio.h"
  53. #include <stdint.h>
  54. #include <stdio.h>
  55. /**
  56. * data
  57. **/
  58. #define UBYTE uint8_t
  59. #define UWORD uint16_t
  60. #define UDOUBLE uint32_t
  61. /**
  62. * e-Paper GPIO
  63. **/
  64. #define EPD_RST_PIN RST_GPIO_Port, RST_Pin
  65. #define EPD_DC_PIN DC_GPIO_Port, DC_Pin
  66. //#define EPD_PWR_PIN PWR_GPIO_Port, PWR_Pin
  67. #define EPD_CS_PIN CS_GPIO_Port, CS_Pin
  68. #define EPD_BUSY_PIN BUSY_GPIO_Port, BUSY_Pin
  69. #define EPD_MOSI_PIN DIN_GPIO_Port, DIN_Pin
  70. #define EPD_SCLK_PIN SCK_GPIO_Port, SCK_Pin
  71. /**
  72. * GPIO read and write
  73. **/
  74. #define DEV_Digital_Write(_pin, _value) HAL_GPIO_WritePin(_pin, _value == 0? GPIO_PIN_RESET:GPIO_PIN_SET)
  75. #define DEV_Digital_Read(_pin) HAL_GPIO_ReadPin(_pin)
  76. /**
  77. * delay x ms
  78. **/
  79. #define DEV_Delay_ms(__xms) HAL_Delay(__xms);
  80. void DEV_SPI_WriteByte(UBYTE value);
  81. void DEV_SPI_Write_nByte(UBYTE *value, UDOUBLE len);
  82. int DEV_Module_Init(void);
  83. void DEV_Module_Exit(void);
  84. void DEV_GPIO_Init(void);
  85. void DEV_SPI_Init(void);
  86. void DEV_SPI_SendData(UBYTE Reg);
  87. UBYTE DEV_SPI_ReadData(void);
  88. #endif