/** * @file display.h * @author Wang, Zhiyu(wangzy49@midea.com) * @brief display 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 DISPLAY_H #define DISPLAY_H #include "typedefine.h" typedef _Bool BOOL; /**************************************** * * Definitions & Macros * ****************************************/ #define DISPLAY_OUT_DEFAULT \ { \ 0, 0, FALSE, DISPLAY_Off \ } // Default value of BIKELIGHT_OUT #define DISPLAY_COEF_DEFAULT \ { \ 0, 0, 0, 0 \ } // Default value of BIKELIGHT_OUT //#define DISPLAY_EN_PORT 14 //PC14 #define Display_POWER_ERROR_VOLTAGE_UP 130 // 0.1v #define Display_POWER_ERROR_VOLTAGE_DOWN 110 // 0.1v #define Display_POWER_ERROR_DETECT 4000 // ms #define Display_POWER_ERROR_RECOVER 4000 // ms #define Display_POWER_ERROR_TIMEUNIT 200 // ms /*************************************** * * Type Definations * ***************************************/ /** * @brief Display state * */ typedef enum { DISPLAY_Off = 0, DISPLAY_On = 1, DISPLAY_Error = 2, } DISPLAY_STATE; /** * @brief BikeLight out * */ typedef struct { UWORD uwDisplayErrorCnt; // Cnt of detect GPIO low voltage UWORD uwDisplayRecoverCnt; // Cnt of detect GPIO high voltage BOOL blDisplayErrorFlg; // flag of light error DISPLAY_STATE DisplayState; // state of light } DISPLAY_OUT; typedef struct { UWORD uwDisplayErrorCnt; // Cnt of detect GPIO low voltage UWORD uwDisplayRecoverCnt; // Cnt of detect GPIO high voltage UWORD uwDisplayErrorVoltagePuDown; // flag of light error UWORD uwDisplayErrorVoltagePuUp; // flag of light error } DISPLAY_COEF; /**************************************** * * Exported variable * ****************************************/ /*************************************** * * Function Definations * ***************************************/ void display_voDisplayInit(void); // interface function void display_voDisplayCoef(void); void display_voDisplayControl(UWORD switchAction); // interface function void display_voCommunication(void); void display_voGetDisplayError(UWORD DisplayVolPu); /************************************************************************ 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! *************************************************************************/