DEV_Config.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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: V2.0
  10. * | Date : 2018-10-30
  11. * | Info :
  12. # ******************************************************************************
  13. # Permission is hereby granted, free of charge, to any person obtaining a copy
  14. # of this software and associated documnetation files (the "Software"), to deal
  15. # in the Software without restriction, including without limitation the rights
  16. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17. # copies of the Software, and to permit persons to whom the Software is
  18. # furished to do so, subject to the following conditions:
  19. #
  20. # The above copyright notice and this permission notice shall be included in
  21. # all copies or substantial portions of the Software.
  22. #
  23. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25. # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  26. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27. # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  28. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  29. # THE SOFTWARE.
  30. #
  31. ******************************************************************************/
  32. #include "DEV_Config.h"
  33. #include "stm32f1xx_hal_spi.h"
  34. extern SPI_HandleTypeDef hspi1;
  35. void DEV_SPI_WriteByte(UBYTE value)
  36. {
  37. HAL_SPI_Transmit(&hspi1, &value, 1, 1000);
  38. }
  39. int DEV_Module_Init(void)
  40. {
  41. DEV_Digital_Write(EPD_DC_PIN, 0);
  42. DEV_Digital_Write(EPD_CS_PIN, 0);
  43. DEV_Digital_Write(EPD_PWR_PIN, 1);
  44. DEV_Digital_Write(EPD_RST_PIN, 1);
  45. return 0;
  46. }
  47. void DEV_Module_Exit(void)
  48. {
  49. DEV_Digital_Write(EPD_DC_PIN, 0);
  50. DEV_Digital_Write(EPD_CS_PIN, 0);
  51. //close 5V
  52. DEV_Digital_Write(EPD_PWR_PIN, 0);
  53. DEV_Digital_Write(EPD_RST_PIN, 0);
  54. }