bikebrake.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @file bikebrake.h
  3. * @author Wang, Zhiyu(wangzy49@midea.com)
  4. * @brief Brake of ebike
  5. * @version 0.1
  6. * @date 2021-10-08
  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 BIKEBRAKE_H
  16. #define BIKEBRAKE_H
  17. typedef _Bool BOOL;
  18. /****************************************
  19. *
  20. * Definitions & Macros
  21. *
  22. ****************************************/
  23. #define BIKEBRAKE_OUT_DEFAULT \
  24. { \
  25. 0,0, FALSE \
  26. } // Default value of BIKELIGHT_OUT
  27. #define BRAKE_DETECT_PORT GPIOD // GPIOD
  28. #define BRAKE_DETECT_PIN GPIO_Pin_2 // 2
  29. /***************************************
  30. *
  31. * Type Definations
  32. *
  33. ***************************************/
  34. /**
  35. * @brief Bikebrake out
  36. *
  37. */
  38. typedef struct
  39. {
  40. UWORD uwDetectTimeCnt; // Cnt of detect GPIO state change
  41. UWORD uwBikeBrakeCnt; // Cnt of detect GPIO state change
  42. BOOL blBikeBrakeOnFlg; // flag of brake on or off
  43. } BIKEBRAKE_OUT;
  44. /*****************************************
  45. *
  46. * Exported variable
  47. *
  48. ****************************************/
  49. /***************************************
  50. *
  51. * Function Definations
  52. *
  53. ***************************************/
  54. void bikebrake_voBikeBrakeInit(void); // api function
  55. void bikebrake_voBikeBrakeDetect(void); // api function
  56. BOOL BikeBrake_blGetstate(void);
  57. /************************************************************************/
  58. #endif
  59. /************************************************************************
  60. End of this File (EOF):
  61. Do not put anything after this part!
  62. *************************************************************************/