display.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * @file display.h
  3. * @author Wang, Zhiyu(wangzy49@midea.com)
  4. * @brief display of ebike
  5. * @version 0.1
  6. * @date 2021-10-09
  7. *
  8. * @copyright Copyright (c) 2021
  9. *
  10. */
  11. /************************************************************************
  12. Beginning of File, do not put anything above here except notes
  13. Compiler Directives:
  14. *************************************************************************/
  15. #ifndef DISPLAY_H
  16. #define DISPLAY_H
  17. /****************************************
  18. *
  19. * Definitions & Macros
  20. *
  21. ****************************************/
  22. #define DISPLAY_OUT_DEFAULT \
  23. { \
  24. 0, 0, FALSE, DISPLAY_Off \
  25. } // Default value of BIKELIGHT_OUT
  26. #define DISPLAY_COEF_DEFAULT \
  27. { \
  28. 0, 0, 0, 0 \
  29. } // Default value of BIKELIGHT_OUT
  30. //#define DISPLAY_EN_PORT 14 //PC14
  31. #define Display_POWER_ERROR_VOLTAGE_UP 130 // 0.1v
  32. #define Display_POWER_ERROR_VOLTAGE_DOWN 110 // 0.1v
  33. #define Display_POWER_ERROR_DETECT 4000 // ms
  34. #define Display_POWER_ERROR_RECOVER 4000 // ms
  35. #define Display_POWER_ERROR_TIMEUNIT 200 // ms
  36. /***************************************
  37. *
  38. * Type Definations
  39. *
  40. ***************************************/
  41. /**
  42. * @brief Display state
  43. *
  44. */
  45. typedef enum
  46. {
  47. DISPLAY_Off = 0,
  48. DISPLAY_On = 1,
  49. DISPLAY_Error = 2,
  50. } DISPLAY_STATE;
  51. /**
  52. * @brief BikeLight out
  53. *
  54. */
  55. typedef struct
  56. {
  57. UWORD uwDisplayErrorCnt; // Cnt of detect GPIO low voltage
  58. UWORD uwDisplayRecoverCnt; // Cnt of detect GPIO high voltage
  59. BOOL blDisplayErrorFlg; // flag of light error
  60. DISPLAY_STATE DisplayState; // state of light
  61. } DISPLAY_OUT;
  62. typedef struct
  63. {
  64. UWORD uwDisplayErrorCnt; // Cnt of detect GPIO low voltage
  65. UWORD uwDisplayRecoverCnt; // Cnt of detect GPIO high voltage
  66. UWORD uwDisplayErrorVoltagePuDown; // flag of light error
  67. UWORD uwDisplayErrorVoltagePuUp; // flag of light error
  68. } DISPLAY_COEF;
  69. /****************************************
  70. *
  71. * Exported variable
  72. *
  73. ****************************************/
  74. extern DISPLAY_OUT display_stDisplayOut;
  75. /***************************************
  76. *
  77. * Function Definations
  78. *
  79. ***************************************/
  80. void display_voDisplayInit(void); // interface function
  81. void display_voDisplayCoef(void);
  82. void display_voDisplayControl(UWORD switchAction); // interface function
  83. void display_voCommunication(void);
  84. void display_voGetDisplayError(UWORD DisplayVolPu);
  85. /************************************************************************
  86. Flag Define (N/A)
  87. *************************************************************************/
  88. #endif
  89. /************************************************************************
  90. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  91. All rights reserved.
  92. *************************************************************************
  93. End of this File (EOF):
  94. Do not put anything after this part!
  95. *************************************************************************/