Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL...
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 24 Mar 2010 05:50:09 +0000 (05:50 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 24 Mar 2010 05:50:09 +0000 (05:50 +0000)
Minor documentation cleanups.

Make sure HID class driver uses properly cast pointers when writing to the report buffer.

Demos/Device/ClassDriver/AudioInput/AudioInput.c
Demos/Device/LowLevel/AudioInput/AudioInput.c
LUFA/Drivers/USB/Class/Host/HID.c
LUFA/Drivers/USB/HighLevel/StdDescriptors.h
LUFA/ManPages/ChangeLog.txt
Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h

index b90ee51..22d0173 100644 (file)
@@ -104,7 +104,7 @@ void ProcessNextSample(void)
                \r
                #if defined(MICROPHONE_BIASED_TO_HALF_RAIL)\r
                /* Microphone is biased to half rail voltage, subtract the bias from the sample value */\r
-               AudioSample -= (SAMPLE_MAX_RANGE / 2));\r
+               AudioSample -= (SAMPLE_MAX_RANGE / 2);\r
                #endif\r
 \r
                Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample);\r
index 2d718e5..392609b 100644 (file)
@@ -171,7 +171,7 @@ void USB_Audio_Task(void)
                \r
                #if defined(MICROPHONE_BIASED_TO_HALF_RAIL)\r
                /* Microphone is biased to half rail voltage, subtract the bias from the sample value */\r
-               AudioSample -= (SAMPLE_MAX_RANGE / 2));\r
+               AudioSample -= (SAMPLE_MAX_RANGE / 2);\r
                #endif\r
 \r
                /* Write the sample to the buffer */\r
index b95f73c..5d5d2ef 100644 (file)
@@ -181,6 +181,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
        Pipe_Unfreeze();\r
        \r
        uint16_t ReportSize;\r
+       uint8_t* BufferPos = Buffer;\r
 \r
 #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)\r
        if (!(HIDInterfaceInfo->State.UsingBootProtocol))\r
@@ -190,7 +191,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
                if (HIDInterfaceInfo->Config.HIDParserData->UsingReportIDs)\r
                {\r
                        ReportID = Pipe_Read_Byte();\r
-                       *((uint8_t*)Buffer++) = ReportID;\r
+                       *(BufferPos++) = ReportID;\r
                }\r
                \r
                ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In);\r
@@ -201,7 +202,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
                ReportSize = Pipe_BytesInPipe();\r
        }\r
 \r
-       if ((ErrorCode = Pipe_Read_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)\r
+       if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)\r
          return ErrorCode;\r
         \r
        Pipe_ClearIN();         \r
index b79b784..4090aaa 100644 (file)
@@ -86,7 +86,7 @@
                                #define USE_INTERNAL_SERIAL           NO_DESCRIPTOR\r
                        #endif\r
                        \r
-                       /** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */\r
+                       /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamps. */\r
                        #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1)\r
 \r
                        /** Macro to calculate the Unicode length of a string with a given number of Unicode characters.\r
                         */\r
                        #define USB_CONFIG_ATTR_BUSPOWERED        0x80\r
 \r
-                       \r
                        /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t\r
                         *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power\r
                         *  from the device's own power source.\r
index a534922..520ef2f 100644 (file)
@@ -30,6 +30,7 @@
   *  - Fixed ADC routines failing to read the extended channels (Channels 8 to 13, Internal Temperature Sensor) on the\r
   *    U4 series USB AVR parts\r
   *  - Fixed LowLevel MassStorage demo broken on the U2 AVRs due to double-banked endpoints\r
+  *  - Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL is defined (thanks to C. Scott Ananian)\r
   *\r
   *  \section Sec_ChangeLog100219 Version 100219\r
   *\r
index 6d6931c..f7f39d5 100644 (file)
@@ -64,7 +64,7 @@
                /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
-               #define AUDIO_SAMPLE_FREQUENCY   24000\r
+               #define AUDIO_SAMPLE_FREQUENCY    24000\r
                \r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r