Simplify CDC device demos, by directly assigning the string to transmit to the pointer, rather than using an intermediatary table to hold all the possible transmit strings.
This commit is contained in:
1 parent
c830fcb0e1
commit
33a5715e91
4 files changed
+26
-64
No files matched your search
@@ -124,25 +124,16 @@ void CheckJoystickMovement(void)
|
||||
char* ReportString = NULL;
|
||||
static bool ActionSent = false;
|
||||
|
||||
char* const JoystickStrings[] =
|
||||
{
|
||||
"Joystick Up\r\n",
|
||||
"Joystick Down\r\n",
|
||||
"Joystick Left\r\n",
|
||||
"Joystick Right\r\n",
|
||||
"Joystick Pressed\r\n",
|
||||
};
|
||||
|
||||
if (JoyStatus_LCL & JOY_UP)
|
||||
ReportString = JoystickStrings[0];
|
||||
ReportString = "Joystick Up\r\n";
|
||||
else if (JoyStatus_LCL & JOY_DOWN)
|
||||
ReportString = JoystickStrings[1];
|
||||
ReportString = "Joystick Down\r\n";
|
||||
else if (JoyStatus_LCL & JOY_LEFT)
|
||||
ReportString = JoystickStrings[2];
|
||||
ReportString = "Joystick Left\r\n";
|
||||
else if (JoyStatus_LCL & JOY_RIGHT)
|
||||
ReportString = JoystickStrings[3];
|
||||
ReportString = "Joystick Right\r\n";
|
||||
else if (JoyStatus_LCL & JOY_PRESS)
|
||||
ReportString = JoystickStrings[4];
|
||||
ReportString = "Joystick Pressed\r\n";
|
||||
else
|
||||
ActionSent = false;
|
||||
|
||||
|
||||
@@ -132,25 +132,16 @@ void CheckJoystickMovement(void)
|
||||
char* ReportString = NULL;
|
||||
static bool ActionSent = false;
|
||||
|
||||
char* const JoystickStrings[] =
|
||||
{
|
||||
"Joystick Up\r\n",
|
||||
"Joystick Down\r\n",
|
||||
"Joystick Left\r\n",
|
||||
"Joystick Right\r\n",
|
||||
"Joystick Pressed\r\n",
|
||||
};
|
||||
|
||||
if (JoyStatus_LCL & JOY_UP)
|
||||
ReportString = JoystickStrings[0];
|
||||
ReportString = "Joystick Up\r\n";
|
||||
else if (JoyStatus_LCL & JOY_DOWN)
|
||||
ReportString = JoystickStrings[1];
|
||||
ReportString = "Joystick Down\r\n";
|
||||
else if (JoyStatus_LCL & JOY_LEFT)
|
||||
ReportString = JoystickStrings[2];
|
||||
ReportString = "Joystick Left\r\n";
|
||||
else if (JoyStatus_LCL & JOY_RIGHT)
|
||||
ReportString = JoystickStrings[3];
|
||||
ReportString = "Joystick Right\r\n";
|
||||
else if (JoyStatus_LCL & JOY_PRESS)
|
||||
ReportString = JoystickStrings[4];
|
||||
ReportString = "Joystick Pressed\r\n";
|
||||
else
|
||||
ActionSent = false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user