diff --git a/right/src/slave_drivers/uhk_module_driver.c b/right/src/slave_drivers/uhk_module_driver.c index d43adf9..2621aae 100644 --- a/right/src/slave_drivers/uhk_module_driver.c +++ b/right/src/slave_drivers/uhk_module_driver.c @@ -33,12 +33,15 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleId) break; case UhkModulePhase_ReceiveKeystates: status = I2cAsyncRead(I2C_ADDRESS_LEFT_KEYBOARD_HALF_FIRMWARE, rxBuffer, KEY_STATE_BUFFER_SIZE); - uhkModulePhase = UhkModulePhase_SetLedPwmBrightness; + uhkModulePhase = UhkModulePhase_ProcessKeystates; break; - case UhkModulePhase_SetLedPwmBrightness: + case UhkModulePhase_ProcessKeystates: if (CRC16_IsMessageValid(rxBuffer, KEY_STATE_SIZE)) { BoolBitsToBytes(rxBuffer, CurrentKeyStates[SLOT_ID_LEFT_KEYBOARD_HALF], LEFT_KEYBOARD_HALF_KEY_COUNT); } + uhkModulePhase = UhkModulePhase_SetLedPwmBrightness; + break; + case UhkModulePhase_SetLedPwmBrightness: txBuffer[0] = SlaveCommand_SetLedPwmBrightness; txBuffer[1] = uhkModuleInternalState->ledPwmBrightness; status = I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF_FIRMWARE, txBuffer, 2); diff --git a/right/src/slave_drivers/uhk_module_driver.h b/right/src/slave_drivers/uhk_module_driver.h index 52cb87c..3a081d7 100644 --- a/right/src/slave_drivers/uhk_module_driver.h +++ b/right/src/slave_drivers/uhk_module_driver.h @@ -23,6 +23,7 @@ typedef enum { UhkModulePhase_RequestKeyStates, UhkModulePhase_ReceiveKeystates, + UhkModulePhase_ProcessKeystates, UhkModulePhase_SetLedPwmBrightness, UhkModulePhase_SetTestLed, } uhk_module_phase_t;