stamachine.c
#include "myapplication.h"
static void Sta1Func(void);
static void Sta2Func(void);
static void Sta3Func(void);
static void Sta4Func(void);
static void Sta5Func(void);
state_machine state_machiner =
{
STA1,
Sta1Func,
Sta2Func,
Sta3Func,
Sta4Func,
Sta5Func,
};
static void Sta1Func(void)
{
HAL_Delay(500);
led_operater.led_extinguish(LED1);
led_operater.led_extinguish(LED2);
led_operater.led_extinguish(LED3);
state_machiner.stateLocation = STA2;
}
static void Sta2Func(void)
{
HAL_Delay(500);
led_operater.led_light(LED1);
HAL_Delay(500);
led_operater.led_extinguish(LED1);
state_machiner.stateLocation = STA3;
}
static void Sta3Func(void)
{
HAL_Delay(500);
led_operater.led_light(LED2);
HAL_Delay(500);
led_operater.led_extinguish(LED2);
state_machiner.stateLocation = STA4;
}
static void Sta4Func(void)
{
HAL_Delay(500);
led_operater.led_light(LED3);
HAL_Delay(500);
led_operater.led_extinguish(LED3);
state_machiner.stateLocation = STA5;
}
static void Sta5Func(void)
{
HAL_Delay(500);
led_operater.led_light(LED1);
led_operater.led_light(LED2);
led_operater.led_light(LED3);
state_machiner.stateLocation = STA1;
} |