#ifndef _APP_CONTROL_OUT_H_ #define _APP_CONTROL_OUT_H_ #include "b6x.h" #include "drvs.h" // GPIO的输出需反向 enum app_control{ IN_GPS =PA03, // GPS输入/0:被拉低就执行锁车 IN_EXTI0_Custom0 =PA08, // 自定义输入0 IN_EXTI1_Custom1 =PA09, // 自定义输入1 /防盗检测/下降沿触发防盗 OUT_Door_lock =PA18, // 电门锁 /H:开锁 OUT_Push_key =PA14, // 推车键 /L:开启推车 OUT_Switch_gear =PA13, // 调速模式选择/H:限速模式/L:不限速 OUT_High_speed =PA11, // 高速档位 /L:低使能 OUT_Low_speed =PA12, // 低速档位 /L:低使能 OUT_Back_car =PA15, // 前进后退 /H:前进/L:后退 OUT_Low_brake =PA16, // 低制动 /L:低使能 OUT_High_brake =PA17 // 高制动 /H:低使能 }; //enum app_control{ // IN_GPS =PA08, // GPS输入/0:锁车 // IN_EXTI0_Custom0 =PA08, // 自定义输入0 // IN_EXTI1_Custom1 =PA09, // 自定义输入1 /防盗检测/下降沿触发防盗 // OUT_Door_lock =PA13, // 电门锁 /1:开锁 // OUT_Push_key =PA12, // 推车键 /1:开启推车 // OUT_Switch_gear =PA11, // 调速模式选择/1:限速模式/0:不限速 // OUT_High_speed =PA14, // 高速档位 /1:使能 // OUT_Low_speed =PA15, // 低速档位 /1:使能 // OUT_Back_car =PA16, // 前进后退 /0:前进/1:后退 // OUT_Low_brake =PA17, // 低制动 /1:使能 // OUT_High_brake =PA18 // 高制动 /1:使能 //}; extern bool app_control_en[PA_MAX]; //写1使能,写0失能 #define Set_Status(pad,activity) (gpio_put(pad, ((0 == activity) ? !app_control_en[pad] : app_control_en[pad]))) #define Get_Status(pad) ((app_control_en[pad] == gpio_get(pad)) ? 1 : 0) //中控控制IO初始化 void app_control_init(void); // 设置控制状态 bool app_set_control_status(uint8_t pad, uint8_t val); //获取档位状态/0:管理员模式速度无限制/1:游客模式油门限速/2:低速档/3:高速档 uint8_t app_get_gears_status(void); //获取刹车状态/0:取消刹车/1:低刹/2:高刹 uint8_t app_get_brake_status(void); //设置档位状态/0:管理员模式速度无限制/1:游客模式油门限速/2:低速档/3:高速档 uint8_t app_set_gears_status(uint8_t val); //设置刹车状态/0:取消刹车/1:低刹/2:高刹 uint8_t app_set_brake_status(uint8_t val); //获取电门锁状态 uint8_t app_get_Door_lock_status(void); //电门锁状态设置/0:锁车状态/1:开锁状态 uint8_t app_set_Door_lock_status(bool val); //推车模式设置/0:退出推车状态/1:推车状态 uint8_t app_set_Push_status(bool val); //设置行驶方向/0:前进;1:倒车 uint8_t app_set_Back_car_status(bool val); #endif