projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c830fcb
)
Simplify CDC device demos, by directly assigning the string to transmit to the pointe...
author
Dean Camera
<dean@fourwalledcubicle.com>
Thu, 6 Aug 2009 14:30:53 +0000
(14:30 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Thu, 6 Aug 2009 14:30:53 +0000
(14:30 +0000)
Demos/Device/ClassDriver/CDC/CDC.c
patch
|
blob
|
blame
|
history
Demos/Device/ClassDriver/DualCDC/DualCDC.c
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/CDC/CDC.c
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/DualCDC/DualCDC.c
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Device/ClassDriver/CDC/CDC.c
b/Demos/Device/ClassDriver/CDC/CDC.c
index
4f64646
..
f09d3f1
100644
(file)
--- a/
Demos/Device/ClassDriver/CDC/CDC.c
+++ b/
Demos/Device/ClassDriver/CDC/CDC.c
@@
-124,25
+124,16
@@
void CheckJoystickMovement(void)
char* ReportString = NULL;
\r
static bool ActionSent = false;
\r
\r
char* ReportString = NULL;
\r
static bool ActionSent = false;
\r
\r
- char* const JoystickStrings[] =
\r
- {
\r
- "Joystick Up\r\n",
\r
- "Joystick Down\r\n",
\r
- "Joystick Left\r\n",
\r
- "Joystick Right\r\n",
\r
- "Joystick Pressed\r\n",
\r
- };
\r
-
\r
if (JoyStatus_LCL & JOY_UP)
\r
if (JoyStatus_LCL & JOY_UP)
\r
- ReportString =
JoystickStrings[0]
;
\r
+ ReportString =
"Joystick Up\r\n"
;
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
- ReportString =
JoystickStrings[1]
;
\r
+ ReportString =
"Joystick Down\r\n"
;
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
- ReportString =
JoystickStrings[2]
;
\r
+ ReportString =
"Joystick Left\r\n"
;
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
- ReportString =
JoystickStrings[3]
;
\r
+ ReportString =
"Joystick Right\r\n"
;
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
- ReportString =
JoystickStrings[4]
;
\r
+ ReportString =
"Joystick Pressed\r\n"
;
\r
else
\r
ActionSent = false;
\r
\r
else
\r
ActionSent = false;
\r
\r
diff --git
a/Demos/Device/ClassDriver/DualCDC/DualCDC.c
b/Demos/Device/ClassDriver/DualCDC/DualCDC.c
index
e5406a4
..
5ee3c4d
100644
(file)
--- a/
Demos/Device/ClassDriver/DualCDC/DualCDC.c
+++ b/
Demos/Device/ClassDriver/DualCDC/DualCDC.c
@@
-132,25
+132,16
@@
void CheckJoystickMovement(void)
char* ReportString = NULL;
\r
static bool ActionSent = false;
\r
\r
char* ReportString = NULL;
\r
static bool ActionSent = false;
\r
\r
- char* const JoystickStrings[] =
\r
- {
\r
- "Joystick Up\r\n",
\r
- "Joystick Down\r\n",
\r
- "Joystick Left\r\n",
\r
- "Joystick Right\r\n",
\r
- "Joystick Pressed\r\n",
\r
- };
\r
-
\r
if (JoyStatus_LCL & JOY_UP)
\r
if (JoyStatus_LCL & JOY_UP)
\r
- ReportString =
JoystickStrings[0]
;
\r
+ ReportString =
"Joystick Up\r\n"
;
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
- ReportString =
JoystickStrings[1]
;
\r
+ ReportString =
"Joystick Down\r\n"
;
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
- ReportString =
JoystickStrings[2]
;
\r
+ ReportString =
"Joystick Left\r\n"
;
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
- ReportString =
JoystickStrings[3]
;
\r
+ ReportString =
"Joystick Right\r\n"
;
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
- ReportString =
JoystickStrings[4]
;
\r
+ ReportString =
"Joystick Pressed\r\n"
;
\r
else
\r
ActionSent = false;
\r
\r
else
\r
ActionSent = false;
\r
\r
diff --git
a/Demos/Device/LowLevel/CDC/CDC.c
b/Demos/Device/LowLevel/CDC/CDC.c
index
12cd8c4
..
0c98c11
100644
(file)
--- a/
Demos/Device/LowLevel/CDC/CDC.c
+++ b/
Demos/Device/LowLevel/CDC/CDC.c
@@
-247,14
+247,6
@@
void CDC_Task(void)
char* ReportString = NULL;
\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();
\r
static bool ActionSent = false;
\r
char* ReportString = NULL;
\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();
\r
static bool ActionSent = false;
\r
- char* JoystickStrings[] =
\r
- {
\r
- "Joystick Up\r\n",
\r
- "Joystick Down\r\n",
\r
- "Joystick Left\r\n",
\r
- "Joystick Right\r\n",
\r
- "Joystick Pressed\r\n",
\r
- };
\r
\r
/* Device must be connected and configured for the task to run */
\r
if (USB_DeviceState != DEVICE_STATE_Configured)
\r
\r
/* Device must be connected and configured for the task to run */
\r
if (USB_DeviceState != DEVICE_STATE_Configured)
\r
@@
-285,22
+277,20
@@
void CDC_Task(void)
\r
/* Determine if a joystick action has occurred */
\r
if (JoyStatus_LCL & JOY_UP)
\r
\r
/* Determine if a joystick action has occurred */
\r
if (JoyStatus_LCL & JOY_UP)
\r
- ReportString =
JoystickStrings[0]
;
\r
+ ReportString =
"Joystick Up\r\n"
;
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
- ReportString =
JoystickStrings[1]
;
\r
+ ReportString =
"Joystick Down\r\n"
;
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
- ReportString =
JoystickStrings[2]
;
\r
+ ReportString =
"Joystick Left\r\n"
;
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
- ReportString =
JoystickStrings[3]
;
\r
+ ReportString =
"Joystick Right\r\n"
;
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
- ReportString = JoystickStrings[4];
\r
+ ReportString = "Joystick Pressed\r\n";
\r
+ else
\r
+ ActionSent = false;
\r
\r
/* Flag management - Only allow one string to be sent per action */
\r
\r
/* Flag management - Only allow one string to be sent per action */
\r
- if (ReportString == NULL)
\r
- {
\r
- ActionSent = false;
\r
- }
\r
- else if ((ActionSent == false) && LineEncoding.BaudRateBPS)
\r
+ if ((ReportString != NULL) && (ActionSent == false) && LineEncoding.BaudRateBPS)
\r
{
\r
ActionSent = true;
\r
\r
{
\r
ActionSent = true;
\r
\r
diff --git
a/Demos/Device/LowLevel/DualCDC/DualCDC.c
b/Demos/Device/LowLevel/DualCDC/DualCDC.c
index
7a84c8d
..
efbecd6
100644
(file)
--- a/
Demos/Device/LowLevel/DualCDC/DualCDC.c
+++ b/
Demos/Device/LowLevel/DualCDC/DualCDC.c
@@
-230,14
+230,6
@@
void CDC1_Task(void)
char* ReportString = NULL;
\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();
\r
static bool ActionSent = false;
\r
char* ReportString = NULL;
\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();
\r
static bool ActionSent = false;
\r
- char* JoystickStrings[] =
\r
- {
\r
- "Joystick Up\r\n",
\r
- "Joystick Down\r\n",
\r
- "Joystick Left\r\n",
\r
- "Joystick Right\r\n",
\r
- "Joystick Pressed\r\n",
\r
- };
\r
\r
/* Device must be connected and configured for the task to run */
\r
if (USB_DeviceState != DEVICE_STATE_Configured)
\r
\r
/* Device must be connected and configured for the task to run */
\r
if (USB_DeviceState != DEVICE_STATE_Configured)
\r
@@
-245,22
+237,20
@@
void CDC1_Task(void)
\r
/* Determine if a joystick action has occurred */
\r
if (JoyStatus_LCL & JOY_UP)
\r
\r
/* Determine if a joystick action has occurred */
\r
if (JoyStatus_LCL & JOY_UP)
\r
- ReportString =
JoystickStrings[0]
;
\r
+ ReportString =
"Joystick Up\r\n"
;
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
- ReportString =
JoystickStrings[1]
;
\r
+ ReportString =
"Joystick Down\r\n"
;
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
else if (JoyStatus_LCL & JOY_LEFT)
\r
- ReportString =
JoystickStrings[2]
;
\r
+ ReportString =
"Joystick Left\r\n"
;
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
else if (JoyStatus_LCL & JOY_RIGHT)
\r
- ReportString =
JoystickStrings[3]
;
\r
+ ReportString =
"Joystick Right\r\n"
;
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
else if (JoyStatus_LCL & JOY_PRESS)
\r
- ReportString = JoystickStrings[4];
\r
+ ReportString = "Joystick Pressed\r\n";
\r
+ else
\r
+ ActionSent = false;
\r
\r
/* Flag management - Only allow one string to be sent per action */
\r
\r
/* Flag management - Only allow one string to be sent per action */
\r
- if (ReportString == NULL)
\r
- {
\r
- ActionSent = false;
\r
- }
\r
- else if ((ActionSent == false) && LineEncoding1.BaudRateBPS)
\r
+ if ((ReportString != NULL) && (ActionSent == false) && LineEncoding1.BaudRateBPS)
\r
{
\r
ActionSent = true;
\r
\r
{
\r
ActionSent = true;
\r
\r