// // Created by fctom on 2020/2/13. // #include "comm_test.h" #include "../driver_test.h" #include "../defs.h" static bool seatbeltInsert; static bool engineStart; const int ENGINE_MIN_ROTATE = 200; static uint16_t gpioStore = 0; static uint16_t engineStore = 0; static void SensorChange(int index, bool value); void CommTestStart(void) { gpioStore = engineStore = 0; } void UpdateSensor(uint16_t gpio, uint16_t speed, uint16_t engine) { int idx, lvl; uint16_t chg = gpioStore^gpio; if (chg == 0) return; for (int i = 0; i < 16; ++i) { if (chg & BV(i)) { SensorChange(i, (bool)(gpio & BV(i))); } } gpioStore = gpio; // 安全带 // 挡位 // 启动指示 // 熄火监控 } static void SensorChange(int index, bool value) { int func; switch (func) { case SENSOR_SEATBELT: break; case SENSOR_TURNRIGHT: break; } }