My code now looks like this:
for (;;)
{
HID_Device_USBTask(&Joystick_HID_Interface);
USB_USBTask();
if (Serial_IsCharReceived() && !dataReceived)
{
sensorIdentification =Serial_RxByte();
dataReceived = true;
}
if (Serial_IsCharReceived() && dataReceived)
{
uint8_t data = Serial_RxByte();
if (sensorIdentification == "a") {sensorA = data;}
else if (sensorIdentification == "b") {sensorB = data;}
else if (sensorIdentification == "c") {sensorC = data;}
else if (sensorIdentification == "d") {sensorD = data;}
dataReceived = false;
}
}
In the callback
USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;
JoystickReport->X = sensorA;
JoystickReport->Y = sensorB;
JoystickReport->Z = sensorC;
JoystickReport->Rz = sensorD;
*ReportSize = sizeof(USB_JoystickReport_Data_t);
return false;
}
But the values don't update in any way.
When I run make, I get some warnings though.
warning: comparison with string literal results in unspecified behavior
warning: comparison between pointer and integer
Could this be the source of my problems?