2023-12-07 04:07:40 +00:00
|
|
|
#ifdef ENABLE_FLASHLIGHT
|
|
|
|
|
|
|
|
#include "driver/gpio.h"
|
|
|
|
#include "bsp/dp32g030/gpio.h"
|
|
|
|
|
|
|
|
#include "flashlight.h"
|
|
|
|
|
|
|
|
enum FlashlightMode_t gFlashLightState;
|
|
|
|
|
|
|
|
void FlashlightTimeSlice()
|
|
|
|
{
|
|
|
|
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) {
|
|
|
|
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ACTION_FlashLight(void)
|
|
|
|
{
|
|
|
|
switch (gFlashLightState) {
|
|
|
|
case FLASHLIGHT_OFF:
|
|
|
|
gFlashLightState++;
|
|
|
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
|
|
break;
|
|
|
|
case FLASHLIGHT_ON:
|
|
|
|
gFlashLightState++;
|
|
|
|
break;
|
2024-01-20 16:11:39 +00:00
|
|
|
case FLASHLIGHT_BLINK:
|
2023-12-07 04:07:40 +00:00
|
|
|
default:
|
|
|
|
gFlashLightState = 0;
|
|
|
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|