bikebrake.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #include "typedefine.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif // __cplusplus
  21. /****************************************
  22. *
  23. * Definitions & Macros
  24. *
  25. ****************************************/
  26. #define BIKEBRAKE_OUT_DEFAULT \
  27. { \
  28. 0,0, FALSE \
  29. } // Default value of BIKELIGHT_OUT
  30. #define BRAKE_DETECT_PORT 10 // PB10
  31. /***************************************
  32. *
  33. * Type Definations
  34. *
  35. ***************************************/
  36. /**
  37. * @brief Bikebrake out
  38. *
  39. */
  40. typedef struct
  41. {
  42. UWORD uwDetectTimeCnt; // Cnt of detect GPIO state change
  43. UWORD uwBikeBrakeCnt; // Cnt of detect GPIO state change
  44. BOOL blBikeBrakeOnFlg; // flag of brake on or off
  45. } BIKEBRAKE_OUT;
  46. /*****************************************
  47. *
  48. * Exported variable
  49. *
  50. ****************************************/
  51. /***************************************
  52. *
  53. * Function Definations
  54. *
  55. ***************************************/
  56. void bikebrake_voBikeBrakeInit(void); // api function
  57. void bikebrake_voBikeBrakeDetect(void); // api function
  58. BOOL BikeBrake_blGetstate(void);
  59. /************************************************************************/
  60. #ifdef __cplusplus
  61. }
  62. #endif // __cplusplus
  63. #endif
  64. /************************************************************************
  65. End of this File (EOF):
  66. Do not put anything after this part!
  67. *************************************************************************/