添加所有遥控控制

This commit is contained in:
xushaoxiang
2026-06-25 10:32:06 +08:00
parent 2339bbfd1f
commit 832ede2aaf
73 changed files with 2559 additions and 2454 deletions
@@ -22,6 +22,8 @@ static volatile uint16_t s2_debounce_cnt = 0;
#define DEBOUNCE_MS 2 //消抖时间40ms
//uint16_t switch1_debounce = 0;
@@ -34,6 +36,8 @@ uint8_t s1_first_press_flag = 0; //S2首次按下标志
uint8_t s2_first_press_flag = 0; //S2首次按下标志
uint8_t S1_first_on_state=0; //上电时开关的状态
void switch_init(void)
{
@@ -51,13 +55,28 @@ void switch_init(void)
xc_gpio_it_config(GPIO_1,FAIL_EDGE_INT);
NVIC_EnableIRQ(GPIO_IRQn);
if(xc_gpio_read_pin(SWITCH_S1_PIN)==0)
{
S1_first_on_state=1;
}
else
{
S1_first_on_state=0;
}
}
void trigger_check_process(void)
{
if(S1_first_on_state==1)
{
S1_first_on_state=0;
s1_first_press_flag=1;
s1_state=DB_PRESSED;
}
switch(s1_state)
{
@@ -162,10 +181,12 @@ void trigger_check_process(void)
trig1_wait = 0;
s1_first_press_flag=1;
xc_gpio_write_pin(GPIO_5,GPIO_PIN_SET);
flash_ch1_state=xc_gpio_read_pin(GPIO_5);
set_TaskComps_timer(6,1000);
}
else if(trig1_timeout == 0 && (trig1_cnt > 1 && trig1_cnt < 5))
else if(trig1_timeout == 0 && (trig1_cnt > 1 && trig1_cnt < TRIGGER_CONTINUE_CNT))
{
// printf("乱按 trig1_cnt %d\r\n",trig1_cnt);
trig1_cnt = 0;
@@ -198,6 +219,9 @@ void trigger_check_process(void)
s1_first_press_flag=0;
xc_gpio_write_pin(GPIO_5,GPIO_PIN_RESET);
flash_ch1_state=xc_gpio_read_pin(GPIO_5);
set_TaskComps_timer(6,1000);
}