123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /**
- * @file bikelight.h
- * @author Wang, Zhiyu(wangzy49@midea.com)
- * @brief Light of ebike
- * @version 0.1
- * @date 2021-10-09
- *
- * @copyright Copyright (c) 2021
- *
- */
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives:
- *************************************************************************/
- #ifndef BIKELIGHT_H
- #define BIKELIGHT_H
- /****************************************
- *
- * Definitions & Macros
- *
- ****************************************/
- #define BIKELIGHT_OUT_DEFAULT \
- { \
- 0, 0, 0, FALSE, LIGHT_Off \
- } // Default value of BIKELIGHT_OUT
- #define BIKELIGHT_COEF_DEFAULT \
- { \
- 0, 0, 0, 0, 0 \
- }
- #define LIGHT_POWER_ERROR_VOLTAGE_UP 70 // 0.1v
- #define LIGHT_POWER_ERROR_VOLTAGE_DOWN 50 // 0.1v
- #define LIGHT_POWER_ERROR_DETECT 2000 // ms
- #define LIGHT_POWER_ERROR_RECOVER 2000 // ms
- #define LIGHT_POWER_ERROR_SHUT 2000 // ms
- #define LIGHT_POWER_ERROR_TIMEUNIT 200 // ms
- /***************************************
- *
- * Type Definations
- *
- ***************************************/
- /**
- * @brief Light state
- *
- */
- typedef enum
- {
- LIGHT_Off = 0,
- LIGHT_On = 1,
- LIGHT_Error = 2,
- LIGHT_Shut = 3
- } LIGHT_STATE;
- /**
- * @brief BikeLight out
- *
- */
- typedef struct
- {
- UWORD uwBikeLightErrorCnt; // Cnt of detect GPIO low voltage
- UWORD uwBikeLightRecoverCnt; // Cnt of detect GPIO high voltage
- UWORD uwBikeLightShutCnt; // Cnt of detect GPIO high voltage
- BOOL blBikeLightErrorFlg; // flag of light error
- LIGHT_STATE LightState; // state of light
- } BIKELIGHT_OUT;
- typedef struct
- {
- UWORD uwBikeLightErrorCnt; // Cnt of detect GPIO low voltage
- UWORD uwBikeLightRecoverCnt; // Cnt of detect GPIO high voltage
- UWORD uwBikeLightShutCnt; // Cnt of detect GPIO high voltage
- UWORD uwBikeLightErrorVoltagePuDown; // flag of light error
- UWORD uwBikeLightErrorVoltagePuUp; // flag of light error
- } BIKELIGHT_COEF;
- /****************************************
- *
- * Exported variable
- *
- ****************************************/
- /***************************************
- *
- * Function Definations
- *
- ***************************************/
- void bikelight_voBikeLightInit(void); // interface function
- void bikelight_voBikeLightCoef(UWORD volt);
- void bikelight_voBikeLightControl(UWORD switchAction); // interface function
- void bikelight_voGetBikeLightError(UWORD LightPowerVolPu);
- /************************************************************************
- Flag Define (N/A)
- *************************************************************************/
- #endif
- /************************************************************************
- Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
- All rights reserved.
- *************************************************************************
- End of this File (EOF):
- Do not put anything after this part!
- *************************************************************************/
|