Flashlight SOS function
This commit is contained in:
@@ -45,6 +45,7 @@ static void ACTION_FlashLight(void)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
gFlashLightState++;
|
||||
break;
|
||||
default:
|
||||
|
29
app/app.c
29
app/app.c
@@ -1447,6 +1447,35 @@ void APP_TimeSlice10ms(void)
|
||||
|
||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
else if(gFlashLightState == FLASHLIGHT_SOS) {
|
||||
const uint16_t u = 15;
|
||||
static uint8_t c;
|
||||
static uint16_t next;
|
||||
|
||||
if(gFlashLightBlinkCounter - next > 7*u) {
|
||||
c = 0;
|
||||
next = gFlashLightBlinkCounter+1;
|
||||
}
|
||||
else if(gFlashLightBlinkCounter == next) {
|
||||
if(c==0) {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
}
|
||||
else
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
|
||||
if(c == 18) {
|
||||
next += 7*u;
|
||||
c = 0;
|
||||
}
|
||||
else if(c==7 || c==9 || c==11)
|
||||
next += 3*u;
|
||||
else
|
||||
next += u;
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gVoxResumeCountdown > 0)
|
||||
|
Reference in New Issue
Block a user