Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************************************
- *
- * MODULE: JN-AN-1217
- *
- * COMPONENT: drv_leds.h
- *
- * DESCRIPTION: API for control led
- *
- ***************************************************************************/
- #ifndef DRV_LEDS_H_
- #define DRV_LEDS_H_
- /****************************************************************************/
- /*** Include files ***/
- /****************************************************************************/
- #include "jendefs.h"
- /****************************************************************************/
- /*** Macro Definitions ***/
- /****************************************************************************/
- //#define DIM_LED_TIMER E_AHI_TIMER_0
- //#define DIM_LED_TIMER E_AHI_TIMER_1
- #define DIM_LED_TIMER E_AHI_TIMER_2
- //#define DIM_LED_TIMER E_AHI_TIMER_3
- //#define DIM_LED_TIMER E_AHI_TIMER_4
- #define DO_0_PIN (30) // Define pin number of DO_0
- #define DO_1_PIN (31) // Define pin number of DO_1
- #define MAX_NUMBER_LEDS_SUPPORT (32)
- #define MAX_NUMBER_GROUP_LED_BLINK (5)
- #ifndef DRV_LEDS_ZTIMER_STORAGE
- #define DRV_LEDS_ZTIMER_STORAGE (MAX_NUMBER_GROUP_LED_BLINK)
- #endif /* DRV_LEDS_ZTIMER_STORAGE */
- #define LED_BLINK_FOREVER (-1) // if u16NumberBlink <= -1 then led will blink forever
- /****************************************************************************/
- /*** Type Definitions ***/
- /****************************************************************************/
- typedef enum
- {
- LED_LEVEL_0, // led off
- LED_LEVEL_10, // led on 10%
- LED_LEVEL_20, // led on 20%
- LED_LEVEL_30, // led on 30%
- LED_LEVEL_40, // led on 40%
- LED_LEVEL_50, // led on 50%
- LED_LEVEL_60, // led on 60%
- LED_LEVEL_70, // led on 70%
- LED_LEVEL_80, // led on 80%
- LED_LEVEL_90, // led on 90%
- LED_LEVEL_100, // Led on 100%
- NUMBER_OF_LED_LEVEL,
- }DRV_LEDS_teLedLevel_t;
- typedef void (*fnCbAfterBlink)(void*);
- /****************************************************************************/
- /*** Exported Functions ***/
- /****************************************************************************/
- PUBLIC bool_t DRV_LEDS_bInitialize(
- uint8_t *u8ArrLedPin,
- uint8_t u8NumberLed,
- DRV_LEDS_teLedLevel_t eLedLevel
- );
- /****************************************************************************
- *
- * NAME: DRV_LEDS_vBlinkLed()
- *
- * DESCRIPTION:
- * - To blink led with a certain of blink: i16NumberBlink > 0
- * - To blink led in a duration: i16NumberBlink < 0 and i16BlinkDuration > 0
- * - To blink led forever: i16NumberBlink < 0 and i16BlinkDuration < 0
- *
- * - To blink alternately 2 groups of led: u8ArrLedPin != NULL and u8ArrLedPin2 != NULL and 0 < u8NumberLed,u8NumberLed2 < MAX_NUMBER_LEDS_SUPPORT
- * - To blink a Group of Led: u8ArrLedPin != NULL and 0 < u8NumberLed,u8NumberLed2 < MAX_NUMBER_LEDS_SUPPORT
- * And ( or u8ArrLedPin2 == NULL or u8NumberLed2 > MAX_NUMBER_LEDS_SUPPORT or u8NumberLed2 = 0)
- * PARAMETER:
- *
- * RETURNS: void
- *
- ****************************************************************************/
- PUBLIC void DRV_LEDS_vBlinkLedsAlternately(
- uint8_t *u8ArrLedPin,
- uint8_t u8NumberLed,
- uint8_t *u8ArrLedPin2,
- uint8_t u8NumberLed2,
- int16_t i16NumberBlink,
- int16_t i16BlinkDuration, //ms
- uint16_t u16TimeOn, //ms
- uint16_t u16TimeOff, //ms
- fnCbAfterBlink fnCallback,
- void *pParams
- );
- PUBLIC void DRV_LEDS_vStopBlinkLeds(
- bool_t bStopBlinkAllLeds,
- uint8_t *u8ArrLedPin,
- uint8_t u8NumberLed
- );
- PUBLIC void DRV_LEDS_vSetLevel(
- DRV_LEDS_teLedLevel_t eLedLevel
- );
- PUBLIC void DRV_LEDS_vOn(
- uint8_t u8LedPin
- );
- PUBLIC void DRV_LEDS_vOff(
- uint8_t u8LedPin
- );
- /****************************************************************************/
- /*** External Variables ***/
- /****************************************************************************/
- /****************************************************************************/
- /****************************************************************************/
- /****************************************************************************/
- #endif /* DRV_LEDS_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement