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. #include "typedefine.h"
  18. typedef _Bool BOOL;
  19. /****************************************
  20. *
  21. * Definitions & Macros
  22. *
  23. ****************************************/
  24. #define DISPLAY_OUT_DEFAULT \
  25. { \
  26. 0, 0, FALSE, DISPLAY_Off \
  27. } // Default value of BIKELIGHT_OUT
  28. #define DISPLAY_COEF_DEFAULT \
  29. { \
  30. 0, 0, 0, 0 \
  31. } // Default value of BIKELIGHT_OUT
  32. //#define DISPLAY_EN_PORT 14 //PC14
  33. #define Display_POWER_ERROR_VOLTAGE_UP 130 // 0.1v
  34. #define Display_POWER_ERROR_VOLTAGE_DOWN 110 // 0.1v
  35. #define Display_POWER_ERROR_DETECT 4000 // ms
  36. #define Display_POWER_ERROR_RECOVER 4000 // ms
  37. #define Display_POWER_ERROR_TIMEUNIT 200 // ms
  38. /***************************************
  39. *
  40. * Type Definations
  41. *
  42. ***************************************/
  43. /**
  44. * @brief Display state
  45. *
  46. */
  47. typedef enum
  48. {
  49. DISPLAY_Off = 0,
  50. DISPLAY_On = 1,
  51. DISPLAY_Error = 2,
  52. } DISPLAY_STATE;
  53. /**
  54. * @brief BikeLight out
  55. *
  56. */
  57. typedef struct
  58. {
  59. UWORD uwDisplayErrorCnt; // Cnt of detect GPIO low voltage
  60. UWORD uwDisplayRecoverCnt; // Cnt of detect GPIO high voltage
  61. BOOL blDisplayErrorFlg; // flag of light error
  62. DISPLAY_STATE DisplayState; // state of light
  63. } DISPLAY_OUT;
  64. typedef struct
  65. {
  66. UWORD uwDisplayErrorCnt; // Cnt of detect GPIO low voltage
  67. UWORD uwDisplayRecoverCnt; // Cnt of detect GPIO high voltage
  68. UWORD uwDisplayErrorVoltagePuDown; // flag of light error
  69. UWORD uwDisplayErrorVoltagePuUp; // flag of light error
  70. } DISPLAY_COEF;
  71. /****************************************
  72. *
  73. * Exported variable
  74. *
  75. ****************************************/
  76. /***************************************
  77. *
  78. * Function Definations
  79. *
  80. ***************************************/
  81. void display_voDisplayInit(void); // interface function
  82. void display_voDisplayCoef(void);
  83. void display_voDisplayControl(UWORD switchAction); // interface function
  84. void display_voCommunication(void);
  85. void display_voGetDisplayError(UWORD DisplayVolPu);
  86. /************************************************************************
  87. Flag Define (N/A)
  88. *************************************************************************/
  89. #endif
  90. /************************************************************************
  91. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  92. All rights reserved.
  93. *************************************************************************
  94. End of this File (EOF):
  95. Do not put anything after this part!
  96. *************************************************************************/