diff --git a/right/src/bridge_protocol_scheduler.c b/right/src/bridge_protocol_scheduler.c index af1567b..808443a 100644 --- a/right/src/bridge_protocol_scheduler.c +++ b/right/src/bridge_protocol_scheduler.c @@ -6,6 +6,7 @@ #include "bridge_slaves/bridge_slave_uhk_module.h" #include "i2c.h" #include "i2c_addresses.h" +#include "test_states.h" uint8_t currentBridgeSlaveId = 0; @@ -17,6 +18,9 @@ bridge_slave_t bridgeSlaves[] = { static void bridgeProtocolCallback(I2C_Type *base, i2c_master_handle_t *handle, status_t status, void *userData) { + if (TestStates.disableI2c) { + return; + } bridge_slave_t *bridgeSlave = bridgeSlaves + currentBridgeSlaveId; bool isFinished = bridgeSlave->slaveHandler(bridgeSlave->moduleId); diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index 1e37994..d3ac037 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -4,12 +4,15 @@ #include "layer.h" #include "usb_interfaces/usb_interface_mouse.h" #include "current_keymap.h" +#include "test_states.h" +#include "peripherals/test_led.h" static uint8_t activeLayer = LAYER_ID_BASE; static uint8_t mouseWheelDivisorCounter = 0; static uint8_t mouseSpeedAccelDivisorCounter = 0; static uint8_t mouseSpeed = 3; static bool wasPreviousMouseActionWheelAction = false; +test_states_t TestStates; void processMouseAction(key_action_t action) { @@ -68,6 +71,13 @@ void processMouseAction(key_action_t action) wasPreviousMouseActionWheelAction = isWheelAction; } +void processTestAction(key_action_t testAction) { + if (testAction.test.testAction == TestAction_DisableI2c) { + TestStates.disableI2c = true; + TEST_LED_OFF(); + } +} + void UpdateActiveUsbReports() { bzero(&UsbMouseReport, sizeof(usb_mouse_report_t)); @@ -124,6 +134,9 @@ void UpdateActiveUsbReports() { case KEY_ACTION_MOUSE: processMouseAction(action); break; + case KEY_ACTION_TEST: + processTestAction(action); + break; } } }