aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-08-24 13:02:38 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-08-24 13:02:38 +0000
commit092f82e06fc64436fd957b4b6b8d5ce33532efae (patch)
tree3060a52e5f3e3a3486e7d2bd272cfc8e7ab58190 /Projects
parented8ad18f26ef36a7c0cafd3aac1f672a06d14f76 (diff)
downloadlufa-092f82e06fc64436fd957b4b6b8d5ce33532efae.tar.gz
lufa-092f82e06fc64436fd957b4b6b8d5ce33532efae.tar.bz2
lufa-092f82e06fc64436fd957b4b6b8d5ce33532efae.zip
Changed the signature of the CALLBACK_USB_GetDescriptor() callback function so that the descriptor pointer is const, to remove the need for extra casting inside the callback (thanks to Jonathan Kollasch).
Diffstat (limited to 'Projects')
-rw-r--r--Projects/AVRISP-MKII/Descriptors.c18
-rw-r--r--Projects/AVRISP-MKII/Descriptors.h3
-rw-r--r--Projects/Benito/Descriptors.c16
-rw-r--r--Projects/Benito/Descriptors.h3
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/Descriptors.c16
-rw-r--r--Projects/Incomplete/MIDIToneGenerator/Descriptors.h3
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.c16
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.h3
-rw-r--r--Projects/LEDNotifier/Descriptors.c16
-rw-r--r--Projects/LEDNotifier/Descriptors.h3
-rw-r--r--Projects/Magstripe/Descriptors.c20
-rw-r--r--Projects/Magstripe/Descriptors.h3
-rw-r--r--Projects/RelayBoard/Descriptors.c18
-rw-r--r--Projects/RelayBoard/Descriptors.h5
-rw-r--r--Projects/TempDataLogger/Descriptors.c20
-rw-r--r--Projects/TempDataLogger/Descriptors.h3
-rw-r--r--Projects/USBtoSerial/Descriptors.c16
-rw-r--r--Projects/USBtoSerial/Descriptors.h3
-rw-r--r--Projects/Webserver/Descriptors.c18
-rw-r--r--Projects/Webserver/Descriptors.h3
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.c2
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.h3
22 files changed, 111 insertions, 100 deletions
diff --git a/Projects/AVRISP-MKII/Descriptors.c b/Projects/AVRISP-MKII/Descriptors.c
index 243c57020..5559bc11e 100644
--- a/Projects/AVRISP-MKII/Descriptors.c
+++ b/Projects/AVRISP-MKII/Descriptors.c
@@ -174,41 +174,41 @@ USB_Descriptor_String_t PROGMEM SerialString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
case 0x03:
- Address = (void*)&SerialString;
+ Address = &SerialString;
Size = pgm_read_byte(&SerialString.Header.Size);
break;
}
diff --git a/Projects/AVRISP-MKII/Descriptors.h b/Projects/AVRISP-MKII/Descriptors.h
index f991aa022..6c0e0d163 100644
--- a/Projects/AVRISP-MKII/Descriptors.h
+++ b/Projects/AVRISP-MKII/Descriptors.h
@@ -75,6 +75,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/Benito/Descriptors.c b/Projects/Benito/Descriptors.c
index 6a9e791bb..282bbdcc8 100644
--- a/Projects/Benito/Descriptors.c
+++ b/Projects/Benito/Descriptors.c
@@ -214,37 +214,37 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
diff --git a/Projects/Benito/Descriptors.h b/Projects/Benito/Descriptors.h
index a670563cf..ce29816f1 100644
--- a/Projects/Benito/Descriptors.h
+++ b/Projects/Benito/Descriptors.h
@@ -79,6 +79,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/Incomplete/MIDIToneGenerator/Descriptors.c b/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
index 9ce300afc..fc3addb95 100644
--- a/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
+++ b/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
@@ -285,37 +285,37 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
diff --git a/Projects/Incomplete/MIDIToneGenerator/Descriptors.h b/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
index fc648de4b..8165fedf6 100644
--- a/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
+++ b/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
@@ -77,6 +77,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
index cd2b0d3b8..d2e59868a 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
@@ -178,37 +178,37 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
index d78bbba20..4065209b4 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
@@ -84,6 +84,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c
index 316ad45eb..71d7813e6 100644
--- a/Projects/LEDNotifier/Descriptors.c
+++ b/Projects/LEDNotifier/Descriptors.c
@@ -226,37 +226,37 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
diff --git a/Projects/LEDNotifier/Descriptors.h b/Projects/LEDNotifier/Descriptors.h
index 387034f11..1c1f4694d 100644
--- a/Projects/LEDNotifier/Descriptors.h
+++ b/Projects/LEDNotifier/Descriptors.h
@@ -79,6 +79,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c
index 219ead1e7..eb2b72b1e 100644
--- a/Projects/Magstripe/Descriptors.c
+++ b/Projects/Magstripe/Descriptors.c
@@ -198,48 +198,48 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
case DTYPE_HID:
- Address = (void*)&ConfigurationDescriptor.HID_KeyboardHID;
+ Address = &ConfigurationDescriptor.HID_KeyboardHID;
Size = sizeof(USB_HID_Descriptor_t);
break;
case DTYPE_Report:
- Address = (void*)&KeyboardReport;
+ Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;
}
diff --git a/Projects/Magstripe/Descriptors.h b/Projects/Magstripe/Descriptors.h
index 85d073780..850d6bc24 100644
--- a/Projects/Magstripe/Descriptors.h
+++ b/Projects/Magstripe/Descriptors.h
@@ -66,6 +66,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c
index e792aec7e..d05de457e 100644
--- a/Projects/RelayBoard/Descriptors.c
+++ b/Projects/RelayBoard/Descriptors.c
@@ -155,41 +155,41 @@ USB_Descriptor_String_t PROGMEM RelayBoard_SerialString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&RelayBoard_DeviceDescriptor;
+ Address = &RelayBoard_DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&RelayBoard_ConfigurationDescriptor;
+ Address = &RelayBoard_ConfigurationDescriptor;
Size = sizeof(RelayBoard_USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&RelayBoard_LanguageString;
+ Address = &RelayBoard_LanguageString;
Size = pgm_read_byte(&RelayBoard_LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&RelayBoard_ManufacturerString;
+ Address = &RelayBoard_ManufacturerString;
Size = pgm_read_byte(&RelayBoard_ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&RelayBoard_ProductString;
+ Address = &RelayBoard_ProductString;
Size = pgm_read_byte(&RelayBoard_ProductString.Header.Size);
break;
case 0x03:
- Address = (void*)&RelayBoard_SerialString;
+ Address = &RelayBoard_SerialString;
Size = pgm_read_byte(&RelayBoard_SerialString.Header.Size);
break;
}
diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h
index f6357f821..2cf2e8d69 100644
--- a/Projects/RelayBoard/Descriptors.h
+++ b/Projects/RelayBoard/Descriptors.h
@@ -41,7 +41,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
-
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@@ -56,6 +55,6 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress);
-
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/TempDataLogger/Descriptors.c b/Projects/TempDataLogger/Descriptors.c
index 564d5ee83..d6e89603c 100644
--- a/Projects/TempDataLogger/Descriptors.c
+++ b/Projects/TempDataLogger/Descriptors.c
@@ -239,48 +239,48 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
case DTYPE_HID:
- Address = (void*)&ConfigurationDescriptor.HID_GenericHID;
+ Address = &ConfigurationDescriptor.HID_GenericHID;
Size = sizeof(USB_HID_Descriptor_t);
break;
case DTYPE_Report:
- Address = (void*)&GenericReport;
+ Address = &GenericReport;
Size = sizeof(GenericReport);
break;
}
diff --git a/Projects/TempDataLogger/Descriptors.h b/Projects/TempDataLogger/Descriptors.h
index ff0d25cff..7f65cab33 100644
--- a/Projects/TempDataLogger/Descriptors.h
+++ b/Projects/TempDataLogger/Descriptors.h
@@ -56,6 +56,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/USBtoSerial/Descriptors.c b/Projects/USBtoSerial/Descriptors.c
index 16d3429d4..7fa6ab990 100644
--- a/Projects/USBtoSerial/Descriptors.c
+++ b/Projects/USBtoSerial/Descriptors.c
@@ -226,37 +226,37 @@ USB_Descriptor_String_t PROGMEM ProductString =
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
diff --git a/Projects/USBtoSerial/Descriptors.h b/Projects/USBtoSerial/Descriptors.h
index 8012ebdde..0bd07d326 100644
--- a/Projects/USBtoSerial/Descriptors.h
+++ b/Projects/USBtoSerial/Descriptors.h
@@ -79,6 +79,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c
index 0b134c0ad..8bf3edbe3 100644
--- a/Projects/Webserver/Descriptors.c
+++ b/Projects/Webserver/Descriptors.c
@@ -174,37 +174,39 @@ USB_Descriptor_String_t PROGMEM ProductString =
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
+ const uint8_t wIndex,
+ const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
- void* Address = NULL;
- uint16_t Size = NO_DESCRIPTOR;
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
- Address = (void*)&DeviceDescriptor;
+ Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
- Address = (void*)&ConfigurationDescriptor;
+ Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
- Address = (void*)&LanguageString;
+ Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
- Address = (void*)&ManufacturerString;
+ Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
- Address = (void*)&ProductString;
+ Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h
index b7d15e48f..1b40df159 100644
--- a/Projects/Webserver/Descriptors.h
+++ b/Projects/Webserver/Descriptors.h
@@ -68,6 +68,7 @@
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c
index ded80c22e..0764bb9a8 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.c
+++ b/Projects/XPLAINBridge/XPLAINBridge.c
@@ -249,7 +249,7 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress)
+ const void** const DescriptorAddress)
{
/* Return the correct descriptors based on the selected mode */
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h
index ee747ee1a..74fa4458d 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.h
+++ b/Projects/XPLAINBridge/XPLAINBridge.h
@@ -95,6 +95,7 @@
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
- void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif