Make UsbCommand_GetModuleProperty() branch based on modulePropertyId
This commit is contained in:
@@ -12,10 +12,15 @@ void UsbCommand_GetModuleProperty()
|
|||||||
SetUsbTxBufferUint8(0, UsbStatusCode_GetModuleProperty_InvalidModuleSlotId);
|
SetUsbTxBufferUint8(0, UsbStatusCode_GetModuleProperty_InvalidModuleSlotId);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t moduleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId);
|
module_property_id_t modulePropertyId = GetUsbRxBufferUint8(2);
|
||||||
uhk_module_state_t *moduleState = UhkModuleStates + moduleDriverId;
|
switch (modulePropertyId) {
|
||||||
|
case ModulePropertyId_VersionNumbers: {
|
||||||
GenericHidOutBuffer[1] = moduleState->moduleId;
|
uint8_t moduleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId);
|
||||||
memcpy(GenericHidOutBuffer + 2, &moduleState->moduleProtocolVersion, sizeof(version_t));
|
uhk_module_state_t *moduleState = UhkModuleStates + moduleDriverId;
|
||||||
memcpy(GenericHidOutBuffer + 2 + sizeof(version_t), &moduleState->firmwareVersion, sizeof(version_t));
|
GenericHidOutBuffer[1] = moduleState->moduleId;
|
||||||
|
memcpy(GenericHidOutBuffer + 2, &moduleState->moduleProtocolVersion, sizeof(version_t));
|
||||||
|
memcpy(GenericHidOutBuffer + 8, &moduleState->firmwareVersion, sizeof(version_t));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
// Typedefs:
|
// Typedefs:
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ModulePropertyId_VersionNumbers = 0,
|
||||||
|
} module_property_id_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
UsbStatusCode_GetModuleProperty_InvalidModuleSlotId = 2,
|
UsbStatusCode_GetModuleProperty_InvalidModuleSlotId = 2,
|
||||||
} usb_status_code_get_module_property_t;
|
} usb_status_code_get_module_property_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user