Added standard stream example to the ClassDriver CDC device demo.
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 30 Jul 2009 10:54:57 +0000 (10:54 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 30 Jul 2009 10:54:57 +0000 (10:54 +0000)
Fix incorrect HWB button mask in the STK526 Buttons driver.

Demos/Device/ClassDriver/CDC/CDC.c
Demos/Device/LowLevel/CDC/CDC.c
LUFA/Drivers/Board/STK526/Buttons.h
LUFA/ManPages/ChangeLog.txt

index 3e83ec2..836a6e0 100644 (file)
@@ -57,6 +57,28 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
                        },\r
        };\r
 \r
+#if 0\r
+/* NOTE: Here you can set up a standard stream using the created virtual serial port, so that the standard stream functions in\r
+ *       <stdio.h> can be used on the virtual serial port (e.g. fprintf(&USBSerial, "Test"); to print a string).\r
+ */\r
+\r
+static int CDC_putchar(char c, FILE *stream)\r
+{\r
+       CDC_Device_SendByte(&VirtualSerial_CDC_Interface, c);\r
+       return 0;\r
+}\r
+\r
+static int CDC_getchar(FILE *stream)\r
+{\r
+       if (!(CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface)))\r
+         return -1;\r
+\r
+       return CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);\r
+}\r
+\r
+static FILE USBSerial = FDEV_SETUP_STREAM(CDC_putchar, CDC_getchar, _FDEV_SETUP_RW);\r
+#endif\r
+\r
 /** Main program entry point. This routine contains the overall program flow, including initial\r
  *  setup of all components and the main program loop.\r
  */\r
index e63257d..8a992c7 100644 (file)
@@ -55,7 +55,7 @@ CDC_Line_Coding_t LineCoding = { .BaudRateBPS = 9600,
  *       <stdio.h> can be used on the virtual serial port (e.g. fprintf(&USBSerial, "Test"); to print a string).\r
  */\r
        \r
-static int CDC_putchar (char c, FILE *stream)\r
+static int CDC_putchar(char c, FILE *stream)\r
 {        \r
        Endpoint_SelectEndpoint(CDC_TX_EPNUM);\r
 \r
@@ -71,7 +71,7 @@ static int CDC_putchar (char c, FILE *stream)
        return 0;\r
 }\r
 \r
-static int CDC_getchar (FILE *stream)\r
+static int CDC_getchar(FILE *stream)\r
 {\r
        int c;\r
          \r
index fba578c..9d392f2 100644 (file)
@@ -64,7 +64,7 @@
        /* Public Interface - May be used in end-application: */\r
                /* Macros: */\r
                        /** Button mask for the first button on the board. */\r
-                       #define BUTTONS_BUTTON1      (1 << 2)\r
+                       #define BUTTONS_BUTTON1      (1 << 7)\r
        \r
                /* Inline Functions: */\r
                #if !defined(__DOXYGEN__)\r
index 483e0a6..02146a2 100644 (file)
@@ -76,6 +76,7 @@
   *  - Fixed incorrect PIPE_EPNUM_MASK mask causing pipe failures on devices with endpoint addresses of 8 and above (thanks to John Andrews)\r
   *  - Fixed report data alignment issues in the MouseHostWithParser demo when X and Y movement data size is not a multiple of 8 bits\r
   *  - Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered\r
+  *  - Fixed incorrect BUTTONS_BUTTON1 for the STK526 target\r
   *\r
   *\r
   *  \section Sec_ChangeLog090605 Version 090605\r