Przeglądaj źródła

Documentation revised

Dmitry 9 lat temu
rodzic
commit
b89ff495bb

+ 8 - 8
inc/hid_usage_button.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -27,14 +27,14 @@
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
  * @{ */
 
-#define HID_PAGE_BUTTON                 0x09
+#define HID_USAGE_PAGE_BUTTON           0x09    /**<\brief HID usage page for Buttons */
 
-#define HID_BUTTON_NO_PRESSED           0x00
-#define HID_BUTTON_1                    0x01
-#define HID_BUTTON_2                    0x02
-#define HID_BUTTON_3                    0x03
-#define HID_BUTTON_4                    0x04
-#define HID_BUTTON_5                    0x05
+#define HID_BUTTON_NO_PRESSED           0x00    /**<\brief No button pressed */
+#define HID_BUTTON_1                    0x01    /**<\brief Button 1 pressed */
+#define HID_BUTTON_2                    0x02    /**<\brief Button 2 pressed */
+#define HID_BUTTON_3                    0x03    /**<\brief Button 3 pressed */
+#define HID_BUTTON_4                    0x04    /**<\brief Button 4 pressed */
+#define HID_BUTTON_5                    0x05    /**<\brief Button 5 pressed */
 
 /** @}  */
 

+ 124 - 72
inc/hid_usage_desktop.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -27,78 +27,130 @@
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
  * @{ */
 
-#define HID_PAGE_DESKTOP                0x01
-
-#define HID_DESKTOP_POINTER             0x01
-#define HID_DESKTOP_MOUSE               0x02
-#define HID_DESKTOP_JOYSTICK            0x04
-#define HID_DESKTOP_GAMEPAD             0x05
-#define HID_DESKTOP_KEYBOARD            0x06
-#define HID_DESKTOP_KEYPAD              0x07
-#define HID_DESKTOP_MULTIAXIS           0x08
-#define HID_DESKTOP_TABLET              0x09
-#define HID_DESKTOP_X                   0x30
-#define HID_DESKTOP_Y                   0x31
-#define HID_DESKTOP_Z                   0x32
-#define HID_DESKTOP_RX                  0x33
-#define HID_DESKTOP_RY                  0x34
-#define HID_DESKTOP_RZ                  0x35
-#define HID_DESKTOP_SLIDER              0x36
-#define HID_DESKTOP_DIAL                0x37
-#define HID_DESKTOP_WHEEL               0x38
-#define HID_DESKTOP_HAT_SWITCH          0x39
-#define HID_DESKTOP_COUNTEDBUF          0x3A
-#define HID_DESKTOP_BYTECOUNT           0x3B
-#define HID_DESKTOP_MOTION_WAKEUP       0x3C
-#define HID_DESKTOP_START               0x3D
-#define HID_DESKTOP_SELECT              0x3C
-#define HID_DESKTOP_VX                  0x40
-#define HID_DESKTOP_VY                  0x41
-#define HID_DESKTOP_VZ                  0x42
-#define HID_DESKTOP_VBRX                0x43
-#define HID_DESKTOP_VBRY                0x44
-#define HID_DESKTOP_VBRZ                0x45
-#define HID_DESKTOP_VNO                 0x46
-#define HID_DESKTOP_FEATURE_NOTIFY      0x47
-#define HID_DESKTOP_RESOLUTION_MULTIPLY 0x48
-#define HID_DESKTOP_SYS_CONTROL         0x80
-#define HID_DESKTOP_SYS_PWR_DOWN        0x81
-#define HID_DESKTOP_SYS_SLEEP           0x82
-#define HID_DESKTOP_SYS_WAKEUP          0x83
-#define HID_DESKTOP_SYS_CONTEXT_MENU    0x84
-#define HID_DESKTOP_SYS_MAIN_MENU       0x85
-#define HID_DESKTOP_SYS_APP_MENU        0x86
-#define HID_DESKTOP_SYS_MENU_HELP       0x87
-#define HID_DESKTOP_SYS_MENU_EXIT       0x88
-#define HID_DESKTOP_SYS_MENU_SELECT     0x89
-#define HID_DESKTOP_SYS_MENU_RIGHT      0x8A
-#define HID_DESKTOP_SYS_MENU_LEFT       0x8B
-#define HID_DESKTOP_SYS_MENU_UP         0x8C
-#define HID_DESKTOP_SYS_MENU_DOWN       0x8D
-#define HID_DESKTOP_SYS_RESTART_COLD    0x8E
-#define HID_DESKTOP_SYS_RESTART_WARM    0x8F
-#define HID_DESKTOP_DPAD_UP             0x90
-#define HID_DESKTOP_DPAD_DOWN           0x91
-#define HID_DESKTOP_DPAD_RIGHT          0x92
-#define HID_DESKTOP_DPAD_LEFT           0x93
-#define HID_DESKTOP_SYS_DOCK            0xA0
-#define HID_DESKTOP_SYS_UNDOCK          0xA1
-#define HID_DESKTOP_SYS_STARTUP         0xA2
-#define HID_DESKTOP_SYS_BREAK           0xA3
-#define HID_DESKTOP_SYS_DBG_BREAK       0xA4
-#define HID_DESKTOP_APP_BREAK           0xA5
-#define HID_DESKTOP_APP_DBG_BREAK       0xA6
-#define HID_DESKTOP_SYS_SPKR_MUTE       0xA7
-#define HID_DESKTOP_SYS_HIBERNATE       0xA8
-#define HID_DESKTOP_SYS_DISP_INVERT     0xB0
-#define HID_DESKTOP_SYS_DISP_INT        0xB1
-#define HID_DESKTOP_SYS_DISP_EXT        0xB2
-#define HID_DESKTOP_SYS_DISP_BOTH       0xB3
-#define HID_DESKTOP_SYS_DISP_DUAL       0xB4
-#define HID_DESKTOP_SYS_DISP_TOGGLE     0xB5
-#define HID_DESKTOP_SYS_DISP_SWAP       0xB6
-#define HID_DESKTOP_SYS_DISP_AUTOSCALE  0xB7
+#define HID_USAGE_PAGE_DESKTOP      0x01    /**<\brief Desktop usage page.*/
 
+/**\name Application Usages
+ * @{ */
+#define HID_DESKTOP_POINTER         0x01    /**<\brief CP Pointer control.*/
+#define HID_DESKTOP_MOUSE           0x02    /**<\brief CA Mouse.*/
+#define HID_DESKTOP_JOYSTICK        0x04    /**<\brief CA Joystick.*/
+#define HID_DESKTOP_GAMEPAD         0x05    /**<\brief CA Gamepad.*/
+#define HID_DESKTOP_KEYBOARD        0x06    /**<\brief CA Keybiard.*/
+#define HID_DESKTOP_KEYPAD          0x07    /**<\brief CA Keypad.*/
+#define HID_DESKTOP_MULTIAXIS       0x08    /**<\brief CA 3D input device.*/
+#define HID_DESKTOP_TABLET          0x09    /**<\brief CA System controls on Tablet PCs.*/
+/** @} */
+
+/**\name Axis Usages
+ * @{ */
+#define HID_DESKTOP_X               0x30    /**<\brief DV Linear translation in the X direction.*/
+#define HID_DESKTOP_Y               0x31    /**<\brief DV Linear translation in the Y direction.*/
+#define HID_DESKTOP_Z               0x32    /**<\brief DV Linear translation in the Z direction.*/
+#define HID_DESKTOP_RX              0x33    /**<\brief DV Rotation about X axis.*/
+#define HID_DESKTOP_RY              0x34    /**<\brief DV Rotation about Y axis.*/
+#define HID_DESKTOP_RZ              0x35    /**<\brief DV Rotation about Z axis.*/
+/** @} */
+
+/**\name Miscellaneous Controls
+ * @{ */
+#define HID_DESKTOP_SLIDER          0x36    /**<\brief DV Linear control for a variable value.*/
+#define HID_DESKTOP_DIAL            0x37    /**<\brief DV Rotary control for a variable value.*/
+#define HID_DESKTOP_WHEEL           0x38    /**<\brief DV Rotary control for a variable value.*/
+#define HID_DESKTOP_HAT_SWITCH      0x39    /**<\brief DV A specialized mechanical configuration of
+                                             * switches generating a variable value with a null state.*/
+#define HID_DESKTOP_MOTION_WAKEUP   0x3C    /**<\brief DF Enables the generation of a USB remote
+                                             * wakeup when the device detects motion.*/
+#define HID_DESKTOP_START           0x3D    /**<\brief OOC Session start button.*/
+#define HID_DESKTOP_SELECT          0x3E    /**<\brief OOC Application option select button.*/
+#define HID_DESKTOP_RESOLUTION_MULT 0x48    /**<\brief DV Resolution Multiplier for a Control.*/
+/** @} */
+
+/**\name Vector Usages
+ * @{ */
+#define HID_DESKTOP_VX              0x40    /**<\brief DV Vector in the X direction.*/
+#define HID_DESKTOP_VY              0x41    /**<\brief DV Vector in the Y direction.*/
+#define HID_DESKTOP_VZ              0x42    /**<\brief DV Vector in the Z direction.*/
+#define HID_DESKTOP_VBRX            0x43    /**<\brief DV Relative Vector in the X direction.*/
+#define HID_DESKTOP_VBRY            0x44    /**<\brief DV Relative vector in the Y direction.*/
+#define HID_DESKTOP_VBRZ            0x45    /**<\brief DV Relative vector in the Z direction.*/
+#define HID_DESKTOP_VNO             0x46    /**<\brief DV A non oriented vector or value.*/
+/** @} */
+
+/**\name System Controls
+ * @{ */
+#define HID_DESKTOP_SYS_CONTROL     0x80    /**<\brief CA Application-level collection.*/
+#define HID_DESKTOP_SYS_CONTEXT_MNU 0x84    /**<\brief OSC Evokes a context-sensitive menu.*/
+#define HID_DESKTOP_SYS_MAIN_MNU    0x85    /**<\brief OSC Evokes the OS main-level selection menu.*/
+#define HID_DESKTOP_SYS_APP_MNU     0x86    /**<\brief OSC Displays an application-specific menu.*/
+#define HID_DESKTOP_SYS_MENU_HELP   0x87    /**<\brief OSC Displays the help menu.*/
+#define HID_DESKTOP_SYS_MENU_EXIT   0x88    /**<\brief OSC Exits a menu.*/
+#define HID_DESKTOP_SYS_MENU_SELECT 0x89    /**<\brief OSC Selects a menu item.*/
+#define HID_DESKTOP_SYS_MENU_RIGHT  0x8A    /**<\brief RTC Menu select right.*/
+#define HID_DESKTOP_SYS_MENU_LEFT   0x8B    /**<\brief RTC Menu select left.*/
+#define HID_DESKTOP_SYS_MENU_UP     0x8C    /**<\brief RTC Menu select up.*/
+#define HID_DESKTOP_SYS_MENU_DOWN   0x8D    /**<\brief RTC Menu select down.*/
+/** @} */
+
+/**\name Power Controls
+ * @{ */
+#define HID_DESKTOP_SYS_PWR_DOWN    0x81    /**<\brief OSC Power down control.*/
+#define HID_DESKTOP_SYS_SLEEP       0x82    /**<\brief OSC Sleep control.*/
+#define HID_DESKTOP_SYS_WAKEUP      0x83    /**<\brief OSC Wakeup control.*/
+#define HID_DESKTOP_SYS_RST_COLD    0x8E    /**<\brief OSC Cold restart control.*/
+#define HID_DESKTOP_SYS_RST_WARM    0x8F    /**<\brief OSC Warm restart control.*/
+#define HID_DESKTOP_SYS_DOCK        0xA0    /**<\brief OSC Prepare for docking.*/
+#define HID_DESKTOP_SYS_UNDOCK      0xA1    /**<\brief OSC Prepare for undocking. */
+#define HID_DESKTOP_SYS_SETUP       0xA2    /**<\brief OSC Enter to BIOS-level setup.*/
+#define HID_DESKTOP_SYS_SPKR_MUTE   0xA7    /**<\brief OSC Mute system speakers.*/
+#define HID_DESKTOP_SYS_HIBERNATE   0xA8    /**<\brief OSC System hibernate control.*/
+/** @} */
+
+/**\name Buffered Bytes
+ * @{ */
+#define HID_DESKTOP_COUNTEDBUF      0x3A    /**<\brief CL Used with buffered byte data to indicate
+                                             * the number of valid bytes in the buffered-byte field.*/
+#define HID_DESKTOP_BYTECOUNT       0x3B    /**<\brief DV Defines a report field that indicates the
+                                             * number of meaningful data bytes in an associated
+                                             * buffered-byte field.*/
+/** @} */
+
+/**\name Direction Pads
+ * @{ */
+#define HID_DESKTOP_DPAD_UP         0x90    /**<\brief OOC Top of a Direction Pad is pressed.*/
+#define HID_DESKTOP_DPAD_DOWN       0x91    /**<\brief OOC Bottom of a Direction Pad is pressed.*/
+#define HID_DESKTOP_DPAD_RIGHT      0x92    /**<\brief OOC Right side of a Direction Pad is pressed.*/
+#define HID_DESKTOP_DPAD_LEFT       0x93    /**<\brief OOC Left side of a Direction Pad is pressed.*/
+/** @} */
+
+/**\name Feature Notifications
+ * @{ */
+#define HID_DESKTOP_FEATURE_NOTIFY  0x47    /**<\brief DV This usage is declared in an Input report
+                                             * and is used as a notification to the host that the
+                                             * contents of a specific Feature report has changed.*/
+/** @} */
+
+/**\name Software Flow Control
+ * @{ */
+#define HID_DESKTOP_SYS_BREAK       0xA3    /**<\brief OSC System break control.*/
+#define HID_DESKTOP_SYS_DBG_BREAK   0xA4    /**<\brief OSC System debugger break control.*/
+#define HID_DESKTOP_APP_BREAK       0xA5    /**<\brief OSC Application break control.*/
+#define HID_DESKTOP_APP_DBG_BREAK   0xA6    /**<\brief OSC Application debugger break control.*/
+/** @} */
+
+/**\name System Display Control
+ * @{ */
+#define HID_DESKTOP_SYS_DISP_INVERT 0xB0    /**<\brief OSC Set display to render in inverted colors.*/
+#define HID_DESKTOP_SYS_DISP_INT    0xB1    /**<\brief OSC Set the captive display as the primary display.*/
+#define HID_DESKTOP_SYS_DISP_EXT    0xB2    /**<\brief OSC Set the external display as the primary display.*/
+#define HID_DESKTOP_SYS_DISP_BOTH   0xB3    /**<\brief OSC Use both internal and external displays
+                                             * as primary diaplay.*/
+#define HID_DESKTOP_SYS_DISP_DUAL   0xB4    /**<\brief OSC Use both internal and external displays
+                                             * as primary and secondary diaplays.*/
+#define HID_DESKTOP_SYS_DISP_TGL    0xB5    /**<\brief OSC Toggles internal/external/both displays.*/
+#define HID_DESKTOP_SYS_DISP_SWAP   0xB6    /**<\brief OSC Swap primary/secondary displays.*/
+#define HID_DESKTOP_SYS_DISP_AUTO   0xB7    /**<\brief OCS Toggles LCD autoscale.*/
+
+/** @}  */
 /** @}  */
 
 #ifdef __cplusplus

+ 10 - 12
inc/hid_usage_device.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -17,21 +17,19 @@
 #define _USB_HID_USAGE_DEVICE_H_
 
 /**\ingroup USB_HID
- * \addtogroup ISB_HID_USAGES_DEVICE HID Usages for Device
+ * \addtogroup USB_HID_USAGES_DEVICE HID Usages for Device
  * \brief Contains USB HID Usages definitions for Generic Device Control Page
  * \details This module based on
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
  * @{ */
-
-#define HID_PAGE_DEVICE                 0x06
-
-#define HID_DEVICE_BATTERY_STRENGHT     0x20
-#define HID_DEVICE_WIRELESS_CHANNEL     0x21
-#define HID_DEVICE_WIRELESS_ID          0x22
-#define HID_DEVICE_DISCO_WIRELESS_CTL   0x23
-#define HID_DEVICE_SECURITY_CHAR_ENT    0x24
-#define HID_DEVICE_SECURITY_CHAR_ERA    0x25
-#define HID_DEVICE_SCURITY_CODE_CLR     0x26
+#define HID_DEVICE_PAGE_DEVICE         0x06    /**<\brief Generic device control usage page.*/
+#define HID_DEVICE_BATTERY_STRENGHT    0x20    /**<\brief DV Current battery status.*/
+#define HID_DEVICE_WIRELESS_CHANNEL    0x21    /**<\brief DV Logical wireless channel.*/
+#define HID_DEVICE_WIRELESS_ID         0x22    /**<\brief DV Unique wireless device ID.*/
+#define HID_DEVICE_DISCO_WIRELESS_CTL  0x23    /**<\brief OSC Wirleless discover control.*/
+#define HID_DEVICE_SECURITY_CHAR_ENT   0x24    /**<\brief OSC Code character entered.*/
+#define HID_DEVICE_SECURITY_CHAR_ERA   0x25    /**<\brief OSC Code character erased.*/
+#define HID_DEVICE_SCURITY_CODE_CLR    0x26    /**<\brief OSC Security code cleared.*/
 
 #endif
 

+ 1 - 1
inc/hid_usage_game.h

@@ -33,7 +33,7 @@
 #define HID_GAME_PITCH_FWD_BACK         0x22
 #define HID_GAME_ROLL_LEFT_RIGHT        0x23
 #define HID_GAME_MOVE_LEFT_RIGHT        0x24
-#define HID_GAME_MOVE_FWD_BACK          0x25     
+#define HID_GAME_MOVE_FWD_BACK          0x25
 #define HID_GAME_MOVE_UP_DOWN           0x26
 #define HID_GAME_LEAN_LEFT_RIGHT        0x27
 #define HID_GAME_LEAN_FWD_BACK          0x28

+ 3 - 2
inc/hid_usage_keyboard.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -12,11 +12,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #ifndef _USB_HID_USAGE_KEYBOARD_H_
 #define _USB_HID_USAGE_KEYBOARD_H_
 
 /**\ingroup USB_HID
- * \addtogroup ISB_HID_USAGES_KEYBOARD HID Usages for Keyboard
+ * \addtogroup USB_HID_USAGES_KEYBOARD HID Usages for Keyboard
  * \brief Contains USB HID Usages definitions for Keyboard/Keypad Page
  * \details This module based on
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)

+ 1 - 1
inc/hid_usage_led.h

@@ -17,7 +17,7 @@
 #define _USB_HID_USAGE_LED_H_
 
 /**\ingroup USB_HID
- * \addtogroup ISB_HID_USAGES_DEVICE HID Usages for LED's
+ * \addtogroup USB_HID_USAGES_LED HID Usages for LED's
  * \brief Contains USB HID Usages definitions for LED's Control Page
  * \details This module based on
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)

+ 77 - 55
inc/hid_usage_simulation.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -14,73 +14,95 @@
  */
 
 #ifndef _USB_HID_USAGE_SIMUL_H_
-#define _USB_HID_USAGE_SUMUL_H_
+#define _USB_HID_USAHE_SUMUL_H_
 #ifdef __cplusplus
     extern "C" {
 #endif
 
 
 /**\ingroup USB_HID
- * \addtogroup USB_HID_USAGES HID Usage Tables for Simulation
+ * \addtogroup USB_HID_USAGES_SIMUL HID Usage Tables for Simulation
  * \brief Contains USB HID Usages definitions for Simulation Controls Page
  * \details This module based on
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
  * @{ */
 
-#define HID_PAGE_SIMULATION             0x02
+#define HID_USAGE_PAGE_SIMULATION       0x02    /**<\brief Sumulation usage page.*/
+#define HID_SIMUL_SPORTS                0x08    /**<\brief CA Genetic sports simulation device.*/
 
-#define HID_SIMUL_FLIGHT                0x01
-#define HID_SIMUL_AUTOMOBILE            0x02
-#define HID_SIMUL_TANK                  0x03
-#define HID_SIMUL_SPACESHIP             0x04
-#define HID_SIMUL_SUBMARINE             0x05
-#define HID_SIMUL_SAILING               0x06
-#define HID_SIMUL_MOTOCYCLE             0x07
-#define HID_SIMUL_SPORTS                0x08
-#define HID_SIMUL_AIRPLANE              0x09
-#define HID_SIMUL_HELICOPTER            0x0A
-#define HID_SIMUL_MAGIC_CARPET          0x0B
-#define HID_SIMUL_BICYCLE               0x0C
-#define HID_SIMUL_FLIGHT_CONTROL_STICK  0x20
-#define HID_SIMUL_FLIGHT_STICK          0x21
-#define HID_SIMUL_CYCLIC_CONTROL        0x22
-#define HID_SIMUL_CYCLIC_TRIM           0x23
-#define HID_SIMUL_FLIGHT_YOKE           0x24
-#define HID_SIMUL_TRACK_CONTROL         0x25
-#define HID_SIMUL_ALIERON               0xB0
-#define HID_SIMUL_ALIERIN_TRIM          0xB1
-#define HID_SIMUL_ANTI_TORQUE           0xB2
-#define HID_SIMUL_AUTOPILOT_ENABLE      0xB3
-#define HID_SIMUL_CHAFF_RELEASE         0xB4
-#define HID_SIMUL_COLLECTIVE_CONTROL    0xB5
-#define HID_SIMUL_DRIVE_BRAKE           0xB6
-#define HID_SIMUL_ELECTR_COUNTERMEAS    0xB7
-#define HID_SIMUL_ELEVATOR              0xB8
-#define HID_SIMUL_ELEVATOR_TRIM         0xB9
-#define HID_SIMUL_RUDDER                0xBA
-#define HID_SIMUL_THROTTLE              0xBB
-#define HID_SIMUL_FLIGHT_COMM           0xBC
-#define HID_SIMUL_FLARE_RELEASE         0xBD
-#define HID_SIMUL_LANDING_GEAR          0xBE
-#define HID_SIMUL_TOE_BRAKE             0xBF
-#define HID_SIMUL_TRIGGER               0xC0
-#define HID_SIMUL_WEAPONS_ARM           0xC1
-#define HID_SIMUL_WEAPONS_SELECT        0xC2
-#define HID_SIMUL_WING_FLAPS            0xC3
-#define HID_SIMUL_ACCELERATOR           0xC4
-#define HID_SIMUL_BRAKE                 0xC5
-#define HID_SIMUL_CLUTCH                0xC6
-#define HID_SIMUL_SHIFTER               0xC7
-#define HID_SIMUL_STEERING              0xC8
-#define HID_SIMUL_TURRET_DIRECTION      0xC9
-#define HID_SIMUL_BARREL_ELEVATION      0xCA
-#define HID_SIMUL_DRIVE_PLANE           0xCB
-#define HID_SIMUL_BALLAST               0xCC
-#define HID_SIMUL_BICYCLE_CRANK         0xCD
-#define HID_SIMUL_HANDLE_BARS           0xCE
-#define HID_SIMUL_FRONT_BRAKE           0xCF
-#define HID_SIMUL_REAR_BRAKE            0xD0
+/**\name Flight Simulation Devices
+ * @{ */
+#define HID_SIMUL_FLIGHT                0x01    /**<\brief CA Airplane simulation device.*/
+#define HID_SIMUL_SPACESHIP             0x04    /**<\brief CA Spaceship simulation device.*/
+#define HID_SIMUL_AIRPLANE              0x09    /**<\brief CA Airplane simulation device.*/
+#define HID_SIMUL_HELICOPTER            0x0A    /**<\brief CA Helicopter simulation device.*/
+#define HID_SIMUL_ALIERON               0xB0    /**<\brief DV Aileron control.*/
+#define HID_SIMUL_ALIERIN_TRIM          0xB1    /**<\brief DV Aileron fine adjustment.*/
+#define HID_SIMUL_ANTI_TORQUE           0xB2    /**<\brief DV Rudder pedals.*/
+#define HID_SIMUL_AUTOPILOT_ENABLE      0xB3    /**<\brief OOC Autopilot switch.*/
+#define HID_SIMUL_CHAFF_RELEASE         0xB4    /**<\brief OCS Chaff Release control.*/
+#define HID_SIMUL_COLLECTIVE_CONTROL    0xB5    /**<\brief DV Vertical acceleration lift confrol.*/
+#define HID_SIMUL_CYCLIC_CONTROL        0x22    /**<\brief CP Helicopter cyclic control.*/
+#define HID_SIMUL_CYCLIC_TRIM           0x23    /**<\brief CP Cyclic fine adjustments.*/
+#define HID_SIMUL_DRIVE_BRAKE           0xB6    /**<\brief DV Air brake control.*/
+#define HID_SIMUL_ELECTR_COUNTERMEAS    0xB7    /**<\brief OOC Enables electronic countermeasures.*/
+#define HID_SIMUL_ELEVATOR              0xB8    /**<\brief DV Elevator control.*/
+#define HID_SIMUL_ELEVATOR_TRIM         0xB9    /**<\brief DV Elevator fine adjustment.*/
+#define HID_SIMUL_FLIGHT_COMM           0xBC    /**<\brief OOC Flight Communications switch.*/
+#define HID_SIMUL_FLARE_RELEASE         0xBD    /**<\brief OCS Flare release button.*/
+#define HID_SIMUL_FLIGHT_CONTROL_STICK  0x20    /**<\brief CA Pitch and Roll control.*/
+#define HID_SIMUL_FLIGHT_STICK          0x21    /**<\brief CA Pitch and Roll control for games.*/
+#define HID_SIMUL_LANDING_GEAR          0xBE    /**<\brief OOC Landing gear control.*/
+#define HID_SIMUL_RUDDER                0xBA    /**<\brief DV Rudder control.*/
+#define HID_SIMUL_TOE_BRAKE             0xBF    /**<\brief DV Toe Brake control.*/
+#define HID_SIMUL_THROTTLE              0xBB    /**<\brief DV Trottle control.*/
+#define HID_SIMUL_TRIGGER               0xC0    /**<\brief MC Firearm trigger control.*/
+#define HID_SIMUL_WEAPONS_ARM           0xC1    /**<\brief OOC Enables weapons system.*/
+#define HID_SIMUL_WEAPONS_SELECT        0xC2    /**<\brief OSC Select weapon.*/
+#define HID_SIMUL_WING_FLAPS            0xC3    /**<\brief DV wing flap control.*/
+#define HID_SIMUL_FLIGHT_YOKE           0x24    /**<\brief CA A Flight Yoke controls.*/
+/** @} */
+
+/**\name Automobile Simulation Devices
+ * @{ */
+#define HID_SIMUL_AUTOMOBILE            0x02    /**<\brief CA Automobile or truck simulation device.*/
+#define HID_SIMUL_ACCELERATOR           0xC4    /**<\brief DV Accelerator control.*/
+#define HID_SIMUL_BRAKE                 0xC5    /**<\brief DV Brake control.*/
+#define HID_SIMUL_CLUTCH                0xC6    /**<\brief DV Clutch control.*/
+#define HID_SIMUL_SHIFTER               0xC7    /**<\brief DV Shifting gears control.*/
+#define HID_SIMUL_STEERING              0xC8    /**<\brief DV Steering wheel control.*/
+/** @} */
 
+/**\name Tank Simulation Devices
+ * @{ */
+#define HID_SIMUL_TANK                  0x03    /**<\brief CA Treaded vehicle simulation device.*/
+#define HID_SIMUL_TRACK_CONTROL         0x25    /**<\brief CP Direction and velocity controls.*/
+#define HID_SIMUL_TURRET_DIRECTION      0xC9    /**<\brief DV Turret control right-left.*/
+#define HID_SIMUL_BARREL_ELEVATION      0xCA    /**<\brief DV Gun elevation control.*/
+/** @} */
+
+/**\name Maritime Simulation Devices
+ * @{ */
+#define HID_SIMUL_SUBMARINE             0x05    /**<\brief CA Submarine control.*/
+#define HID_SIMUL_SAILING               0x06    /**<\brief CA Sailing simulatiion control.*/
+#define HID_SIMUL_DIVE_PLANE            0xCB    /**<\brief DV Dive plane control*/
+#define HID_SIMUL_BALLAST               0xCC    /**<\brief DV Ballast control.*/
+/** @} */
+
+/**\name Two-wheeled Simulation Devices
+ * @{ */
+#define HID_SIMUL_MOTOCYCLE             0x07    /**<\brief CA Motocycle simulation device.*/
+#define HID_SIMUL_BICYCLE               0x0C    /**<\brief CA Bycicle simulation device*/
+#define HID_SIMUL_BICYCLE_CRANK         0xCD    /**<\brief DV Bycicle crank control.*/
+#define HID_SIMUL_HANDLE_BARS           0xCE    /**<\brief DV Steering control.*/
+#define HID_SIMUL_FRONT_BRAKE           0xCF    /**<\brief DV Front brake control.*/
+#define HID_SIMUL_REAR_BRAKE            0xD0    /**<\brief DV Rear brake control.*/
+/** @} */
+
+/**\name Miscellaneous Simulation Devices
+ * @{ */
+#define HID_SIMUL_MAGIC_CARPET          0x0B    /**<\brief CA Magic carpet simulation device.*/
+/** @}  */
 /** @}  */
 
 #ifdef __cplusplus

+ 2 - 2
inc/hid_usage_sport.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -27,7 +27,7 @@
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
  * @{ */
 
-#define HID_PAGE_SPORT                  0x04
+#define HID_USAGE_PAGE_SPORT            0x04
 
 #define HID_SPORT_BASEBALL_BAT          0x01
 #define HID_SPORT_GOLF_CLUB             0x02

+ 1 - 1
inc/hid_usage_telephony.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *

+ 14 - 15
inc/hid_usage_vr.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -23,20 +23,19 @@
  * + [HID Usage Tables Version 1.12](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
  * @{ */
 
-#define HID_PAGE_VR                     0x03
-
-#define HID_VR_BELT                     0x01
-#define HID_VR_BODY_SUIT                0x02
-#define HID_VR_FLEXTOR                  0x03
-#define HID_VR_GLOVE                    0x04
-#define HID_VR_HEAD_TRACKER             0x05
-#define HID_VR_HEAD_MOUNTED_DISPLAY     0x06
-#define HID_VR_HAND_TRACKER             0x07
-#define HID_VR_OCULOMETER               0x08
-#define HID_VR_VEST                     0x09
-#define HID_VR_ANIMATRONIC_DEVICE       0x0A
-#define HID_VR_STEREO_ENABLE            0x20
-#define HID_VR_DISPLAY_ENABLE           0x21
+#define HID_USAGE_PAGE_VR               0x03    /**<\brief VR controls usage page.*/
+#define HID_VR_BELT                     0x01    /**<\brief CA Belt device.*/
+#define HID_VR_BODY_SUIT                0x02    /**<\brief CA Body suit device.*/
+#define HID_VR_FLEXTOR                  0x03    /**<\brief CA Flextor device.*/
+#define HID_VR_GLOVE                    0x04    /**<\brief CA Clove device.*/
+#define HID_VR_HEAD_TRACKER             0x05    /**<\brief CA Head tracker device.*/
+#define HID_VR_HEAD_MOUNTED_DISPLAY     0x06    /**<\brief CA Head mounted display device.*/
+#define HID_VR_HAND_TRACKER             0x07    /**<\brief CA Hand tracker device.*/
+#define HID_VR_OCULOMETER               0x08    /**<\brief CA Oculometer device.*/
+#define HID_VR_VEST                     0x09    /**<\brief CA Vest device.*/
+#define HID_VR_ANIMATRONIC_DEVICE       0x0A    /**<\brief CA Animatronic device.*/
+#define HID_VR_STEREO_ENABLE            0x20    /**<\brief OOC Stereo enable switch.*/
+#define HID_VR_DISPLAY_ENABLE           0x21    /**<\brief OOC Display enable switch.*/
 
 /** @}  */
 

+ 152 - 121
inc/usb_cdc.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -12,6 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #ifndef _USB_CDC_H_
 #define _USB_CDC_H_
 
@@ -27,198 +28,228 @@
 
 /**\name USB CDC Class codes
  * @{ */
-#define USB_CLASS_CDC                       0x02 /**< Device/Interface belongs to the Communicational device class */
-#define USB_CLASS_CDC_DATA                  0x0A /**< Interface belongs to the Data Interface class */
+#define USB_CLASS_CDC                   0x02    /**<\brief Communicational Device class */
+#define USB_CLASS_CDC_DATA              0x0A    /**<\brief Data Interface class */
 /** @} */
 
 /**\name USB CDC subclass codes
  * @{ */
-#define USB_CDC_SUBCLASS_ACM                0x02 /**< Abstract Control Model */ 
+#define USB_CDC_SUBCLASS_ACM            0x02    /**<\brief Abstract Control Model */
  /** @} */
 
 /**\name Communications Class Protocol Codes
  * @{ */
-#define USB_CDC_PROTO_V25TER                0x01 /**< AT Commands: V.250 etc */
+#define USB_CDC_PROTO_V25TER            0x01    /**<\brief AT Commands: V.250 etc.*/
  /** @} */
 
 
-/** \name Data Interface Class Protocol Codes 
+/** \name Data Interface Class Protocol Codes
  * @{ */
-#define USB_CDC_PROTO_NTB                   0x01 /**< Network Transfer Block */ 
-#define USB_CDC_PROTO_HOST                  0xFD /**< Host based driver. \note This protocol code should only be used in messages between
-                                                  * host and device to identify the host driver portion of a protocol stack.*/
-#define USB_CDC_PROTO_CDCSPEC               0xFE /**< The protocol(s) are described using a Protocol Unit Functional Descriptors on Communication Class Interface.*/
+#define USB_CDC_PROTO_NTB               0x01    /**<\brief Network Transfer Block.*/
+#define USB_CDC_PROTO_HOST              0xFD    /**<\brief Host based driver.
+                                                 * \details This protocol code should only be  used
+                                                 * in messages between host and device to identify
+                                                 * the host driver portion of a protocol stack.*/
+#define USB_CDC_PROTO_CDCSPEC           0xFE    /**<\brief CDC specified.
+                                                 * \details The protocol(s) are described using a
+                                                 * Protocol Unit Functional Descriptors on
+                                                 *Communication Class Interface.*/
 /** @} */
 
-/**\name USB CDC class-specified functional descriptors 
+/**\name USB CDC class-specified functional descriptors
  * @{ */
-#define USB_DTYPE_CDC_HEADER                0x00 /**< Header Functional Descriptor. \ref usb_cdc_header_desc */
-#define USB_DTYPE_CDC_CALL_MANAGEMENT       0x01 /**< Call Management Functional Descriptor. \ref usb_cdc_call_mgmt_desc */ 
-#define USB_DTYPE_CDC_ACM                   0x02 /**< Abstract Control Management Functional Descriptor. \ref usb_cdc_acm_desc */
-#define USB_DTYPE_CDC_UNION                 0x06 /**< Union Functional descriptor */
-#define USB_DTYPE_CDC_COUNTRY               0x07 /**< Country Selection Functional Descriptor */
+#define USB_DTYPE_CDC_HEADER            0x00    /**<\brief Header Functional Descriptor.*/
+#define USB_DTYPE_CDC_CALL_MANAGEMENT   0x01    /**<\brief Call Management Functional Descriptor.*/
+#define USB_DTYPE_CDC_ACM               0x02    /**<\brief Abstract Control Management Functional
+                                                 * Descriptor.*/
+#define USB_DTYPE_CDC_UNION             0x06    /**<\brief Union Functional Descriptor.*/
+#define USB_DTYPE_CDC_COUNTRY           0x07    /**<\brief Country Selection Functional Descriptor.*/
 /** @} */
 
 
 
 /** \name USB CDC class-specific requests
  * @{ */
-#define USB_CDC_SEND_ENCAPSULATED_CMD       0x00 /**< Used to issue a command in the format of the supported control protocol of the Communication Class interface. */
-#define USB_CDC_GET_ENCAPSULATED_RESP       0x01 /**< Used to request a response in the format of the supported control protocol of the Communication Class interface. */
-#define USB_CDC_SET_COMM_FEATURE            0x02 /**< Controls the settings for a particular communication feature of a particular target */
-#define USB_CDC_GET_COMM_FEATURE            0x03 /**< Returns the current settings for the communication feature as selected */
-#define USB_CDC_CLEAR_COMM_FEATURE          0x04 /**< Controls the settings for a particular communication feature of a particular 
-                                                  * target, setting the selected feature to its default state. */
-#define USB_CDC_SET_LINE_CODING             0x20 /**< Allows the host to specify typical asynchronous line-character formatting properties. */
-#define USB_CDC_GET_LINE_CODING             0x21 /**< Allows the host to find out the currently configured line coding. */
-#define USB_CDC_SET_CONTROL_LINE_STATE      0x22 /**< Generates RS-232/V.24 style control signals. */
-#define USB_CDC_SEND_BREAK                  0x23 /**< Sends special carrier modulation that generates an RS-232 style break. */
+#define USB_CDC_SEND_ENCAPSULATED_CMD   0x00    /**<\brief Used to issue a command in the format of
+                                                 * the supported control protocol of the Communication
+                                                 * Class interface.*/
+#define USB_CDC_GET_ENCAPSULATED_RESP   0x01    /**<\brief Used to request a response in the format
+                                                 * of the supported control protocol of the
+                                                 * Communication Class interface.*/
+#define USB_CDC_SET_COMM_FEATURE        0x02    /**<\brief Controls the settings for a particular
+                                                 * communication feature  of a particular target.*/
+#define USB_CDC_GET_COMM_FEATURE        0x03    /**<\brief Returns the current settings for the
+                                                 * communication feature as selected.*/
+#define USB_CDC_CLEAR_COMM_FEATURE      0x04    /**<\brief Controls the settings for a particular
+                                                 * communication feature of a particular target,
+                                                 * setting the selected feature to its default state.*/
+#define USB_CDC_SET_LINE_CODING         0x20    /**<\brief Allows the host to specify typical
+                                                 * asynchronous line-character  formatting properties.*/
+#define USB_CDC_GET_LINE_CODING         0x21    /**<\brief Allows the host to find out the currently
+                                                 * configured line coding.*/
+#define USB_CDC_SET_CONTROL_LINE_STATE  0x22    /**<\brief Generates RS-232/V.24 style control signals.*/
+#define USB_CDC_SEND_BREAK              0x23    /**<\brief Sends special carrier modulation that
+                                                 * generates an RS-232 style break.*/
 /** @} */
 
-
 /**\name Generic CDC specific notifications
  * @{ */
-#define USB_CDC_NTF_NETWORK_CONNECTION      0x00  /**< Allows the device to notify the host about network connection status. */
-#define USB_CDC_NTF_RESPONSE_AVAILABLE      0x01  /**< Allows the device to notify the host that a response is available. */
-#define USB_CDC_NTF_SERIAL_STATE            0x20  /**< Sends asynchronous notification of UART status. */ 
-#define USB_CDC_NTF_SPEED_CHANGE            0x2A  /**< allows the device to inform the host-networking driver that a change in either the uplink 
-                                                   * or the downlink bit rate of the connection has occurred. */
+#define USB_CDC_NTF_NETWORK_CONNECTION  0x00    /**<\brief Allows the device to notify the host about
+                                                 * network connection status.*/
+#define USB_CDC_NTF_RESPONSE_AVAILABLE  0x01    /**<\brief Allows the device to notify the host that
+                                                 * a response is available.*/
+#define USB_CDC_NTF_SERIAL_STATE        0x20    /**<\brief Sends asynchronous notification of UART status.*/
+#define USB_CDC_NTF_SPEED_CHANGE        0x2A    /**<\brief Allows the device to inform the host-networking
+                                                 * driver that a change in either the uplink or the
+                                                 * downlink bit rate of the connection has occurred.*/
 /** @} */
 
 
 /**\anchor USB_CDC_ACMGMNTCAP
- * \name USB CDC Abstract Control Management capabilities 
+ * \name USB CDC Abstract Control Management capabilities
  * @{ */
-#define USB_CDC_COMM_FEATURE                0x01 /**< Supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature. */
-#define USB_CDC_CAP_LINE                    0x02 /**< Supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State. */
-#define USB_CDC_CAP_BRK                     0x04 /**< Supports the request Send_Break */
-#define USB_CDC_CAP_NOTIFY                  0x08 /**< Supports notification Network_Connection. */
+#define USB_CDC_COMM_FEATURE            0x01    /**<\brief Supports the request combination of
+                                                 * Set_Comm_Feature, Clear_Comm_Feature, Get_Comm_Feature.*/
+#define USB_CDC_CAP_LINE                0x02    /**<\brief Supports the request combination of
+                                                 * Set_Line_Coding, Set_Control_Line_State,
+                                                 * Get_Line_Coding, and the notification Serial_State.*/
+#define USB_CDC_CAP_BRK                 0x04    /**<\brief Supports the request Send_Break.*/
+#define USB_CDC_CAP_NOTIFY              0x08    /**<\brief Supports notification Network_Connection.*/
 /** @} */
 
 /**\anchor USB_CDC_CALLMGMTCAP
  * \name USB CDC Call Management capabilities
  * @{ */
-#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT     0x01 /**< Device handles call management itself. */
-#define USB_CDC_CALL_MGMT_CAP_DATA_INTF     0x02 /**< Device can send/receive call management information over a Data Class interface. */
+#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01    /**<\brief Device handles call management itself.*/
+#define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02    /**<\brief Device can send/receive call management
+                                                 * information over a Data Class interface.*/
 /** @} */
 
 /**\anchor USB_CDC_LINECODE
  * \name Line coding structire bit fields
  * @{ */
-#define USB_CDC_1_STOP_BITS                 0x00
-#define USB_CDC_1_5_STOP_BITS               0x01
-#define USB_CDC_2_STOP_BITS                 0x02
-
-#define USB_CDC_NO_PARITY                   0x00
-#define USB_CDC_ODD_PARITY                  0x01
-#define USB_CDC_EVEN_PARITY                 0x02
-#define USB_CDC_MARK_PARITY                 0x03
-#define USB_CDC_SPACE_PARITY                0x04
+#define USB_CDC_1_STOP_BITS             0x00    /**<\brief 1 stop bit.*/
+#define USB_CDC_1_5_STOP_BITS           0x01    /**<\brief 1.5 stop bits.*/
+#define USB_CDC_2_STOP_BITS             0x02    /**<\brief 2 stop bits.*/
+#define USB_CDC_NO_PARITY               0x00    /**<\brief NO parity bit.*/
+#define USB_CDC_ODD_PARITY              0x01    /**<\brief ODD parity bit.*/
+#define USB_CDC_EVEN_PARITY             0x02    /**<\brief EVEN parity bit.*/
+#define USB_CDC_MARK_PARITY             0x03    /**<\brief patity is MARK.*/
+#define USB_CDC_SPACE_PARITY            0x04    /**<\brief patity is SPACE.*/
 /** @} */
 
 /**\name SERIAL_STATE notification data values
  * @{ */
-#define USB_CDC_STATE_RX_CARRIER          0x0001 /**< State of receiver carrier detection mechanism of device. This signal corresponds to V.24 signal 109 and RS-232 signal DCD. */
-#define USB_CDC_STATE_TX_CARRIER          0x0002 /**< State of transmission carrier. This signal corresponds to V.24 signal 106 and RS-232 signal DSR. */
-#define USB_CDC_STATE_BREAK               0x0004 /**< State of break detection mechanism of the device. */
-#define USB_CDC_STATE_RING                0x0008 /**< State of ring signal detection of the device. */
-#define USB_CDC_STATE_FRAMING             0x0010 /**< A framing error has occurred. */
-#define USB_CDC_STATE_PARITY              0x0020 /**< A parity error has occurred. */
-#define USB_CDC_STATE_OVERRUN             0x0040 /**< Received data has been discarded due to overrun in the device */
+#define USB_CDC_STATE_RX_CARRIER        0x0001 /**<\brief State of receiver carrier detection mechanism.
+                                                * \details This signal corresponds to V.24 signal 109
+                                                * and RS-232 DCD.*/
+#define USB_CDC_STATE_TX_CARRIER        0x0002 /**<\brief State of transmission carrier.
+                                                * \details This signal corresponds to V.24 signal 106
+                                                * and RS-232 DSR.*/
+#define USB_CDC_STATE_BREAK             0x0004 /**<\brief State of break detection mechanism of the device.*/
+#define USB_CDC_STATE_RING              0x0008 /**<\brief State of ring signal detection of the device.*/
+#define USB_CDC_STATE_FRAMING           0x0010 /**<\brief A framing error has occurred.*/
+#define USB_CDC_STATE_PARITY            0x0020 /**<\brief A parity error has occurred.*/
+#define USB_CDC_STATE_OVERRUN           0x0040 /**<\brief Received data has been discarded due to
+                                                * overrun in the device.*/
 /** @} */
 
-/** \brief Header Functional Descriptor
- * \details Header Functional Descriptor marks the beginning of the concatenated set of functional descriptors for the interface. */
-
+/**\brief Header Functional Descriptor
+ * \details Header Functional Descriptor marks the beginning of the concatenated set of functional
+ * descriptors for the interface. */
 struct usb_cdc_header_desc {
-    uint8_t     bFunctionLength;    /**< Size of this descriptor in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Header functional descriptor subtype \ref USB_DTYPE_CDC_HEADER */
-    uint16_t    bcdCDC;             /**< USB CDC Specification release number in binary-coded decimal. \see \ref VERSION_BCD macro */
+    uint8_t     bFunctionLength;    /**<\brief Size of this descriptor in bytes.*/
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType; /**<\brief Header functional descriptor subtype.*/
+    uint16_t    bcdCDC;             /**<\brief USB CDC Specification release number in BCD.*/
 } __attribute__ ((packed));
 
-/** \brief Union Functional Descriptor
- * \details The Union functional descriptor describes the relationship between a group of interfaces that can be considered to form
- * a functional unit. It can only occur within the class-specific portion of an Interface descriptor. One of the interfaces in
- * the group is designated as a master or controlling interface for the group, and certain class-specific messages can be
- * sent to this interface to act upon the group as a whole.
- */
+/**\brief Union Functional Descriptor
+ * \details The Union functional descriptor describes the relationship between a group of interfaces
+ * that can be considered to form a functional unit. It can only occur within the class-specific
+ * portion of an Interface descriptor. One of the interfaces in the group is designated as a master
+ * or controlling interface for the group, and certain class-specific messages can be sent to this
+ * interface to act upon the group as a whole.*/
 struct usb_cdc_union_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Union Functional Descriptor. \ref USB_DTYPE_CDC_UNION */
-    uint8_t     bMasterInterface0;  /**< The interface number of the CDC interface, designated as the master or controlling interface for the union. */
-    uint8_t     bSlaveInterface0;   /**< Interface number of first slave or associated interface in the union. */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType; /**<\brief Union Functional Descriptor.*/
+    uint8_t     bMasterInterface0;  /**<\brief The interface number of the CDC interface designated
+                                     * as the master or controlling interface for the union.*/
+    uint8_t     bSlaveInterface0;   /**<\brief Interface number of first slave or associated interface
+                                     * in the union.*/
     /* ... and there could be other slave interfaces */
 } __attribute__ ((packed));
 
-/** \brief Country Selection Functional Descriptor
- * \details The Country Selection functional descriptor identifies the countries in which the communication device is qualified to
- * operate. The parameters of the network connection often vary from one country to another, especially in Europe. Also
- * legal requirements impose certain restrictions on devices because of different regulations by the governing body of the
- * network to which the device must adhere. This descriptor can only occur within the class-specific portion of an
- * Interface descriptor and should only be provided to a master Communication Class interface of a union. The country
- * codes used in the Country Selection Functional Descriptor are not the same as the country codes used in dialing
- * international telephone calls. Implementers should refer to the ISO 3166 specification for more information.
- */
+/**\brief Country Selection Functional Descriptor
+ * \details The Country Selection functional descriptor identifies the countries in which the
+ * communication device is qualified to operate. The parameters of the network connection often vary
+ * from one country to another, especially in Europe. Also legal requirements impose certain
+ * restrictions on devices because of different regulations by the governing body of the network to
+ * which the device must adhere. This descriptor can only occur within the class-specific portion of
+ * an Interface descriptor and should only be provided to a master Communication Class interface of
+ * a union. The country codes used in the Country Selection Functional Descriptor are not the same
+ * as the country codes used in dialing international telephone calls. Implementers should refer to
+ * the ISO 3166 specification for more information.*/
 struct usb_cdc_country_desc {
-    uint8_t     bFunctionLength;     /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;     /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType;  /**< Country Selection Functional Descriptor \ref USB_DTYPE_CDC_COUNTRY */
-    uint8_t     iCountryCodeRelDate; /**< Index of a string giving the release date for the implemented ISO 3166 Country Codes. */
-    uint8_t     wCountyCode0;        /**< Country code in hexadecimal format as defined in ISO 3166, release date as specified
+    uint8_t     bFunctionLength;     /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;     /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType;  /**<\brief Country Selection Functional Descriptor.*/
+    uint8_t     iCountryCodeRelDate; /**<\brief Index of a string giving the release date for the
+                                      * implemented ISO 3166 Country Codes. */
+    uint8_t     wCountyCode0;        /**<\brief Country code in hexadecimal format.
+                                      * \details As defined in ISO 3166, release date as specified
                                       * in iCountryCodeRelDate for the first supported country. */
     /* ... and there can be a lot of country codes */
 } __attribute__ ((packed));
 
-/** \brief Call Management Functional Descriptor.
- * \details The Call Management functional descriptor describes the processing of calls for the Communication Class interface. It
- * can only occur within the class-specific portion of an Interface descriptor.
- */
+/**\brief Call Management Functional Descriptor.
+ * \details The Call Management functional descriptor describes the processing of calls for the
+ * Communication Class interface. It can only occur within the class-specific portion of an Interface
+ * descriptor.*/
 struct usb_cdc_call_mgmt_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Call Management functional descriptor subtype \ref USB_DTYPE_CDC_CALL_MANAGEMENT */
-    uint8_t     bmCapabilities;     /**< The \ref USB_CDC_CALLMGMTCAP "capabilities" that this configuration supports */
-    uint8_t     bDataInterface;     /**< Interface number of Data Class interface optionally used for call management. */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType; /**<\brief Call Management functional descriptor subtype.*/
+    uint8_t     bmCapabilities;     /**<\brief The call management capabilities that this
+                                     * configuration supports.*/
+    uint8_t     bDataInterface;     /**<\brief Interface number of Data Class interface optionally
+                                     * used for call management.*/
 } __attribute__ ((packed));
 
-/** \brief Abstract Control Management Functional Descriptor
- * \details The Abstract Control Management functional descriptor describes the commands supported by the Communication
- * Class interface, as defined in Section 3.6.2, with the SubClass code of Abstract Control Model. It can only occur
- * within the class-specific portion of an Interface descriptor.
- */
+/**\brief Abstract Control Management Functional Descriptor
+ * \details The Abstract Control Management functional descriptor describes the commands supported
+ * by the Communication Class interface, as defined in Section 3.6.2, with the SubClass code of
+ * Abstract Control Model. It can only occur within the class-specific portion of an Interface
+ * descriptor.*/
 struct usb_cdc_acm_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Abstract Control Management functional descriptor subtype \ref USB_DTYPE_CDC_ACM */
-    uint8_t     bmCapabilities;     /**< The \ref USB_CDC_ACMGMNTCAP "capabilities" that this configuration supports */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType; /**<\brief Abstract Control Management functional descriptor subtype.*/
+    uint8_t     bmCapabilities;     /**<\brief The capabilities that this configuration supports.*/
 } __attribute__ ((packed));
 
-///\brief Notification structure from CDC
+/**\brief Notification structure from CDC */
 struct usb_cdc_notification {
-    uint8_t     bmRequestType;
-    uint8_t     bNotificationType;
-    uint16_t    wValue;
-    uint16_t    wIndex;
-    uint16_t    wLength;
-    uint8_t     Data[];
+    uint8_t     bmRequestType;      /**<\brief This bitmapped field identifies the characteristics
+                                     * of the specific request.*/
+    uint8_t     bNotificationType;  /**<\brief Notification type.*/
+    uint16_t    wValue;             /**<\brief Notification value.*/
+    uint16_t    wIndex;             /**<\brief Interface.*/
+    uint16_t    wLength;            /**<\brief Data payload length in bytes.*/
+    uint8_t     Data[];             /**<\brief Data payload.*/
 } __attribute__ ((packed));
 
-/**\brief Line Coding Structure
- * \details used in GET_LINE_CODING and SET_LINE_CODING requests
- */
+/**\brief Line Coding Structure */
 struct usb_cdc_line_coding {
-    uint32_t    dwDTERate;          /**< Data terminal rate, in bits per second. */
-    uint8_t     bCharFormat;        /**< Stop bits */
-    uint8_t     bParityType;        /**< Parity */
-    uint8_t     bDataBits;          /**< Data bits (5,6,7,8 or 16) */
+    uint32_t    dwDTERate;          /**<\brief Data terminal rate, in bits per second.*/
+    uint8_t     bCharFormat;        /**<\brief Stop bits.*/
+    uint8_t     bParityType;        /**<\brief Parity.*/
+    uint8_t     bDataBits;          /**<\brief Data bits (5,6,7,8 or 16).*/
 } __attribute__ ((packed));
 
-
 /** @} */
 
-
 #ifdef __cplusplus
     }
 #endif

+ 50 - 36
inc/usb_cdca.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -13,10 +13,11 @@
  * limitations under the License.
  */
 
-/** \ingroup USB_CDC
- *  \addtogroup USB_CDC_ATM USB CDC ATM subclass
- *  \brief USB CDC ATM subclass definitions
- *  \details This module based on "Universal Serial Bus Communications Class Subclass Specification for Asynchronous Transfer Mode Devices" Revision 1.2
+/**\ingroup USB_CDC
+ * \addtogroup USB_CDC_ATM USB CDC ATM subclass
+ * \brief USB CDC ATM subclass definitions
+ * \details This module based on "Universal Serial Bus Communications Class Subclass Specification
+ * for Asynchronous Transfer Mode Devices" Revision 1.2
  * @{ */
 
 #ifndef _USB_CDC_ATM_H_
@@ -29,57 +30,70 @@
 
 /**\name Communications Class Subclass Codes
  * @{ */
-#define USB_CDC_SUBCLASS_ATM                0x07 /**< ATM Networking Control Model */ 
+#define USB_CDC_SUBCLASS_ATM                0x07 /**<\brief ATM Networking Control Model */
  /* @} */
 
 
 /**\name CDC ATM subclass specific Functional Descriptors codes
  * @{ */
-#define USB_DTYPE_CDC_ATM                   0x10 /**< ATM Networking Functional Descriptor */
-/** @} */    	
+#define USB_DTYPE_CDC_ATM                   0x10 /**<\brief ATM Networking Functional Descriptor */
+/** @} */
 
 /**\name CDC ATM subclass specific requests
  * @{ */
-#define USB_CDC_SET_ATM_DATA_FORMAT         0x50 /**< Chooses which ATM data format will be exchanged between the host and the ATM Networking device. */
-#define USB_CDC_GET_ATM_DEVICE_STATISTICS   0x51 /**< Retrieves global statistics from the ATM Networking device. */
-#define USB_CDC_SET_ATM_DEFAULT_VC          0x52 /**< Pre-selects the VPI/VCI value for subsequent GET_ATM_DEVICE_STATISTICS requests */
-#define USB_CDC_GET_ATM_VC_STATISTICS       0x53 /**< Retrieves statistics from the ATM Networking device for a particular VPI/VCI. */
+#define USB_CDC_SET_ATM_DATA_FORMAT         0x50 /**<\brief Chooses which ATM data format will be
+                                                  * exchanged between the host and the ATM Networking
+                                                  * device.*/
+#define USB_CDC_GET_ATM_DEVICE_STATISTICS   0x51 /**<\brief Retrieves global statistics from the ATM
+                                                  * Networking device.*/
+#define USB_CDC_SET_ATM_DEFAULT_VC          0x52 /**<\brief Pre-selects the VPI/VCI value for subsequent
+                                                  * GET_ATM_DEVICE_STATISTICS requests.*/
+#define USB_CDC_GET_ATM_VC_STATISTICS       0x53 /**<\brief Retrieves statistics from the ATM Networking
+                                                  * device for a particular VPI/VCI.*/
 /** @} */
 
-
 /**\name ATM Device Statistics Feature Selector Codes
  * @{ */
-#define ATM_STAT_US_CELLS_SENT              0x01 /**< The number of cells that have been sent upstream to the WAN link by the ATM layer. */
-#define ATM_STAT_DS_CELLS_RECEIVED          0x02 /**< The number of cells that have been received downstream from the WAN link by the ATM layer */
-#define ATM_STAT_DS_CELLS_USB_CONGESTION    0x03 /**< The number of cells that have been received downstream from the WAN link by the ATM
-                                                  * layer and discarded due to congestion on the USB link. */
-#define ATM_STAT_DS_CELLS_AAL5_CRC_ERROR    0x04 /**< The number of cells that have been received downstream from the WAN link by the ATM
-                                                  * layer and discarded due to AAL5 CRC errors. */
-#define ATM_STAT_DS_CELLS_HEC_ERROR         0x05 /**< The number of cells that have been received downstream from the WAN link and discarded
-                                                  * due to HEC errors in the cell header. */
-#define ATM_STAT_DS_CELLS_HEC_ERROR_CORRT   0x06 /**< The number of cells that have been received downstream from the WAN link and have 
-                                                  * been detected with HEC errors in the cell header and successfully corrected. */
+#define ATM_STAT_US_CELLS_SENT              0x01 /**<\brief The number of cells that have been sent
+                                                  * upstream to the WAN link by the ATM layer. */
+#define ATM_STAT_DS_CELLS_RECEIVED          0x02 /**<\brief The number of cells that have been received
+                                                  * downstream from the WAN link by the ATM layer */
+#define ATM_STAT_DS_CELLS_USB_CONGESTION    0x03 /**<\brief The number of cells that have been received
+                                                  * downstream from the WAN link by the ATM layer and
+                                                  * discarded due to congestion on the USB link.*/
+#define ATM_STAT_DS_CELLS_AAL5_CRC_ERROR    0x04 /**<\brief The number of cells that have been received
+                                                  * downstream from the WAN link by the ATM layer and
+                                                  * discarded due to AAL5 CRC errors.*/
+#define ATM_STAT_DS_CELLS_HEC_ERROR         0x05 /**<\brief The number of cells that have been received
+                                                  * downstream from the WAN link and discarded due to
+                                                  * HEC errors in the cell header.*/
+#define ATM_STAT_DS_CELLS_HEC_ERROR_CORRT   0x06 /**<\brief The number of cells that have been received
+                                                  * downstream from the WAN link and have been detected
+                                                  * with HEC errors in the cell  header and successfully
+                                                  * corrected. */
 /** @} */
 
-/**\brief ATM Networking Functional Descriptor */        
+/**\brief ATM Networking Functional Descriptor */
 struct usb_cdc_atm_desc {
-    uint8_t     bFunctionLength;        /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;        /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType;     /**< ATM Networking Functional Descriptor subtype \ref USB_DTYPE_CDC_ATM */
-    uint8_t     iEndSystemIdentifier;   /**< The string descriptor holds the End System Identifier. */
-    uint8_t     bmDataCapabilities;     /**< The ATM data types the device supports */
-    uint8_t     bmATMDeviceStatistics;  /**< Indicates which optional statistics functions the device collects. */
-    uint16_t    wType2MaxSegmentSize;   /**< The maximum segment size that the Type 2 device is capable of supporting */
-    uint16_t    wType3MaxSegmentSize;   /**< The maximum segment size that the Type 3 device is capable of supporting */
-    uint16_t    wMaxVC;                 /**< The maximum number of simultaneous virtual circuits the device is capable
-                                         * of supporting (Type 3 only) */
+    uint8_t     bFunctionLength;        /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;        /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType;     /**<\brief ATM Networking Functional Descriptor subtype.*/
+    uint8_t     iEndSystemIdentifier;   /**<\brief The string descriptor holds the End System Identifier. */
+    uint8_t     bmDataCapabilities;     /**<\brief The ATM data types the device supports.*/
+    uint8_t     bmATMDeviceStatistics;  /**<\brief Indicates which optional statistics functions the
+                                         * device collects. */
+    uint16_t    wType2MaxSegmentSize;   /**<\brief The maximum segment size that the Type 2 device
+                                         * is capable of supporting */
+    uint16_t    wType3MaxSegmentSize;   /**<\brief The maximum segment size that the Type 3 device
+                                         * is capable of supporting */
+    uint16_t    wMaxVC;                 /**<\brief The maximum number of simultaneous virtual circuits
+                                         * the device is capable of supporting (Type 3 only) */
 } __attribute__((packed));
 
 /** @} */
 
-
 #ifdef __cplusplus
     }
 #endif
 
-#endif /* _USB_CDC_ATM_H_ */    	
+#endif /* _USB_CDC_ATM_H_ */

+ 67 - 28
inc/usb_cdce.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -13,11 +13,11 @@
  * limitations under the License.
  */
 
-/** \ingroup USB_CDC
- *  \addtogroup USB_CDC_ECM USB CDC ECM subclass
- *  \brief USB CDC ECM subclass definitions
- *  \details Includes following subclasses
- * + Ethernet Control Model
+/**\ingroup USB_CDC
+ * \addtogroup USB_CDC_ECM USB CDC ECM subclass
+ * \brief USB CDC ECM subclass definitions
+ * \details This module based on "Universal Serial Bus Communications Class Subclass Specification for
+ * Ethernet Control Model Devices Revision 1.2"
  * @{ */
 
 #ifndef _USB_CDC_ECM_H_
@@ -27,24 +27,62 @@
     extern "C" {
 #endif
 
-
 /**\name Communications Class Subclass Codes
  * @{ */
-#define USB_CDC_SUBCLASS_ETH                0x06 /**< Ethernet Networking Control Model */
+#define USB_CDC_SUBCLASS_ETH                0x06 /**<\brief Ethernet Networking Control Model */
  /* @} */
 
 /**\name CDC ECM subclass specific Functional Descriptors codes
  * @{ */
-#define USB_DTYPE_CDC_ETHERNET              0x0F /**< Ethernet Networking Functional Descriptor*/
-/** @} */    	
+#define USB_DTYPE_CDC_ETHERNET              0x0F /**<\brief Ethernet Networking Functional Descriptor*/
+/** @} */
 
 /**\name CDC ECM subclass specific requests
  * @{ */
-#define USB_CDC_SET_ETH_MULTICAST_FILTERS   0x40 /**<  */
-#define USB_CDC_SET_ETH_PM_PATTERN_FILTER   0x41 /**<  */
-#define USB_CDC_GET_ETH_PM_PATTERN_FILTER   0x42 /**<  */
-#define USB_CDC_SET_ETH_PACKET_FILTER       0x43 /**< Sets device filter for running a network analyzer application on the host machine */
-#define USB_CDC_GET_ETH_STATISTIC           0x44 /**< Retrieves Ethernet device statistics such as frames transmitted, frames received, and bad frames received. */
+#define USB_CDC_SET_ETH_MULTICAST_FILTERS   0x40 /**<\brief  */
+#define USB_CDC_SET_ETH_PM_PATTERN_FILTER   0x41 /**<\brief  */
+#define USB_CDC_GET_ETH_PM_PATTERN_FILTER   0x42 /**<\brief  */
+#define USB_CDC_SET_ETH_PACKET_FILTER       0x43 /**<\brief Sets device filter for running a network
+                                                  * analyzer application on the host machine.*/
+#define USB_CDC_GET_ETH_STATISTIC           0x44 /**<\brief Retrieves Ethernet device statistics such
+                                                  * as frames transmitted, frames received, and bad
+                                                  * frames received.*/
+/** @} */
+
+/**\name Ethernet Statistics Capabilities
+ * @{ */
+#define USB_ETH_XMIT_OK                     (1<<0)  /**<\brief Frames transmitted without errors.*/
+#define USB_ETH_RCV_OK                      (1<<1)  /**<\brief Frames received without errors.*/
+#define USB_ETH_XMIT_ERROR                  (1<<2)  /**<\brief Frames not transmitted, or transmitted
+                                                     * with errors.*/
+#define USB_ETH_RCV_ERROR                   (1<<3)  /**<\brief Frames received with errors that are
+                                                     * not delivered to the USB host. */
+#define USB_ETH_RCV_NO_BUFFER               (1<<4)  /**<\brief Frame missed, no buffers */
+#define USB_ETH_DIRECTED_BYTES_XMIT         (1<<5)  /**<\brief Directed bytes transmitted without errors */
+#define USB_ETH_DIRECTED_FRAMES_XMIT        (1<<6)  /**<\brief Directed frames transmitted without errors */
+#define USB_ETH_MULTICAST_BYTES_XMIT        (1<<7)  /**<\brief Multicast bytes transmitted without errors */
+#define USB_ETH_MULTICAST_FRAMES_XMIT       (1<<8)  /**<\brief Multicast frames transmitted without errors */
+#define USB_ETH_BROADCAST_BYTES_XMIT        (1<<9)  /**<\brief Broadcast bytes transmitted without errors */
+#define USB_ETH_BROADCAST_FRAMES_XMIT       (1<<10) /**<\brief Broadcast frames transmitted without errors */
+#define USB_ETH_DIRECTED_BYTES_RCV          (1<<11) /**<\brief Directed bytes received without errors */
+#define USB_ETH_DIRECTED_FRAMES_RCV         (1<<12) /**<\brief Directed frames received without errors */
+#define USB_ETH_MULTICAST_BYTES_RCV         (1<<13) /**<\brief Multicast bytes received without errors */
+#define USB_ETH_MULTICAST_FRAMES_RCV        (1<<14) /**<\brief Multicast frames received without errors */
+#define USB_ETH_BROADCAST_BYTES_RCV         (1<<15) /**<\brief Broadcast bytes received without errors */
+#define USB_ETH_BROADCAST_FRAMES_RCV        (1<<16) /**<\brief Broadcast frames received without errors */
+#define USB_ETH_RCV_CRC_ERROR               (1<<17) /**<\brief Frames received with circular redundancy check
+                                                     * (CRC) or frame check sequence (FCS) error */
+#define USB_ETH_TRANSMIT_QUEUE_LENGTH       (1<<18) /**<\brief Length of transmit queue */
+#define USB_ETH_RCV_ERROR_ALIGNMENT         (1<<19) /**<\brief Frames received with alignment error */
+#define USB_ETH_XMIT_ONE_COLLISION          (1<<20) /**<\brief Frames transmitted with one collision */
+#define USB_ETH_XMIT_MORE_COLLISIONS        (1<<21) /**<\brief Frames transmitted with more than one collision */
+#define USB_ETH_XMIT_DEFERRED               (1<<22) /**<\brief Frames transmitted after deferral */
+#define USB_ETH_XMIT_MAX_COLLISIONS         (1<<23) /**<\brief Frames not transmitted due to collisions */
+#define USB_ETH_RCV_OVERRUN                 (1<<24) /**<\brief Frames not received due to overrun */
+#define USB_ETH_XMIT_UNDERRUN               (1<<25) /**<\brief Frames not transmitted due to underrun */
+#define USB_ETH_XMIT_HEARTBEAT_FAILURE      (1<<26) /**<\brief Frames transmitted with heartbeat failure */
+#define USB_ETH_XMIT_TIMES_CRS_LOST         (1<<27) /**<\brief Times carrier sense signal lost during transmission */
+#define USB_ETH_XMIT_LATE_COLLISIONS        (1<<28) /**<\brief Late collisions detected */
 /** @} */
 
 
@@ -54,24 +92,25 @@
  * Networking Control. It can only occur within the class-specific portion of an Interface descriptor.
  */
 struct usb_cdc_ether_desc {
-    uint8_t     bFunctionLength;				/**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;				/**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType;				/**< Ethernet Networking Functional Descriptor. \ref USB_DTYPE_CDC_ETHERNET */
-    uint8_t     iMACAddress;					/**< Index of string descriptor that holds the 48bit Ethernet MAC address. */
-    uint32_t    bmEthernetStatistics;			/**< Indicates which Ethernet statistics functions the device collects. */
-    uint16_t    wMaxSegmentSize;				/**< The maximum segment size that the Ethernet device is capable of supporting. */
-    uint16_t    wNumberMCFilters;				/**< Contains the number of multicast filters that can be configured by the host. */
-    uint8_t     bNumberPowerFilters;			/**< Contains the number of pattern filters that are available for causing wake-up of the host. */
+    uint8_t     bFunctionLength;        /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;        /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType;     /**<\brief Ethernet Networking Functional Descriptor.*/
+    uint8_t     iMACAddress;            /**<\brief Index of string descriptor that holds the
+                                         * 48bit Ethernet MAC.*/
+    uint32_t    bmEthernetStatistics;   /**<\brief Indicates which Ethernet statistics functions
+                                         * the device collects. */
+    uint16_t    wMaxSegmentSize;        /**<\brief The maximum segment size that the Ethernet
+                                         * device is capable of supporting. */
+    uint16_t    wNumberMCFilters;       /**<\brief Contains the number of multicast filters that
+                                         * can be configured by the host. */
+    uint8_t     bNumberPowerFilters;    /**<\brief Contains the number of pattern filters that
+                                         * are available for causing wake-up of the host. */
 } __attribute__ ((packed));
 
-
-
-
 /** @} */
 
-
 #ifdef __cplusplus
     }
 #endif
 
-#endif /* _USB_CDC_ECM_H_ */    	
+#endif /* _USB_CDC_ECM_H_ */

+ 99 - 93
inc/usb_cdci.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -16,7 +16,8 @@
 /** \ingroup USB_CDC
  *  \addtogroup USB_CDC_ISDN USB CDC ISDN subclass
  *  \brief USB CDC ISDN subclass definitions
- *  \details This module based on "Universal Serial Bus Communications Class Subclass Specification for ISDN Devices" Revision 1.2
+ *  \details This module based on "Universal Serial Bus Communications Class Subclass Specification
+ * for ISDN Devices" Revision 1.2
  *  \details This module cotains definitions for
  * + Multiple Line Control Model
  * + CAPI Control Model
@@ -32,86 +33,92 @@
 
 /**\name Communications Class Subclass Codes
  * @{ */
-#define USB_CDC_SUBCLASS_MCNL               0x04 /**< Multi-Channel Control Model */
-#define USB_CDC_SUBCLASS_CAPI               0x05 /**< CAPI Control Model */
+#define USB_CDC_SUBCLASS_MCNL           0x04    /**<\brief Multi-Channel Control Model */
+#define USB_CDC_SUBCLASS_CAPI           0x05    /**<\brief CAPI Control Model */
  /* @} */
 
-/** \name CDC ISDN Data Interface Class Protocol Codes 
+/** \name CDC ISDN Data Interface Class Protocol Codes
  * @{ */
-#define USB_CDC_PROTO_I340                  0x30 /**< Physical interface protocol for ISDN BRI */
-#define USB_CDC_PROTO_HDLC                  0x31 /**< HDLC */
-#define USB_CDC_PROTO_TRANSPARENT           0x32 /**< Transparent */
-#define USB_CDC_PROTO_Q921M                 0x50 /**< Management protocol for Q.921 data link protocol */
-#define USB_CDC_PROTO_Q921                  0x51 /**< Data link protocol for Q.931 */
-#define USB_CDC_PROTO_Q921TM                0x52 /**< TEI-multiplexor for Q.921 data link protocol */
-#define USB_CDC_PROTO_V42BIS                0x90 /**< Data compression procedures */
-#define USB_CDC_PROTO_Q931                  0x91 /**< Euro-ISDN protocol control */
-#define USB_CDC_PROTO_V120                  0x92 /**< V.24 rate adaptation to ISDN */
-#define USB_CDC_PROTO_CAPI20                0x93 /**< CAPI Commands */
+#define USB_CDC_PROTO_I340              0x30    /**<\brief Physical interface protocol for ISDN BRI */
+#define USB_CDC_PROTO_HDLC              0x31    /**<\brief HDLC */
+#define USB_CDC_PROTO_TRANSPARENT       0x32    /**<\brief Transparent */
+#define USB_CDC_PROTO_Q921M             0x50    /**<\brief Management protocol for Q.921 data link protocol */
+#define USB_CDC_PROTO_Q921              0x51    /**<\brief Data link protocol for Q.931 */
+#define USB_CDC_PROTO_Q921TM            0x52    /**<\brief TEI-multiplexor for Q.921 data link protocol */
+#define USB_CDC_PROTO_V42BIS            0x90    /**<\brief Data compression procedures */
+#define USB_CDC_PROTO_Q931              0x91    /**<\brief Euro-ISDN protocol control */
+#define USB_CDC_PROTO_V120              0x92    /**<\brief V.24 rate adaptation to ISDN */
+#define USB_CDC_PROTO_CAPI20            0x93    /**<\brief CAPI Commands */
 /** @} */
 
 /**\name CDC ISDN subclass specific Functional Descriptors codes
  * @{ */
-#define USB_DTYPE_CDC_TERMINAL              0x09 /**< USB Terminal Functional Descriptor \ref usb_cdc_terminal_desc */
-#define USB_DTYPE_CDC_NETWORK_TERMINAL      0x0A /**< Network Channel Terminal Descriptor \ref usb_cdc_network_terminal_desc*/
-#define USB_DTYPE_CDC_PROTOCOL_UNIT         0x0B /**< Protocol Unit Functional Descriptor \ref usb_cdc_proto_unit_desc*/
-#define USB_DTYPE_CDC_EXTENSION_UNIT        0x0C /**< Extension Unit Functional Descriptor \ref usb_cdc_ext_unit_desc*/
-#define USB_DTYPE_CDC_MCNL_MANAGEMENT       0x0D /**< Multi-Channel Management Functional Descriptor \ref usb_cdc_mcnl_managemnt_desc */
-#define USB_DTYPE_CDC_CAPI_CONTROL          0x0E /**< CAPI Control Management Functional Descriptor */
-/** @} */    	
+#define USB_DTYPE_CDC_TERMINAL          0x09    /**<\brief USB Terminal Functional Descriptor */
+#define USB_DTYPE_CDC_NETWORK_TERMINAL  0x0A    /**<\brief Network Channel Terminal Descriptor */
+#define USB_DTYPE_CDC_PROTOCOL_UNIT     0x0B    /**<\brief Protocol Unit Functional Descriptor */
+#define USB_DTYPE_CDC_EXTENSION_UNIT    0x0C    /**<\brief Extension Unit Functional Descriptor */
+#define USB_DTYPE_CDC_MCNL_MANAGEMENT   0x0D    /**<\brief Multi-Channel Management Functional Descriptor */
+#define USB_DTYPE_CDC_CAPI_CONTROL      0x0E    /**<\brief CAPI Control Management Functional Descriptor */
+/** @} */
 
 /**\name CDC ISDN subclass specific requests
  * @{ */
-#define USB_CDC_SET_UNIT_PARAMETER          0x37 /**< Used to set a Unit specific parameter. */
-#define USB_CDC_GET_UNIT_PARAMETER          0x38 /**< Used to retrieve a Unit specific parameter */
-#define USB_CDC_CLEAR_UNIT_PARAMETER        0x39 /**< Used to set a Unit specific parameter to its default state. */
-#define USB_CDC_GET_PROFILE                 0x3A /**< Returns the implemented capabilities of the device */
+#define USB_CDC_SET_UNIT_PARAMETER      0x37    /**<\brief Used to set a Unit specific parameter. */
+#define USB_CDC_GET_UNIT_PARAMETER      0x38    /**<\brief Used to retrieve a Unit specific parameter */
+#define USB_CDC_CLEAR_UNIT_PARAMETER    0x39    /**<\brief Used to set a Unit specific parameter to
+                                                 * its default state. */
+#define USB_CDC_GET_PROFILE             0x3A    /**<\brief Returns the implemented capabilities of
+                                                 * the device */
 /** @} */
 
 /**\anchor USB_DFU_MCNHCAP
  * \name Multi-Channel Management Functional Descriptor capabilities
  * @{ */
-#define USB_CDC_MCHN_UNIT_NVRAM             0x01 /**< Device stores Unit parameters in non-volatile memory. */
-#define USB_CDC_MCHN_UNIT_CLR               0x02 /**< Device supports the request Clear_Unit_Parameter. */
-#define USB_CDC_MCHN_UNIR_SET               0x04 /**< Device supports the request Set_Unit_Parameter.*/
+#define USB_CDC_MCHN_UNIT_NVRAM         0x01    /**<\brief Device stores Unit parameters in
+                                                 * non-volatile memory. */
+#define USB_CDC_MCHN_UNIT_CLR           0x02    /**<\brief Device supports the request Clear_Unit_Parameter. */
+#define USB_CDC_MCHN_UNIR_SET           0x04    /**<\brief Device supports the request Set_Unit_Parameter.*/
 /** @} */
 
 /**\anchor USB_DFU_CAPICAP
  * \name CAPI Control Management Functional Descriptor capabilities
  * @{ */
-#define USB_CDC_CAPI_SIMPLE                 0x00 /**< Device is a Simple CAPI device. */
-#define USB_CDC_CAPI_INTELLIGENT            0x01 /**< Device is an Intelligent CAPI device. */
+#define USB_CDC_CAPI_SIMPLE             0x00    /**<\brief Device is a Simple CAPI device. */
+#define USB_CDC_CAPI_INTELLIGENT        0x01    /**<\brief Device is an Intelligent CAPI device. */
 /** @} */
 
 /** \brief USB Terminal Functional Descriptor
- * \details The USB Terminal Functional Descriptor provides a means to indicate a relationship between a Unit and an USB
- * Interface. It also defines parameters specific to the interface between the device and the host. It can only occur within
- * the class-specific portion of an Interface descriptor.
- */
+ * \details The USB Terminal Functional Descriptor provides a means to indicate a relationship
+ * between a Unit and an USB Interface. It also defines parameters specific to the interface between
+ * the device and the host. It can only occur within the class-specific portion of an Interface
+ * descriptor.*/
 struct usb_cdc_terminal_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< USB Terminal Functional Descriptor \ref USB_DTYPE_CDC_TERMINAL */
-    uint8_t     bEntityId;          /**< Constant uniquely identifying the Terminal */
-    uint8_t     bInInterfaceNo;     /**< The input interface number of the associated USB interface. */
-    uint8_t     bOutInterfaceNo;    /**< The output interface number of the associated USB interface. */
-    uint8_t     bmOptions;          /**< D0: Protocol wrapper usage */
-    uint8_t     bChildId0;          /**< First ID of lower Terminal or Unit to which this Terminal is connected. */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief USB Terminal Functional Descriptor */
+    uint8_t     bEntityId;          /**<\brief Constant uniquely identifying the Terminal */
+    uint8_t     bInInterfaceNo;     /**<\brief The input interface number of the associated USB interface. */
+    uint8_t     bOutInterfaceNo;    /**<\brief The output interface number of the associated USB interface. */
+    uint8_t     bmOptions;          /**<\brief D0: Protocol wrapper usage */
+    uint8_t     bChildId0;          /**<\brief First ID of lower Terminal or Unit to which this
+                                     * Terminal is connected. */
     /* ... and there can be a lot of Terminals or Units */
 } __attribute__ ((packed));
 
 /** \brief Network Channel Terminal Functional Descriptor
- * \details The Network Channel Terminal Functional descriptor provides a means to indicate a relationship between a Unit and a
- * Network Channel. It can only occur within the class-specific portion of an Interface descriptor.
- */
+ * \details The Network Channel Terminal Functional descriptor provides a means to indicate a
+ * relationship between a Unit and a Network Channel. It can only occur within the class-specific
+ * portion of an Interface descriptor.*/
 struct usb_cdc_network_terminal_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Network Channel Terminal Functional Descriptor \ref USB_DTYPE_CDC_NETWORK_TERMINAL */
-    uint8_t     bEntityId;          /**< Constant uniquely identifying the Terminal */
-    uint8_t     iName;              /**< Index of string descriptor, describing the name of the Network Channel Terminal. */
-    uint8_t     bChannelIndex;      /**< The channel index of the associated network channel according to indexing rules below. */
-    uint8_t     bPhysicalInterface; /**< Type of physical interface. 
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Network Channel Terminal Functional Descriptor */
+    uint8_t     bEntityId;          /**<\brief Constant uniquely identifying the Terminal */
+    uint8_t     iName;              /**<\brief Index of string descriptor, describing the name of
+                                     * the Network Channel Terminal. */
+    uint8_t     bChannelIndex;      /**<\brief The channel index of the associated network channel
+                                     * according to indexing rules below. */
+    uint8_t     bPhysicalInterface; /**<\brief Type of physical interface.
                                      *  + 0 none
                                      *  + 1 ISDN
                                      *  + 2-200 RESERVED
@@ -119,67 +126,66 @@ struct usb_cdc_network_terminal_desc {
 } __attribute__ ((packed));
 
 /** \brief Protocol Unit Functional Descriptor
- * \details A communication protocol stack is a combination of communication functions (protocols) into a layered structure.
- * Each layer in the stack presents some abstract function for the layer above according to some layer-interface-standard,
- * making it possible to replace a function with another as long as it conforms to the standard. Each layer may have a set
- * of protocol parameters, defined in Appendix E, to configure it for proper operation in the actual environment and the
- * parameters may be retrieved and/or modified. The Unit state is initially reset. See Section 6.2.23 “SetUnitParameter”,
- * Section 6.2.24 “GetUnitParameter”, and Section 6.2.25 “ClearUnitParameter” for details.
- * A Protocol Unit Functional Descriptor identifies with bEntityId a specific protocol instance of bProtocol in a stack. It
- * can only occur within the class-specific portion of an Interface descriptor.
+ * \details A communication protocol stack is a combination of communication functions (protocols)
+ * into a layered structure. Each layer in the stack presents some abstract function for the layer
+ * above according to some layer-interface-standard, making it possible to replace a function with
+ * another as long as it conforms to the standard. Each layer may have a set of protocol parameters,
+ * defined in Appendix E, to configure it for proper operation in the actual environment and the
+ * parameters may be retrieved and/or modified. The Unit state is initially reset. See Section 6.2.23
+ * “SetUnitParameter”, Section 6.2.24 “GetUnitParameter”, and 6.2.25 “ClearUnitParameter” for details.
+ * A Protocol Unit Functional Descriptor identifies with bEntityId a specific protocol instance of
+ * bProtocol in a stack. It can only occur within the class-specific portion of an Interface descriptor.
  */
 struct usb_cdc_proto_unit_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Network Channel Terminal Functional Descriptor \ref USB_DTYPE_CDC_PROTOCOL_UNIT */
-    uint8_t     bEntityId;          /**< Constant uniquely identifying the Unit */
-    uint8_t     bProtocol;          /**< Protocol code */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Network Channel Terminal Functional Descriptor */
+    uint8_t     bEntityId;          /**<\brief Constant uniquely identifying the Unit */
+    uint8_t     bProtocol;          /**<\brief Protocol code */
 
 } __attribute__ ((packed));
 
 /** \brief Extension Unit Functional Descriptor
- * \details The Extension Unit Functional Descriptor provides minimal information about the Extension Unit for a
- * generic driver at least to notice the presence of vendor-specific components within the protocol stack.
- */
+ * \details The Extension Unit Functional Descriptor provides minimal information about the Extension
+ * Unit for a generic driver at least to notice the presence of vendor-specific components within
+ * the protocol stack. */
 struct usb_cdc_ext_unit_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Network Channel Terminal Functional Descriptor \ref USB_DTYPE_CDC_EXTENSION_UNIT */
-    uint8_t     bEntityId;          /**< Constant uniquely identifying the Unit */
-    uint8_t     bExtensionCode;     /**< Vendor specific code identifying the Extension Unit. */
-    uint8_t     iName;              /**< Index of string descriptor, describing the name of the Extension Unit. */
-    uint8_t     bChildId0;          /**< First ID of lower Terminal or Unit to which this Terminal is connected. */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Network Channel Terminal Functional Descriptor */
+    uint8_t     bEntityId;          /**<\brief Constant uniquely identifying the Unit */
+    uint8_t     bExtensionCode;     /**<\brief Vendor specific code identifying the Extension Unit. */
+    uint8_t     iName;              /**<\brief Index of string descriptor, describing the name of
+                                     * the Extension Unit. */
+    uint8_t     bChildId0;          /**<\brief First ID of lower Terminal or Unit to which this
+                                     * Terminal is connected. */
     /* ... and there can be a lot of Terminals or Units */
 } __attribute__ ((packed));
 
 /**\brief Multi-Channel Management Functional Descriptor
- * \details The Multi-Channel Management functional descriptor describes the commands supported by the
- * Communications Class interface, as defined in CDC , with the SubClass code of Multi-Channel.
- */
+ * \details The Multi-Channel Management functional descriptor describes the commands supported by
+ * the Communications Class interface, as defined in CDC , with the SubClass code of Multi-Channel.*/
 struct usb_cdc_mcnl_managemnt_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Multi-Channel Management Functional Descriptor \ref USB_DTYPE_CDC_MCNL_MANAGEMENT */
-    uint8_t     bmCapabilities;     /**< The capabilities that this configuration supports. \ref USB_DFU_MCNHCAP */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Multi-Channel Management Functional Descriptor */
+    uint8_t     bmCapabilities;     /**<\brief The capabilities that this configuration supports. */
 } __attribute__ ((packed));
 
 /**\brief CAPI Control Management Functional Descriptor
- * \details The CAPI control management functional descriptor describes the commands supported by the CAPI
- * Control Model over the Data Class interface with the protocol code of CAPI control.
- */
+ * \details The CAPI control management functional descriptor describes the commands supported by
+ * the CAPI Control Model over the Data Class interface with the protocol code of CAPI control. */
 struct usb_cdc_capi_ctl_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< CAPI Control Management Functional Descriptor \ref USB_DTYPE_CDC_CAPI_CONTROL */
-    uint8_t     bmCapabilities;     /**< The capabilities that this configuration supports. \ref USB_DFU_CAPICAP */    
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief CAPI Control Management Functional Descriptor */
+    uint8_t     bmCapabilities;     /**<\brief The capabilities that this configuration supports. */
 } __attribute__ ((packed));
 
-
 /** @} */
 
-
 #ifdef __cplusplus
     }
 #endif
 
-#endif /* _USB_CDC_ISDN_H_ */    	
+#endif /* _USB_CDC_ISDN_H_ */

+ 96 - 83
inc/usb_cdcp.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -16,7 +16,8 @@
 /** \ingroup USB_CDC
  *  \addtogroup USB_CDC_PSTN USB CDC PSTN subclass
  *  \brief USB CDC PSTN subclass definitions
- *  \details This module based on "Universal Serial Bus Communications Class Subclass Specification for PSTN Devices" Revision 1.2
+ *  \details This module based on "Universal Serial Bus Communications Class Subclass Specification
+ * for PSTN Devices" Revision 1.2
  *  \details This module contains definitions for
  * + Direct Line Control Model
  * + Telephony Control Model
@@ -32,135 +33,147 @@
 
 /**\name Communications Class Subclass Codes
  * @{ */
-#define USB_CDC_SUBCLASS_DLC                0x01 /**< Direct Line Control Model */  
-#define USB_CDC_SUBCLASS_TEL                0x03 /**< Telephone Control Model */
+#define USB_CDC_SUBCLASS_DLC            0x01 /**<\brief Direct Line Control Model */
+#define USB_CDC_SUBCLASS_TEL            0x03 /**<\brief Telephone Control Model */
  /* @} */
 
 /**\name CDC PSTN subclass specific Functional Descriptors codes
  * @{ */
-#define USB_DTYPE_CDC_ACM                   0x02 /**< Abstract Control Management Functional Descriptor. \ref usb_cdc_acm_desc */
-#define USB_DTYPE_CDC_LINE_MANAGEMENT       0x03 /**< Direct Line Management Functional Descriptor.\ref usb_cdc_dlm_desc */
-#define USB_DTYPE_CDC_TEL_RING              0x04 /**< Telephone Ringer Functional Descriptor. \ref usb_cdc_tring_desc */
-#define USB_DTYPE_CDC_TEL_CALL              0x05 /**< Telephone Call and Line State Reporting Capabilities Functional Descriptor. */
-#define USB_DTYPE_CDC_TEL_OPMODE            0x08 /**< Telephone Operational Modes Functional Descriptor */
-/** @} */    	
+#define USB_DTYPE_CDC_LINE_MANAGEMENT   0x03 /**<\brief Direct Line Management Functional Descriptor.*/
+#define USB_DTYPE_CDC_TEL_RING          0x04 /**<\brief Telephone Ringer Functional Descriptor. */
+#define USB_DTYPE_CDC_TEL_CALL          0x05 /**<\brief Telephone Call and Line State Reporting
+                                              * Capabilities Functional Descriptor.*/
+#define USB_DTYPE_CDC_TEL_OPMODE        0x08 /**<\brief Telephone Operational Modes Functional Descriptor */
+/** @} */
 
 /**\name CDC PSTN subclass specific requests
  * @{ */
-#define USB_CDC_SET_AUX_LINE_STATE          0x10 /**< Used to connect or disconnect a secondary jack to POTS circuit or CODEC, depending on hook state. */
-#define USB_CDC_SET_HOOK_STATE              0x11 /**< Used to set the necessary POTS line relay code for on-hook, off-hook, and caller ID states. */
-#define USB_CDC_PULSE_SETUP                 0x12 /**< Used to prepare for a pulse-dialing cycle. */
-#define USB_CDC_SEND_PULSE                  0x13 /**< Used to generate a specified number of make/break pulse cycles. */
-#define USB_CDC_SET_PULSE_TIME              0x14 /**< Sets the timing of the make and break periods for pulse dialing. */
-#define USB_CDC_RING_AUX_JACK               0x15 /**< Used to generate a ring signal on a secondary phone jack. */
-#define USB_CDC_SET_RINGER_PARMS            0x30 /**< Configures the ringer for the communication device. */
-#define USB_CDC_GET_RINGER_PARMS            0x31 /**< Returns the ringer capabilities of the device and the current status of the device’s ringer. */
-#define USB_CDC_SET_OPERATION_PARMS         0x32 /**< Sets the operational mode for the device, between a simple mode, standalone mode and a host centric mode. */
-#define USB_CDC_GET_OPERATION_PARMS         0x33 /**< Gets the current operational mode for the device. */
-#define USB_CDC_SET_LINE_PARMS              0x34 /**< Used to change the state of the line. */
-#define USB_CDC_GET_LINE_PARMS              0x35 /**< Used to report the state of the line. */
-#define USB_CDC_DIAL_DIGITS                 0x36 /**< Dials the DTMF digits over the specified line. */
+#define USB_CDC_SET_AUX_LINE_STATE      0x10 /**<\brief Used to connect or disconnect a secondary
+                                              *jack to POTS circuit or CODEC, depending on hook state.*/
+#define USB_CDC_SET_HOOK_STATE          0x11 /**<\brief Used to set the necessary POTS line relay code
+                                              * for on-hook, off-hook, and caller ID states.*/
+#define USB_CDC_PULSE_SETU              0x12 /**<\brief Used to prepare for a pulse-dialing cycle.*/
+#define USB_CDC_SEND_PULSE              0x13 /**<\brief Used to generate a specified number of
+                                              * make/break pulse cycles.*/
+#define USB_CDC_SET_PULSE_TIME          0x14 /**<\brief Sets the timing of the make and break periods
+                                              * for pulse dialing.*/
+#define USB_CDC_RING_AUX_JACK           0x15 /**<\brief Used to generate a ring signal on a secondary
+                                              * phone jack.*/
+#define USB_CDC_SET_RINGER_PARMS        0x30 /**<\brief Configures the ringer for the communication
+                                              * device.*/
+#define USB_CDC_GET_RINGER_PARMS        0x31 /**<\brief Returns the ringer capabilities of the device
+                                              * and the current status of the device’s ringer.*/
+#define USB_CDC_SET_OPERATION_PARMS     0x32 /**<\brief Sets the operational mode for the device,
+                                              * between a simple mode, standalone mode and a host
+                                              * centric mode. */
+#define USB_CDC_GET_OPERATION_PARMS     0x33 /**<\brief Gets the current operational mode for the device.*/
+#define USB_CDC_SET_LINE_PARMS          0x34 /**<\brief Used to change the state of the line.*/
+#define USB_CDC_GET_LINE_PARMS          0x35 /**<\brief Used to report the state of the line.*/
+#define USB_CDC_DIAL_DIGITS             0x36 /**<\brief Dials the DTMF digits over the specified line.*/
 /** @} */
 
 /**\name CDC PSTN subclass specific notifications
  * @{ */
-#define USB_CDC_NTF_AUX_JACK_HOOK_STATE		0x08  /**< Indicates the loop has changed on the auxiliary phone interface. */
-#define USB_CDC_NTF_RING_DETECT				0x09  /**< Indicates ring voltage on the POTS line interface */
-#define USB_CDC_NTF_CALL_STATE_CHANGE		0x28  /**< Identifies that a change has occurred to the state of a call on the line corresponding to 
-												   * the interface or union for the line. */
-#define USB_CDC_NTF_LINE_STATE_CHANGE		0x29  /**< identifies that a change has occurred to the state of the line corresponding to theinterface
-												   * or master interface of a union */
+#define USB_CDC_NTF_AUX_JACK_HOOK_STATE	0x08  /**<\brief Indicates the loop has changed on the
+                                               * auxiliary phone interface. */
+#define USB_CDC_NTF_RING_DETECT			0x09  /**<\brief Indicates ring voltage on the POTS line
+                                               * interface.*/
+#define USB_CDC_NTF_CALL_STATE_CHANGE	0x28  /**<\brief Identifies that a change has occurred to the
+                                               * state of a call on the line corresponding to the
+                                               * interface or union for the line.*/
+#define USB_CDC_NTF_LINE_STATE_CHANGE	0x29  /**<\brief identifies that a change has occurred to the
+                                               * state of the line corresponding to theinterface or
+                                               * master interface of a union.*/
 /** @} */
 
 
 /**\anchor USB_CDC_DLMGMNTCAP
- * \name USB CDC Direct Line Management capabilities 
+ * \name USB CDC Direct Line Management capabilities
  * @{ */
-#define USB_CDC_DLM_PULSE                   0x01 /**< Supports the request combination of Pulse_Setup, Send_Pulse, and Set_Pulse_Time. */
-#define USB_CDC_DLM_AUX                     0x02 /**< Supports the request combination of Set_Aux_Line_State, Ring_Aux_Jack, and notification Aux_Jack_Hook_State. */
-#define USB_CDC_DLM_XTRAPULSE               0x04 /**< Device requires extra Pulse_Setup request during pulse dialing sequence to disengage holding circuit */
+#define USB_CDC_DLM_PULSE               0x01 /**<\brief Supports the request combination of Pulse_Setup,
+                                              * Send_Pulse, and Set_Pulse_Time. */
+#define USB_CDC_DLM_AUX                 0x02 /**<\brief Supports the request combination of Set_Aux_Line_State,
+                                              * Ring_Aux_Jack, and notification Aux_Jack_Hook_State. */
+#define USB_CDC_DLM_XTRAPULSE           0x04 /**<\brief Device requires extra Pulse_Setup request during
+                                              * pulse dialing sequence to disengage holding circuit.*/
 /** @} */
 
 /**\anchor USB_CDC_TOMCAP
  * \name USB CDC Telephone Operational Modes capabilities
  * @{ */
-#define USB_CDC_TOM_SIMPLE                  0x01 /**< Supports Simple mode. */
-#define USB_CDC_TOM_STANDALONE              0x02 /**< Supports Standalone mode. */
-#define USB_CDC_TOM_CENTRIC                 0x04 /**< Supports Computer Centric mode. */
+#define USB_CDC_TOM_SIMPLE              0x01 /**<\brief Supports Simple mode. */
+#define USB_CDC_TOM_STANDALONE          0x02 /**<\brief Supports Standalone mode. */
+#define USB_CDC_TOM_CENTRIC             0x04 /**<\brief Supports Computer Centric mode. */
  /** @} */
 
 /**\anchor USB_CDC_TCSCAP
  * \name USB CDC Telephone Call State Reporting capabilities
  * @{ */
-#define USB_CDC_TCS_DIALTONE                0x01 /**< Reports interrupted dialtone in addition to normal dialtone. */
-#define USB_CDC_TCS_STATE                   0x02 /**< Reports ringback, busy, and fast busy states. */
-#define USB_CDC_TCS_CALLERID                0x04 /**< Reports caller ID information. */
-#define USB_CDC_TCS_RINGING                 0x08 /**< Reports incoming distinctive ringing patterns. */
-#define USB_CDC_TCS_DTMF                    0x10 /**< Can report DTMF digits input remotely over the telephone line. */
-#define USB_CDC_TCS_NOTIFY                  0x20 /**< Does support line state change notification. */
+#define USB_CDC_TCS_DIALTONE            0x01 /**<\brief Reports interrupted dialtone in addition to
+                                              * normal dialtone.*/
+#define USB_CDC_TCS_STATE               0x02 /**<\brief Reports ringback, busy, and fast busy states.*/
+#define USB_CDC_TCS_CALLERID            0x04 /**<\brief Reports caller ID information. */
+#define USB_CDC_TCS_RINGING             0x08 /**<\brief Reports incoming distinctive ringing patterns.*/
+#define USB_CDC_TCS_DTMF                0x10 /**<\brief Can report DTMF digits input remotely over
+                                              * the telephone line.*/
+#define USB_CDC_TCS_NOTIFY              0x20 /**<\brief Does support line state change notification.*/
  /** @} */
 
 
-
-
 /** \brief Direct Line Management Functional Descriptor
- * \details The Direct Line Management functional descriptor describes the commands supported by the Communication Class
- * interface, as defined in Section 3.6.1, with the SubClass code of Direct Line Control Model. It can only occur within
- * the class-specific portion of an Interface descriptor.
- */
+ * \details The Direct Line Management functional descriptor describes the commands supported by the
+ * Communication Class interface, as defined in Section 3.6.1, with the SubClass code of Direct Line
+ * Control Model. It can only occur within the class-specific portion of an Interface descriptor.*/
 struct usb_cdc_dlm_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Direct Line Management Functional Descriptor. \ref USB_DTYPE_CDC_LINE_MANAGEMENT */
-    uint8_t     bmCapabilities;     /**< The \ref USB_CDC_DLMGMNTCAP "capabilities" that this configuration supports */    
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Direct Line Management Functional Descriptor. */
+    uint8_t     bmCapabilities;     /**<\brief The line management capabilities that this
+                                     * configuration supports */
 } __attribute__ ((packed));
 
 /** \brief Telephone Ringer Functional Descriptor
- * \details The Telephone Ringer functional descriptor describes the ringer capabilities supported by the Communication Class
- * interface, as defined in Section 3.6.3.1, with the SubClass code of Telephone Control. It can only occur within the
- * class-specific portion of an Interface descriptor.
- */
+ * \details The Telephone Ringer functional descriptor describes the ringer capabilities supported
+ * by the Communication Class interface, as defined in Section 3.6.3.1, with the SubClass code of
+ * Telephone Control. It can only occur within the class-specific portion of an Interface descriptor.*/
 struct usb_cdc_tring_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Direct Line Management Functional Descriptor. \ref USB_DTYPE_CDC_TEL_RING */
-    uint8_t     bRingerVolSteps;    /**< Number of discrete steps in volume supported by the ringer, values are:
-                                     * + 0: 256 discrete volume steps.
-                                     * + 1: Fixed volume. Value 0 will be ringer off
-                                     * + N: N volume steps. Value 0 will be ringer off. */
-    uint8_t     bNumRingerPatterns; /**< Number of ringer patterns supported */
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t     bDescriptorSubType; /**<\brief Direct Line Management Functional Descriptor.*/
+    uint8_t     bRingerVolSteps;    /**<\brief Number of discrete steps in volume supported by the ringer.*/
+    uint8_t     bNumRingerPatterns; /**<\brief Number of ringer patterns supported.*/
 } __attribute__ ((packed));
 
 /** \brief Telephone Operational Modes Functional Descriptor
- * \details The Telephone Operational Modes functional descriptor describes the operational modes supported by the
- * Communication Class interface, as defined in Section 3.6.3.1, with the SubClass code of Telephone Control. It can
- * only occur within the class-specific portion of an Interface descriptor. The modes supported are Simple, Standalone,
- * and Computer Centric. See Section 6.2.18, “SetOperationParms” for a definition of the various operational modes and
- * Table 53 for the definition of the operational mode values.
- */
+ * \details The Telephone Operational Modes functional descriptor describes the operational modes
+ * supported by the Communication Class interface, as defined in Section 3.6.3.1, with the SubClass
+ * code of Telephone Control. It can only occur within the class-specific portion of an Interface
+ * descriptor. The modes supported are Simple, Standalone, and Computer Centric. See Section 6.2.18,
+ *  “SetOperationParms” for a definition of the various operational modes and Table 53 for the
+ * definition of the operational mode values.*/
 struct usb_cdc_tom_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Direct Line Management Functional Descriptor. \ref USB_DTYPE_CDC_TEL_OPMODE */
-    uint8_t     bmCapabilities;     /**< The \ref USB_CDC_TOMCAP "capabilities" that this configuration supports */    
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Direct Line Management Functional Descriptor. */
+    uint8_t     bmCapabilities;     /**<\brief The perational modes capabilities that this
+                                     * configuration supports */
 } __attribute__ ((packed));
 
 /** \brief Telephone Call State Reporting Capabilities Descriptor
- * \details The Telephone Call and Line State Reporting Capabilities functional descriptor describes the abilities of a telephone
- * device to report optional call and line states.
+ * \details The Telephone Call and Line State Reporting Capabilities functional descriptor describes
+ * the abilities of a telephone device to report optional call and line states.
  */
 struct usb_cdc_tcs_desc {
-    uint8_t     bFunctionLength;    /**< Size of this functional descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t     bDescriptorSubType; /**< Direct Line Management Functional Descriptor. \ref USB_DTYPE_CDC_TEL_CALL */
-    uint32_t    bmCapabilities;     /**< The \ref USB_CDC_TCSCAP "capabilities" that this configuration supports */    
+    uint8_t     bFunctionLength;    /**<\brief Size of this functional descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief CS_INTERFACE descriptor type. */
+    uint8_t     bDescriptorSubType; /**<\brief Direct Line Management Functional Descriptor. */
+    uint32_t    bmCapabilities;     /**<\brief The call state capabilities that this configuration
+                                     * supports */
 } __attribute__ ((packed));
 
 /** @} */
 
-
 #ifdef __cplusplus
     }
 #endif
-
-#endif /* _USB_CDC_PSTN_H_ */    	
+#endif /* _USB_CDC_PSTN_H_ */

+ 68 - 63
inc/usb_cdcw.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -13,10 +13,12 @@
  * limitations under the License.
  */
 
-/** \ingroup USB_CDC
- *  \addtogroup USB_CDC_WCM USB CDC WCM subclass
- *  \brief USB CDC WCM subclass definitions
- *  \details Wireless Mobile Communications  Devices subclass
+/**\ingroup USB_CDC
+ * \addtogroup USB_CDC_WCM USB CDC WCM subclass
+ * \brief USB CDC WCM subclass definitions
+ * \details Wireless Mobile Communications  Devices subclass
+ * \details based on Universal Serial Bus CDC Subclass Specification for Wireless Mobile Communications Devices
+ *  Revision 1.1 (Errata 1)
  * + Wireless Handset Control Model
  * + Device Management Model
  * + Mobile Direct Line Model
@@ -33,34 +35,33 @@
 
 /**\name Communications Class Subclass Codes
  * @{ */
-#define USB_CDC_SUBCLASS_WHCM               0x08 /**< Wireless Handset Control Model */ 
-#define USB_CDC_SUBCLASS_DMM                0x09 /**< Device Management Model*/ 
-#define USB_CDC_SUBCLASS_MDLM               0x0A /**< Mobile Direct Line Model */ 
-#define USB_CDC_SUBCLASS_OBEX               0x0B /**< OBEX Model */ 
+#define USB_CDC_SUBCLASS_WHCM           0x08    /**<\brief Wireless Handset Control Model.*/
+#define USB_CDC_SUBCLASS_DMM            0x09    /**<\brief Device Management Model.*/
+#define USB_CDC_SUBCLASS_MDLM           0x0A    /**<\brief Mobile Direct Line Model.*/
+#define USB_CDC_SUBCLASS_OBEX           0x0B    /**<\brief OBEX Model.*/
  /* @} */
 
 /**\name Communications Class Protocol Codes
  * @{ */
-#define USB_CDC_PROTO_PCCA101               0x02 /**< AT Commands defined by PCCA-101 */
-#define USB_CDC_PROTO_PCCA101O              0x03 /**< AT Commands defined by PCCA-101 & Annex O */
-#define USB_CDC_PROTO_GSM                   0x04 /**< AT Commands defined by GSM 07.07 */
-#define USB_CDC_PROTO_3G                    0x05 /**< AT Commands defined by 3GPP 27.007 */
-#define USB_CDC_PROTO_CDMA                  0x06 /**< AT Commands defined by TIA for CDMA */
-/** @} */    	
+#define USB_CDC_PROTO_PCCA101           0x02    /**<\brief AT Commands defined by PCCA-101.*/
+#define USB_CDC_PROTO_PCCA101O          0x03    /**<\brief AT Commands defined by PCCA-101 & Annex O.*/
+#define USB_CDC_PROTO_GSM               0x04    /**<\brief AT Commands defined by GSM 07.07.*/
+#define USB_CDC_PROTO_3G                0x05    /**<\brief AT Commands defined by 3GPP 27.007.*/
+#define USB_CDC_PROTO_CDMA              0x06    /**<\brief AT Commands defined by TIA for CDMA.*/
+/** @} */
 
 /**\name CDC WCM subclass specific Functional Descriptors codes
  * @{ */
-#define USB_DTYPE_CDC_WHCM                  0x11 /**< Wireless Handset Control Model Functional Descriptor \ref usb_cdc_whcm_desc*/
-#define USB_DTYPE_CDC_MDLM                  0x12 /**< Mobile Direct Line Model Functional Descriptor \ref usb_cdc_mdlm_desc */
-#define USB_DTYPE_CDC_MDLM_DETAIL           0x13 /**< MDLM Detail Functional Descriptor \ref usb_cdc_mdlm_detail_desc*/
-#define USB_DTYPE_CDC_DMM                   0x14 /**< Device Management Model Functional Descriptor \ref usb_cdc_dmm_desc */
-#define USB_DTYPE_CDC_OBEX                  0x15 /**< OBEX Functional Descriptor use \ref usb_cdc_header_desc*/
-#define USB_DTYPE_CDC_CMDSET                0x16 /**< Command Set Functional Descriptor */
-#define USB_DTYPE_CDC_CMDSET_DETAIL         0x17 /**< Command Set Detail Functional Descriptor */
-#define USB_DTYPE_CDC_TEL_CONRTOL           0x18 /**< Telephone Control Model Functional Descriptor */
-#define USB_DTYPE_CDC_OBEX_SERVICE          0x19 /**< OBEX Service Identifier Functional Descriptor \ref usb_cdc_obex_serv_desc*/
-
-/** @} */    	
+#define USB_DTYPE_CDC_WHCM              0x11    /**<\brief Wireless Handset Control Model Functional Descriptor.*/
+#define USB_DTYPE_CDC_MDLM              0x12    /**<\brief Mobile Direct Line Model Functional Descriptor.*/
+#define USB_DTYPE_CDC_MDLM_DETAIL       0x13    /**<\brief MDLM Detail Functional Descriptor.*/
+#define USB_DTYPE_CDC_DMM               0x14    /**<\brief Device Management Model Functional Descriptor.*/
+#define USB_DTYPE_CDC_OBEX              0x15    /**<\brief OBEX Functional Descriptor.*/
+#define USB_DTYPE_CDC_CMDSET            0x16    /**<\brief Command Set Functional Descriptor.*/
+#define USB_DTYPE_CDC_CMDSET_DETAIL     0x17    /**<\brief Command Set Detail Functional Descriptor.*/
+#define USB_DTYPE_CDC_TEL_CONRTOL       0x18    /**<\brief Telephone Control Model Functional Descriptor.*/
+#define USB_DTYPE_CDC_OBEX_SERVICE      0x19    /**<\brief OBEX Service Identifier Functional Descriptor.*/
+/** @} */
 
 /**\name CDC WCM subclass specific requests
  * @{ */
@@ -69,65 +70,69 @@
 
 /**\brief Wireless Handset Control Model Functional Descriptor */
 struct usb_cdc_whcm_desc {
-    uint8_t    bFunctionLength;				/**< Size of this functional descriptor, in bytes. */
-    uint8_t    bDescriptorType;				/**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t    bDescriptorSubType;			/**< Wireless Handset Control Model Functional Descriptor \ref USB_DTYPE_CDC_WHCM */
-    uint16_t   bcdVersion;					/**< Version number for this subclass specification. \see \ref VERSION_BCD macro */
+    uint8_t    bFunctionLength;         /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t    bDescriptorType;         /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t    bDescriptorSubType;      /**<\brief Wireless Handset Control Model Functional Descriptor.*/
+    uint16_t   bcdVersion;              /**<\brief BCD version number for this subclass specification.*/
 } __attribute__ ((packed));
 
 /**\brief Mobile Direct Line Model Functional Descriptor
- * \details This descriptor is mandatory. It conveys the GUID that uniquely identifies the kind of MDLM interface that is being provided.
+ * \details This descriptor is mandatory. It conveys the GUID that uniquely identifies the kind of
+ * MDLM interface that is being provided.
  */
 struct usb_cdc_mdlm_desc {
-    uint8_t    bFunctionLength;				/**< Size of this functional descriptor, in bytes. */
-    uint8_t    bDescriptorType;				/**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t    bDescriptorSubType;			/**< Mobile Direct Line Model Functional Descriptor \ref USB_DTYPE_CDC_MDLM */
-    uint16_t   bcdVersion;					/**< Version number for this subclass specification. \see \ref VERSION_BCD macro */
-    uint8_t    bGUID[16];					/**< Uniquely identifies the detailed transport protocol provided by this MDLM interface. */
+    uint8_t    bFunctionLength;         /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t    bDescriptorType;         /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t    bDescriptorSubType;      /**<\brief Mobile Direct Line Model Functional Descriptor.*/
+    uint16_t   bcdVersion;              /**<\brief Version number for this subclass specification.*/
+    uint8_t    bGUID[16];               /**<\brief Uniquely identifies the detailed transport protocol
+                                         * provided by this MDLM interface. */
 } __attribute__ ((packed));
 
 /**\brief Mobile Direct Line Model Detail Functional Descriptor
- * \details This descriptor is optional, and may be repeated as necessary. It conveys any additional information required by
- * the MDLM transport specification identified by the MDLM Functional Descriptor.
- */
+ * \details This descriptor is optional, and may be repeated as necessary. It conveys any additional
+ * information required by the MDLM transport specification identified by the MDLM Functional
+ * Descriptor.*/
 struct usb_cdc_mdlm_detail_desc {
-    uint8_t    bFunctionLength;				/**< Size of this functional descriptor, in bytes. */
-    uint8_t    bDescriptorType;				/**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t    bDescriptorSubType;			/**< Mobile Direct Line Model Details Functional Descriptor \ref USB_DTYPE_CDC_MDLM_DETAIL */
-    uint8_t    bGuidDescriptorType; 		/**< Discriminator, interpreted according to the semantic model specified by the GUID in the
-	  									     * MDLM Functional Descriptor */
-    uint8_t    bDetailData[0];				/**< Information associated with this GUID and discriminator, according to the semantic model
-	   									 	 * specified by the GUID in the MDLM Functional Descriptor */
+    uint8_t    bFunctionLength;         /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t    bDescriptorType;         /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t    bDescriptorSubType;      /**<\brief Mobile Direct Line Model Details Functional Descriptor.*/
+    uint8_t    bGuidDescriptorType;     /**<\brief Discriminator, interpreted according to the semantic
+                                         * model specified by the GUID in the MDLM Functional Descriptor.*/
+    uint8_t    bDetailData[0];          /**< Information associated with this GUID and discriminator,
+                                         * according to the semantic model specified by the GUID in
+                                         * the MDLM Functional Descriptor */
 } __attribute__ ((packed));
 
 /**\brief Device Management Functional Descriptor */
 struct usb_cdc_dmm_desc {
-    uint8_t    bFunctionLength;				/**< Size of this functional descriptor, in bytes. */
-    uint8_t    bDescriptorType;				/**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t    bDescriptorSubType;			/**< Wireless Handset Control Model Functional Descriptor \ref USB_DTYPE_CDC_DMM */
-    uint16_t   bcdVersion;					/**< Version number for this subclass specification. \see \ref VERSION_BCD macro */
-	uint16_t   wMaxCommand;					/**< The buffer size allocated in the device for data sent from the host using SEND_ENCAPSULATED_CMD. */
+    uint8_t    bFunctionLength;         /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t    bDescriptorType;         /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t    bDescriptorSubType;      /**<\brief Wireless Handset Control Model Functional Descriptor.*/
+    uint16_t   bcdVersion;              /**<\brief Version number for this subclass specification.*/
+    uint16_t   wMaxCommand;             /**<\brief The buffer size allocated in the device for data
+                                         * sent from the host using SEND_ENCAPSULATED_CMD. */
 } __attribute__ ((packed));
 
 /**\brief OBEX Service Identification Functional Descriptor
- * \details This optional functional descriptor indicates the mode supported by this OBEX function. This corresponds to an
- * OBEX role (client or server), a particular OBEX service, and an OBEX service version.
- */
+ * \details This optional functional descriptor indicates the mode supported by this OBEX function.
+ * This corresponds to an OBEX role (client or server), a particular OBEX service, and an OBEX
+ * service version.*/
 struct usb_cdc_obex_serv_desc {
-    uint8_t    bFunctionLength;				/**< Size of this functional descriptor, in bytes. */
-    uint8_t    bDescriptorType;				/**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
-    uint8_t    bDescriptorSubType;			/**< OBEX Service Identifier Functional Descriptor \ref USB_DTYPE_CDC_OBEX_SERVICE */
-	uint8_t    bmOBEXRole;					/**< Represents the OBEX role to be played by the function */
-	uint8_t    bOBEXServiceUUID[16];		/**< A 16 byte UUID value used to indicate the particular OBEX service associated with this function. */
-	uint16_t   wOBEXServiceVersion;			/**< A 16 bit value indicating the version of the OBEX service associated with this function. */
-
+    uint8_t    bFunctionLength;         /**<\brief Size of this functional descriptor, in bytes.*/
+    uint8_t    bDescriptorType;         /**<\brief CS_INTERFACE descriptor type.*/
+    uint8_t    bDescriptorSubType;      /**<\brief OBEX Service Identifier Functional Descriptor.*/
+    uint8_t    bmOBEXRole;              /**<\brief Represents the OBEX role to be played by the function.*/
+    uint8_t    bOBEXServiceUUID[16];    /**<\brief A 16 byte UUID value used to indicate the particular
+                                         * OBEX service associated with this function. */
+    uint16_t   wOBEXServiceVersion;     /**<\brief A 16 bit value indicating the version of the OBEX
+                                         * service associated with this function. */
 } __attribute__ ((packed));
 
 /** @} */
 
-
 #ifdef __cplusplus
     }
 #endif
 
-#endif /* _USB_CDC_WCM_H_ */    	
+#endif /* _USB_CDC_WCM_H_ */

+ 95 - 64
inc/usb_dfu.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -20,100 +20,131 @@
     extern "C" {
 #endif
 
-/** \addtogroup USB_MODULE_DFU USB DFU class
+/**\addtogroup USB_MODULE_DFU USB DFU class
  * \brief This module contains USB Device Firmware Upgrade class definitions.
  * \details This module based on
- * + [USB Device Firmware Upgrade Specification, Revision 1.1](http://www.usb.org/developers/docs/devclass_docs/DFU_1.1.pdf)
+ * + [USB Device Firmware Upgrade Specification, Revision 1.1]
+ * (http://www.usb.org/developers/docs/devclass_docs/DFU_1.1.pdf)
  * @{ */
 
 /**\name USB DFU class subclass and protocol definitions
  * @{ */
-#define USB_CLASS_DFU                   0xFE    /**< USB DFU class is an application-specified class */
-#define USB_DFU_SUBCLASS_DFU            0x01    /**< USB DFU subclass code */
-#define USB_DFU_PROTO_RUNTIME           0x01    /**< USB DFU runtime-mode protocol */
-#define USB_DFU_PROTO_DFU               0x02    /**< USB DFU DFU-mode protocol */
+#define USB_CLASS_DFU                   0xFE    /**<\brief USB DFU class.*/
+#define USB_DFU_SUBCLASS_DFU            0x01    /**<\brief USB DFU subclass code.*/
+#define USB_DFU_PROTO_RUNTIME           0x01    /**<\brief USB DFU runtime-mode protocol.*/
+#define USB_DFU_PROTO_DFU               0x02    /**<\brief USB DFU DFU-mode protocol.*/
 /** @{ */
 
 /**\name USB DFU descriptor types */
-#define USB_DTYPE_DFU_FUNCTIONAL        0x21    /**< USB DFU functional descriptor type */
+#define USB_DTYPE_DFU_FUNCTIONAL        0x21    /**<\brief USB DFU functional descriptor type.*/
 
 /**\name USB DFU class-specific requests
  * @{ */
-#define USB_DFU_DETACH                  0x00    /**< Initiates a detach-attach sequence on the bus when it sees this request. */
-#define USB_DFU_DNLOAD                  0x01    /**< Initiates firmware image downloading */
-#define USB_DFU_UPLOAD                  0x02    /**< This request is employed by the host to solicit firmware from the device.*/
-#define USB_DFU_GETSTATUS               0x03    /**< The host employs this request to facilitate synchronization with the device. \see usb_dfu_status */
-#define USB_DFU_CLRSTATAUS              0x04    /**< This request resets DFU machine state to DFU_IDLE*/
-#define USB_DFU_GETSTATE                0x05    /**< This request solicits a report about the state of the device. */
-#define USB_DFU_ABORT                   0x06    /**< This request enables the host to exit from certain states and return to the DFU_IDLE state*/
+#define USB_DFU_DETACH                  0x00    /**<\brief Initiates a detach-attach sequence on the
+                                                 * bus when it sees this request. */
+#define USB_DFU_DNLOAD                  0x01    /**<\brief Initiates firmware image downloading */
+#define USB_DFU_UPLOAD                  0x02    /**<\brief This request is employed by the host to
+                                                 * solicit firmware from the device.*/
+#define USB_DFU_GETSTATUS               0x03    /**<\brief The host employs this request to facilitate
+                                                 * synchronization with the device.*/
+#define USB_DFU_CLRSTATAUS              0x04    /**<\brief This request resets DFU machine state to
+                                                 * DFU_IDLE.*/
+#define USB_DFU_GETSTATE                0x05    /**<\brief This request solicits a report about the
+                                                 * state of the device.*/
+#define USB_DFU_ABORT                   0x06    /**<\brief This request enables the host to exit from
+                                                 * certain states and return to the DFU_IDLE state.*/
 /** @} */
 
 /**\anchor USB_DFU_CAPAB
  * \name USB DFU capabilities
  * @{ */
-#define USB_DFU_ATTR_WILL_DETACH        0x08    /**< Device will perform a bus detach-attach sequence when it receives a DFU_DETACH request. */
-#define USB_DFU_ATTR_MANIF_TOL          0x04    /**< Device is able to communicate via USB after Manifestation phase. */
-#define USB_DFU_ATTR_CAN_UPLOAD         0x02    /**< Upload capable. */
-#define USB_DFU_ATTR_CAN_DNLOAD         0x01    /**< Download capable. */
+#define USB_DFU_ATTR_WILL_DETACH        0x08    /**<\brief Device will perform a bus detach-attach
+                                                 * sequence when it receives a DFU_DETACH request.*/
+#define USB_DFU_ATTR_MANIF_TOL          0x04    /**<\brief Device is able to communicate via USB
+                                                 * after Manifestation phase.*/
+#define USB_DFU_ATTR_CAN_UPLOAD         0x02    /**<\brief Upload capable.*/
+#define USB_DFU_ATTR_CAN_DNLOAD         0x01    /**<\brief Download capable.*/
 /** @} */
 
 /**\name USB DFU status codes
  * @{ */
-#define USB_DFU_STATUS_OK               0x00 /**< No error condition is present. */
-#define USB_DFU_STATUS_ERR_TARGET       0x01 /**< File is not targeted for use by this device. */
-#define USB_DFU_STATUS_ERR_FILE         0x02 /**< File is for this device but fails some vendor specific verification test. */
-#define USB_DFU_STATUS_ERR_WRITE        0x03 /**< Device is unable to write memory. */
-#define USB_DFU_STATUS_ERR_ERASE        0x04 /**< Memory erase function failed. */
-#define USB_DFU_STATUS_ERR_CHECK_ERASED 0x05 /**< Memory erase check failed. */
-#define USB_DFU_STATUS_ERR_PROG         0x06 /**< Program memory function failed. */
-#define USB_DFU_STATUS_ERR_VERIFY       0x07 /**< Programmed memory failed verification. */
-#define USB_DFU_STATUS_ERR_ADDRESS      0x08 /**< Cannot program memory due to received address that is out of range. */
-#define USB_DFU_STATUS_ERR_NOTDONE      0x09 /**< Received DFU_DNLOAD with wLength = 0, but device does not think it has all of the data yet. */
-#define USB_DFU_STATUS_ERR_FIRMWARE     0x0A /**< Device's firmware is corrupt.  It cannot return to run-time (non-DFU) operations. */
-#define USB_DFU_STATUS_ERR_VENDOR       0x0B /**< iString indicates a vendor-specific error. */
-#define USB_DFU_STATUS_ERR_USBR         0x0C /**< Device detected unexpected USB reset signaling. */
-#define USB_DFU_STATUS_ERR_POR          0x0D /**< Device detected unexpected power on reset. */
-#define USB_DFU_STATUS_ERR_UNKNOWN      0x0E /**< Something went wrong, but the device does not know what it was. */
-#define USB_DFU_STATUS_ERR_STALLEDPKT   0x0F /**< Device stalled an unexpected request. */
+#define USB_DFU_STATUS_OK               0x00    /**<\brief No error condition is present.*/
+#define USB_DFU_STATUS_ERR_TARGET       0x01    /**<\brief File is not targeted for use by this device.*/
+#define USB_DFU_STATUS_ERR_FILE         0x02    /**<\brief File is for this device but fails some
+                                                 * vendor specific verification test.*/
+#define USB_DFU_STATUS_ERR_WRITE        0x03    /**<\brief Device is unable to write memory.*/
+#define USB_DFU_STATUS_ERR_ERASE        0x04    /**<\brief Memory erase function failed.*/
+#define USB_DFU_STATUS_ERR_CHECK_ERASED 0x05    /**<\brief Memory erase check failed.*/
+#define USB_DFU_STATUS_ERR_PROG         0x06    /**<\brief Program memory function failed.*/
+#define USB_DFU_STATUS_ERR_VERIFY       0x07    /**<\brief Programmed memory failed verification.*/
+#define USB_DFU_STATUS_ERR_ADDRESS      0x08    /**<\brief Cannot program memory due to received
+                                                 * address that is out of range. */
+#define USB_DFU_STATUS_ERR_NOTDONE      0x09    /**<\brief Received DFU_DNLOAD with wLength = 0, but
+                                                 * device does not think it has all of the data yet.*/
+#define USB_DFU_STATUS_ERR_FIRMWARE     0x0A    /**<\brief Device's firmware is corrupt.  It cannot
+                                                 * return to run-time (non-DFU) operations.*/
+#define USB_DFU_STATUS_ERR_VENDOR       0x0B    /**<\brief iString indicates a vendor-specific error.*/
+#define USB_DFU_STATUS_ERR_USBR         0x0C    /**<\brief Device detected unexpected USB reset signaling.*/
+#define USB_DFU_STATUS_ERR_POR          0x0D    /**<\brief Device detected unexpected power on reset. */
+#define USB_DFU_STATUS_ERR_UNKNOWN      0x0E    /**<\brief Something went wrong, but the device does
+                                                 * not know what it was.*/
+#define USB_DFU_STATUS_ERR_STALLEDPKT   0x0F    /**<\brief Device stalled an unexpected request.*/
 /** @} */
 
 /**\name USB DFU state codes
  * @{ */
-#define USB_DFU_STATE_APP_IDLE          0x00 /**< Device is running its normal application. */
-#define USB_DFU_STATE_APP_DETACH        0x01 /**< Device is running its normal application, has received the DFU_DETACH request, and is waiting for a USB reset. */
-#define USB_DFU_STATE_DFU_IDLE          0x02 /**< Device is operating in the DFU mode and is waiting for requests. */
-#define USB_DFU_STATE_DFU_DNLOADSYNC    0x03 /**< Device has received a block and is waiting for the host to solicit the status via DFU_GETSTATUS. */
-#define USB_DFU_STATE_DFU_DNBUSY        0x04 /**< Device is programming a control-write block into its nonvolatile memories. */
-#define USB_DFU_STATE_DFU_DNLOADIDLE    0x05 /**< Device is processing a download operation.  Expecting DFU_DNLOAD requests. */
-#define USB_DFU_STATE_DFU_MANIFESTSYNC  0x06 /**< Device has received the final block of firmware from the host
-                                              * and is waiting for receipt of DFU_GETSTATUS to begin the Manifestation
-                                              * phase; or device has completed the Manifestation phase and is waiting
-                                              * for receipt of DFU_GETSTATUS.  (Devices that can enter this state
-                                              * after the Manifestation phase set bmAttributes bit bitManifestationTolerant to 1.) */
-#define USB_DFU_STATE_DFU_MANIFEST      0x07 /**< Device is in the Manifestation phase.  (Not all devices will be able to respond to DFU_GETSTATUS when in this state.) */
-#define USB_DFU_STATE_DFU_MANIFESTWR    0x08 /**< Device has programmed its memories and is waiting for a USB reset or a
-                                              * power on reset.  (Devices that must enter this state clear bitManifestationTolerant to 0.) */
-#define USB_DFU_STATE_DFU_UPLOADIDLE    0x09 /**< The device is processing an upload operation.  Expecting DFU_UPLOAD requests. */
-#define USB_DFU_STATE_DFU_ERROR         0x0A /**< An error has occurred. Awaiting the DFU_CLRSTATUS request. */
+#define USB_DFU_STATE_APP_IDLE          0x00    /**<\brief Device is running its normal application.*/
+#define USB_DFU_STATE_APP_DETACH        0x01    /**<\brief Device is running its normal application,
+                                                 * has received the DFU_DETACH request, and is
+                                                 * waiting for a USB reset. */
+#define USB_DFU_STATE_DFU_IDLE          0x02    /**<\brief Device is operating in the DFU mode and
+                                                 * is waiting for requests. */
+#define USB_DFU_STATE_DFU_DNLOADSYNC    0x03    /**<\brief Device has received a block and is waiting
+                                                 * for the host to solicit the status via DFU_GETSTATUS. */
+#define USB_DFU_STATE_DFU_DNBUSY        0x04    /**<\brief Device is programming a control-write block
+                                                 * into its nonvolatile memories. */
+#define USB_DFU_STATE_DFU_DNLOADIDLE    0x05    /**<\brief Device is processing a download operation.
+                                                 * Expecting DFU_DNLOAD requests. */
+#define USB_DFU_STATE_DFU_MANIFESTSYNC  0x06    /**<\brief Device has received the final block of
+                                                 * firmware from the host and is waiting for receipt
+                                                 * of DFU_GETSTATUS to begin the Manifestation phase;
+                                                 * or device has completed the Manifestation phase
+                                                 * and is waiting for receipt of DFU_GETSTATUS.
+                                                 * \note Devices that can enter this state after the
+                                                 * Manifestation phase set bmAttributes bit
+                                                 * bitManifestationTolerant to 1. */
+#define USB_DFU_STATE_DFU_MANIFEST      0x07    /**<\brief Device is in the Manifestation phase.
+                                                 * \note Not all devices will be able to respond to
+                                                 * DFU_GETSTATUS when in this state.*/
+#define USB_DFU_STATE_DFU_MANIFESTWR    0x08    /**<\brief Device has programmed its memories and is
+                                                 * waiting for a USB reset or a power on reset.
+                                                 * \note Devices that must enter this state clear
+                                                 * bitManifestationTolerant to 0.*/
+#define USB_DFU_STATE_DFU_UPLOADIDLE    0x09    /**<\brief The device is processing an upload operation.*/
+#define USB_DFU_STATE_DFU_ERROR         0x0A    /**<\brief An error has occurred. */
 /** @} */
 
-/** \brief USB DFU functional descriptor */
+/**\brief USB DFU functional descriptor */
 struct usb_dfu_func_desc {
-    uint8_t     bLength;            /**< Descriptor length in bytes. */
-    uint8_t     bDescriptorType;    /**< Descriptor type, set it to \ref USB_DTYPE_DFU_FUNCTIONAL */
-    uint8_t     bmAttributes;       /**< Bitmap field of the \ref USB_DFU_CAPAB "USB DFU capabilities"*/
-    uint16_t    wDetachTimeout;     /**< USB DFU detach timeout in ms */
-    uint16_t    wTransferSize;      /**< USB DFU maximum transfer block size in bytes */
-    uint16_t    bcdDFUVersion;      /**< USB DFU version \ref VERSION_BCD utility macro */
+    uint8_t     bLength;            /**<\brief Descriptor length in bytes.*/
+    uint8_t     bDescriptorType;    /**<\brief DFU functional descriptor type.*/
+    uint8_t     bmAttributes;       /**<\brief USB DFU capabilities \ref USB_DFU_CAPAB*/
+    uint16_t    wDetachTimeout;     /**<\brief USB DFU detach timeout in ms.*/
+    uint16_t    wTransferSize;      /**<\brief USB DFU maximum transfer block size in bytes.*/
+    uint16_t    bcdDFUVersion;      /**<\brief USB DFU version \ref VERSION_BCD utility macro.*/
 }__attribute__((packed));
 
-/** \brief Payload packet to response in DFU_GETSTATUS request */
+/**\brief Payload packet to response in DFU_GETSTATUS request */
 struct usb_dfu_status {
-    uint8_t     bStatus;            /**< An indication of the status resulting from the execution of the most recent request.*/
-    uint8_t     bPollTimeout;
-    uint16_t    wPollTimeout;       /**< Minimum time, (ms), that the host should wait before sending a subsequent \ref USB_DFU_GETSTATUS "DFU_GETSTATUS" request. */
-    uint8_t     bState;             /**< An indication of the state that the device is going to enter immediately following transmission of this response. */
-    uint8_t     iString;            /**< Index of the status \ref usb_string_descriptor "string descriptor". */
+    uint8_t     bStatus;            /**<\brief An indication of the status resulting from the
+                                     * execution of the most recent request.*/
+    uint8_t     bPollTimeout;       /**<\brief Minimum time (LSB) in ms, that the host should wait
+                                     * before sending a subsequent DFU_GETSTATUS request.*/
+    uint16_t    wPollTimeout;       /**<\brief Minimum time (MSB) in ms, that the host should wait
+                                     * before sending a subsequent DFU_GETSTATUS request.*/
+    uint8_t     bState;             /**<\brief An indication of the state that the device is going
+                                     * to enter immediately following transmission of this response.*/
+    uint8_t     iString;            /**<\brief Index of the status string descriptor.*/
 };
 
 /** @} */

+ 134 - 142
inc/usb_hid.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -28,178 +28,170 @@
  * @{ */
 
 /**\name USB HID class code */
-#define USB_CLASS_HID               0x03 /**< Interface belongs to the Human Interface device class */
+#define USB_CLASS_HID               0x03    /**<\brief Interface belongs to the Human Interface device class.*/
 
 /**\name USB HID subclass codes
  * @{ */
-#define USB_HID_SUBCLASS_NONBOOT    0x00
-#define USB_HID_SUBCLASS_BOOT       0x01
+#define USB_HID_SUBCLASS_NONBOOT    0x00    /**<\brief Nonboot subclass.*/
+#define USB_HID_SUBCLASS_BOOT       0x01    /**<\brief Boot subclass.*/
 /** @} */
 
 /**\name USB HID protocol codes
  * @{ */
-#define USB_HID_PROTO_NONBOOT       0x00
-#define USB_HID_PROTO_KEYBOARD      0x01
-#define USB_HID_PROTO_MOUSE         0x02
+#define USB_HID_PROTO_NONBOOT       0x00    /**<\brief Nonboot protocol.*/
+#define USB_HID_PROTO_KEYBOARD      0x01    /**<\brief Keyboard boot protocol.*/
+#define USB_HID_PROTO_MOUSE         0x02    /**<\brief Mouse boot protocol.*/
 /** @} */
 
-#define USB_HID_REPORT_IN           0 /**< \brief Indicates that the item is an IN report type. */
-#define USB_HID_REPORT_OUT          1 /**< \brief Indicates that the item is an OUT report type. */
-#define USB_HID_REPORT_FEATURE      2 /**< \brief Indicates that the item is a FEATURE report type. */
+#define USB_HID_REPORT_IN           0x00    /**<\brief Indicates that the item is an IN report type.*/
+#define USB_HID_REPORT_OUT          0x01    /**<\brief Indicates that the item is an OUT report type.*/
+#define USB_HID_REPORT_FEATURE      0x02    /**<\brief Indicates that the item is a FEATURE report type.*/
 
 
 /**\name USB HID class-specified requests
  * @{ */
-#define USB_HID_GETREPORT  			0x01 /**< Request to get the current HID report from the device. */
-#define USB_HID_GETIDLE    			0x02 /**< Request to get the current device idle count. */
-#define USB_HID_GETPROTOCOL			0x03 /**< Request to get the current HID report protocol mode. */
-#define USB_HID_SETREPORT  			0x09 /**< Request to set the current HID report to the device. */
-#define USB_HID_SETIDLE    			0x0A /**< Request to set the device's idle count. */
-#define USB_HID_SETPROTOCOL			0x0B /**< Request to set the current HID report protocol mode. */
+#define USB_HID_GETREPORT           0x01    /**<\brief Request to get the current HID report from the device.*/
+#define USB_HID_GETIDLE             0x02    /**<\brief Request to get the current device idle count.*/
+#define USB_HID_GETPROTOCOL         0x03    /**<\brief Request to get the current HID report protocol mode.*/
+#define USB_HID_SETREPORT           0x09    /**< Request to set the current HID report to the device.*/
+#define USB_HID_SETIDLE             0x0A    /**<\brief Request to set the device's idle count.*/
+#define USB_HID_SETPROTOCOL         0x0B    /**< Request to set the current HID report protocol mode.*/
 /** @} */
 
 /**\name USB HID class-specified descriptor types
  * @{ */
-#define	USB_DTYPE_HID           	0x21 /**< Descriptor header type value, to indicate a HID class HID descriptor. */
-#define	USB_DTYPE_HID_REPORT     	0x22 /**< Descriptor header type value, to indicate a HID class HID report descriptor. */
+#define USB_DTYPE_HID               0x21    /**<\brief HID class HID descriptor type.*/
+#define USB_DTYPE_HID_REPORT        0x22    /**<\brief HID class HID report descriptor type.*/
 /** @} */
 
 /**\name USB HID country codes
  * @{ */
-#define USB_HID_COUNTRY_NONE 		0 	/**< Not supported */
-#define USB_HID_COUNTRY_AR   		1 	/**< Arabic */
-#define USB_HID_COUNTRY_BE   		2 	/**< Belgian */
-#define USB_HID_COUNTRY_CA_BI		3 	/**< Canadian-Bilingual */
-#define USB_HID_COUNTRY_CA_FR		4 	/**< Canadian-French */
-#define USB_HID_COUNTRY_CZ   		5 	/**< Czech Republic */
-#define USB_HID_COUNTRY_DK   		6 	/**< Danish */
-#define USB_HID_COUNTRY_FI   		7 	/**< Finnish */
-#define USB_HID_COUNTRY_FR   		8 	/**< French */
-#define USB_HID_COUNTRY_DE   		9 	/**< German */
-#define USB_HID_COUNTRY_GR   		10	/**< Greek */
-#define USB_HID_COUNTRY_HEB  		11	/**< Hebrew */
-#define USB_HID_COUNTRY_HU   		12	/**< Hungary */
-#define USB_HID_COUNTRY_ISO  		13	/**< International (ISO) */
-#define USB_HID_COUNTRY_IT   		14	/**< Italian */
-#define USB_HID_COUNTRY_JP   		15	/**< Japan (Katakana) */
-#define USB_HID_COUNTRY_KR   		16	/**< Korean */
-#define USB_HID_COUNTRY_LAT  		17	/**< Latin American */
-#define USB_HID_COUNTRY_NL   		18	/**< Netherlands/Dutch */
-#define USB_HID_COUNTRY_NO   		19	/**< Norwegian */
-#define USB_HID_COUNTRY_PER  		20	/**< Persian (Farsi) */
-#define USB_HID_COUNTRY_PL   		21	/**< Poland */
-#define USB_HID_COUNTRY_PO   		22	/**< Portuguese */
-#define USB_HID_COUNTRY_RU   		23	/**< Russia */
-#define USB_HID_COUNTRY_SK   		24	/**< Slovakia */
-#define USB_HID_COUNTRY_ES   		25	/**< Spanish */
-#define USB_HID_COUNTRY_SE   		26	/**< Swedish */
-#define USB_HID_COUNTRY_CH_FR		26	/**< Swiss-French */
-#define USB_HID_COUNTRY_CH_DE		27	/**< Swiss-German */
-#define USB_HID_COUNTRY_CH   		29	/**< Switzerland */
-#define USB_HID_COUNTRY_TW   		30	/**< Taiwan */
-#define USB_HID_COUNTRY_TR_Q 		31	/**< Turkish-Q */
-#define USB_HID_COUNTRY_UK   		32	/**< UK */
-#define USB_HID_COUNTRY_US   		33	/**< US */
-#define USB_HID_COUNTRY_YU   		34	/**< Yugoslavia */
-#define USB_HID_COUNTRY_TR_F 		35	/**< Turkish-F */
+#define USB_HID_COUNTRY_NONE        0       /**<\brief Not supported */
+#define USB_HID_COUNTRY_AR          1       /**<\brief Arabic */
+#define USB_HID_COUNTRY_BE          2       /**<\brief Belgian */
+#define USB_HID_COUNTRY_CA_BI       3       /**<\brief Canadian-Bilingual */
+#define USB_HID_COUNTRY_CA_FR       4       /**<\brief Canadian-French */
+#define USB_HID_COUNTRY_CZ          5       /**<\brief Czech Republic */
+#define USB_HID_COUNTRY_DK          6       /**<\brief Danish */
+#define USB_HID_COUNTRY_FI          7       /**<\brief Finnish */
+#define USB_HID_COUNTRY_FR          8       /**<\brief French */
+#define USB_HID_COUNTRY_DE          9       /**<\brief German */
+#define USB_HID_COUNTRY_GR          10      /**<\brief Greek */
+#define USB_HID_COUNTRY_HEB         11      /**<\brief Hebrew */
+#define USB_HID_COUNTRY_HU          12      /**<\brief Hungary */
+#define USB_HID_COUNTRY_ISO         13      /**<\brief International (ISO) */
+#define USB_HID_COUNTRY_IT          14      /**<\brief Italian */
+#define USB_HID_COUNTRY_JP          15      /**<\brief Japan (Katakana) */
+#define USB_HID_COUNTRY_KR          16      /**<\brief Korean */
+#define USB_HID_COUNTRY_LAT         17      /**<\brief Latin American */
+#define USB_HID_COUNTRY_NL          18      /**<\brief Netherlands/Dutch */
+#define USB_HID_COUNTRY_NO          19      /**<\brief Norwegian */
+#define USB_HID_COUNTRY_PER         20      /**<\brief Persian (Farsi) */
+#define USB_HID_COUNTRY_PL          21      /**<\brief Poland */
+#define USB_HID_COUNTRY_PO          22      /**<\brief Portuguese */
+#define USB_HID_COUNTRY_RU          23      /**<\brief Russia */
+#define USB_HID_COUNTRY_SK          24      /**<\brief Slovakia */
+#define USB_HID_COUNTRY_ES          25      /**<\brief Spanish */
+#define USB_HID_COUNTRY_SE          26      /**<\brief Swedish */
+#define USB_HID_COUNTRY_CH_FR       26      /**<\brief Swiss-French */
+#define USB_HID_COUNTRY_CH_DE       27      /**<\brief Swiss-German */
+#define USB_HID_COUNTRY_CH          29      /**<\brief Switzerland */
+#define USB_HID_COUNTRY_TW          30      /**<\brief Taiwan */
+#define USB_HID_COUNTRY_TR_Q        31      /**<\brief Turkish-Q */
+#define USB_HID_COUNTRY_UK          32      /**<\brief United Kingdom */
+#define USB_HID_COUNTRY_US          33      /**<\brief United States */
+#define USB_HID_COUNTRY_YU          34      /**<\brief Yugoslavia */
+#define USB_HID_COUNTRY_TR_F        35      /**<\brief Turkish-F */
 /** @} */
 
-/** \brief USB HID functional descriptor */
+/**\brief USB HID functional descriptor */
 struct usb_hid_descriptor {
-    uint8_t     bLength;            /**< Size of the descriptor, in bytes. */
-    uint8_t     bDescriptorType;    /**< Type of the descriptor, set to \ref USB_DTYPE_HID */
-	uint16_t    bcdHID;             /**< BCD encoded version that the HID descriptor and device complies to. \ref VERSION_BCD() */
-    uint8_t     bCountryCode;       /**< Country code of the localized device, or zero if universal. */
-	uint8_t     bNumDescriptors;    /**< Total number of HID report descriptors for the interface. */
-	uint8_t     bDescriptorType0;   /**< 1'st HID report descriptor type, set to \ref USB_DTYPE_HID_REPORT */
-	uint16_t    wDescriptorLength0; /**< 1'sr HID report descriptor length in bytes. */
+    uint8_t     bLength;            /**<\brief Size of the descriptor, in bytes. */
+    uint8_t     bDescriptorType;    /**<\brief Type of the descriptor, set to \ref USB_DTYPE_HID */
+    uint16_t    bcdHID;             /**<\brief BCD encoded version that the HID descriptor and device complies to. */
+    uint8_t     bCountryCode;       /**<\brief Country code of the localized device, or zero if universal. */
+    uint8_t     bNumDescriptors;    /**<\brief Total number of HID report descriptors for the interface. */
+    uint8_t     bDescriptorType0;   /**<\brief 1'st HID report descriptor type, set to \ref USB_DTYPE_HID_REPORT */
+    uint16_t    wDescriptorLength0; /**<\brief 1'sr HID report descriptor length in bytes. */
 } __attribute__((packed));
 
 /**\brief USB HID report descriptor */
 struct usb_hid_report_descriptor {
-	uint8_t     bDescriptorType;   /**< Type of HID report, set to \ref USB_DTYPE_HID_REPORT */
-    uint16_t    wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */
+    uint8_t     bDescriptorType;   /**<\brief Type of HID report, set to \ref USB_DTYPE_HID_REPORT */
+    uint16_t    wDescriptorLength; /**<\brief Length of the associated HID report descriptor, in bytes. */
 } __attribute__((packed));
 
 
-	/* Private Interface - For use in library only: */
-	#if !defined(__DOXYGEN__)
-		/* Macros: */
-            #define CONCAT(x, y)            x ## y
-            #define CONCAT_EXPANDED(x, y)   CONCAT(x, y)
-
-			#define HID_RI_DATA_SIZE_MASK                   0x03
-			#define HID_RI_TYPE_MASK                        0x0C
-			#define HID_RI_TAG_MASK                         0xF0
-
-			#define HID_RI_TYPE_MAIN                        0x00
-			#define HID_RI_TYPE_GLOBAL                      0x04
-			#define HID_RI_TYPE_LOCAL                       0x08
-
-			#define HID_RI_DATA_BITS_0                      0x00
-			#define HID_RI_DATA_BITS_8                      0x01
-			#define HID_RI_DATA_BITS_16                     0x02
-			#define HID_RI_DATA_BITS_32                     0x03
-			#define HID_RI_DATA_BITS(DataBits)              CONCAT_EXPANDED(HID_RI_DATA_BITS_, DataBits)
-
-			#define _HID_RI_ENCODE_0(Data)
-			#define _HID_RI_ENCODE_8(Data)                  , (Data & 0xFF)
-			#define _HID_RI_ENCODE_16(Data)                 _HID_RI_ENCODE_8(Data)  _HID_RI_ENCODE_8(Data >> 8)
-			#define _HID_RI_ENCODE_32(Data)                 _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_16(Data >> 16)
-			#define _HID_RI_ENCODE(DataBits, ...)           CONCAT_EXPANDED(_HID_RI_ENCODE_, DataBits(__VA_ARGS__))
-
-			#define _HID_RI_ENTRY(Type, Tag, DataBits, ...) (Type | Tag | HID_RI_DATA_BITS(DataBits)) _HID_RI_ENCODE(DataBits, (__VA_ARGS__))
-	#endif
-
-	/* Public Interface - May be used in end-application: */
-		/* Macros: */
-		/** \name HID Input, Output and Feature Report Descriptor Item Flags */
-		//@{
-			#define HID_IOF_CONSTANT                        (1 << 0)
-			#define HID_IOF_DATA                            (0 << 0)
-			#define HID_IOF_VARIABLE                        (1 << 1)
-			#define HID_IOF_ARRAY                           (0 << 1)
-			#define HID_IOF_RELATIVE                        (1 << 2)
-			#define HID_IOF_ABSOLUTE                        (0 << 2)
-			#define HID_IOF_WRAP                            (1 << 3)
-			#define HID_IOF_NO_WRAP                         (0 << 3)
-			#define HID_IOF_NON_LINEAR                      (1 << 4)
-			#define HID_IOF_LINEAR                          (0 << 4)
-			#define HID_IOF_NO_PREFERRED_STATE              (1 << 5)
-			#define HID_IOF_PREFERRED_STATE                 (0 << 5)
-			#define HID_IOF_NULLSTATE                       (1 << 6)
-			#define HID_IOF_NO_NULL_POSITION                (0 << 6)
-			#define HID_IOF_VOLATILE                        (1 << 7)
-			#define HID_IOF_NON_VOLATILE                    (0 << 7)
-			#define HID_IOF_BUFFERED_BYTES                  (1 << 8)
-			#define HID_IOF_BITFIELD                        (0 << 8)
-		//@}
-
-		/** \name HID Report Descriptor Item Macros */
-		//@{
-			#define HID_RI_INPUT(DataBits, ...)             _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0x80, DataBits, __VA_ARGS__)
-			#define HID_RI_OUTPUT(DataBits, ...)            _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0x90, DataBits, __VA_ARGS__)
-			#define HID_RI_COLLECTION(DataBits, ...)        _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0xA0, DataBits, __VA_ARGS__)
-			#define HID_RI_FEATURE(DataBits, ...)           _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0xB0, DataBits, __VA_ARGS__)
-			#define HID_RI_END_COLLECTION(DataBits, ...)    _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0xC0, DataBits, __VA_ARGS__)
-			#define HID_RI_USAGE_PAGE(DataBits, ...)        _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x00, DataBits, __VA_ARGS__)
-			#define HID_RI_LOGICAL_MINIMUM(DataBits, ...)   _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x10, DataBits, __VA_ARGS__)
-			#define HID_RI_LOGICAL_MAXIMUM(DataBits, ...)   _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x20, DataBits, __VA_ARGS__)
-			#define HID_RI_PHYSICAL_MINIMUM(DataBits, ...)  _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x30, DataBits, __VA_ARGS__)
-			#define HID_RI_PHYSICAL_MAXIMUM(DataBits, ...)  _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x40, DataBits, __VA_ARGS__)
-			#define HID_RI_UNIT_EXPONENT(DataBits, ...)     _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x50, DataBits, __VA_ARGS__)
-			#define HID_RI_UNIT(DataBits, ...)              _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x60, DataBits, __VA_ARGS__)
-			#define HID_RI_REPORT_SIZE(DataBits, ...)       _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x70, DataBits, __VA_ARGS__)
-			#define HID_RI_REPORT_ID(DataBits, ...)         _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x80, DataBits, __VA_ARGS__)
-			#define HID_RI_REPORT_COUNT(DataBits, ...)      _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x90, DataBits, __VA_ARGS__)
-			#define HID_RI_PUSH(DataBits, ...)              _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xA0, DataBits, __VA_ARGS__)
-			#define HID_RI_POP(DataBits, ...)               _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xB0, DataBits, __VA_ARGS__)
-			#define HID_RI_USAGE(DataBits, ...)             _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x00, DataBits, __VA_ARGS__)
-			#define HID_RI_USAGE_MINIMUM(DataBits, ...)     _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x10, DataBits, __VA_ARGS__)
-			#define HID_RI_USAGE_MAXIMUM(DataBits, ...)     _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x20, DataBits, __VA_ARGS__)
-		//@}
-
-
+/* Private Interface - For use in library only: */
+#if !defined(__DOXYGEN__)
+    /* Macros: */
+    #define CONCAT(x, y)            x ## y
+    #define CONCAT_EXPANDED(x, y)   CONCAT(x, y)
+    #define HID_RI_DATA_SIZE_MASK                   0x03
+    #define HID_RI_TYPE_MASK                        0x0C
+    #define HID_RI_TAG_MASK                         0xF0
+    #define HID_RI_TYPE_MAIN                        0x00
+    #define HID_RI_TYPE_GLOBAL                      0x04
+    #define HID_RI_TYPE_LOCAL                       0x08
+    #define HID_RI_DATA_BITS_0                      0x00
+    #define HID_RI_DATA_BITS_8                      0x01
+    #define HID_RI_DATA_BITS_16                     0x02
+    #define HID_RI_DATA_BITS_32                     0x03
+    #define HID_RI_DATA_BITS(DataBits)              CONCAT_EXPANDED(HID_RI_DATA_BITS_, DataBits)
+    #define _HID_RI_ENCODE_0(Data)
+    #define _HID_RI_ENCODE_8(Data)                  , (Data & 0xFF)
+    #define _HID_RI_ENCODE_16(Data)                 _HID_RI_ENCODE_8(Data)  _HID_RI_ENCODE_8(Data >> 8)
+    #define _HID_RI_ENCODE_32(Data)                 _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_16(Data >> 16)
+    #define _HID_RI_ENCODE(DataBits, ...)           CONCAT_EXPANDED(_HID_RI_ENCODE_, DataBits(__VA_ARGS__))
+    #define _HID_RI_ENTRY(Type, Tag, DataBits, ...) (Type | Tag | HID_RI_DATA_BITS(DataBits)) _HID_RI_ENCODE(DataBits, (__VA_ARGS__))
+#endif
+/* Public Interface - May be used in end-application: */
+/* Macros: */
+/** \name HID Input, Output and Feature Report Descriptor Item Flags */
+//@{
+#define HID_IOF_CONSTANT                        (1 << 0)
+#define HID_IOF_DATA                            (0 << 0)
+#define HID_IOF_VARIABLE                        (1 << 1)
+#define HID_IOF_ARRAY                           (0 << 1)
+#define HID_IOF_RELATIVE                        (1 << 2)
+#define HID_IOF_ABSOLUTE                        (0 << 2)
+#define HID_IOF_WRAP                            (1 << 3)
+#define HID_IOF_NO_WRAP                         (0 << 3)
+#define HID_IOF_NON_LINEAR                      (1 << 4)
+#define HID_IOF_LINEAR                          (0 << 4)
+#define HID_IOF_NO_PREFERRED_STATE              (1 << 5)
+#define HID_IOF_PREFERRED_STATE                 (0 << 5)
+#define HID_IOF_NULLSTATE                       (1 << 6)
+#define HID_IOF_NO_NULL_POSITION                (0 << 6)
+#define HID_IOF_VOLATILE                        (1 << 7)
+#define HID_IOF_NON_VOLATILE                    (0 << 7)
+#define HID_IOF_BUFFERED_BYTES                  (1 << 8)
+#define HID_IOF_BITFIELD                        (0 << 8)
+//@}
+
+/** \name HID Report Descriptor Item Macros */
+//@{
+#define HID_RI_INPUT(DataBits, ...)             _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0x80, DataBits, __VA_ARGS__)
+#define HID_RI_OUTPUT(DataBits, ...)            _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0x90, DataBits, __VA_ARGS__)
+#define HID_RI_COLLECTION(DataBits, ...)        _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0xA0, DataBits, __VA_ARGS__)
+#define HID_RI_FEATURE(DataBits, ...)           _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0xB0, DataBits, __VA_ARGS__)
+#define HID_RI_END_COLLECTION(DataBits, ...)    _HID_RI_ENTRY(HID_RI_TYPE_MAIN  , 0xC0, DataBits, __VA_ARGS__)
+#define HID_RI_USAGE_PAGE(DataBits, ...)        _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x00, DataBits, __VA_ARGS__)
+#define HID_RI_LOGICAL_MINIMUM(DataBits, ...)   _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x10, DataBits, __VA_ARGS__)
+#define HID_RI_LOGICAL_MAXIMUM(DataBits, ...)   _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x20, DataBits, __VA_ARGS__)
+#define HID_RI_PHYSICAL_MINIMUM(DataBits, ...)  _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x30, DataBits, __VA_ARGS__)
+#define HID_RI_PHYSICAL_MAXIMUM(DataBits, ...)  _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x40, DataBits, __VA_ARGS__)
+#define HID_RI_UNIT_EXPONENT(DataBits, ...)     _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x50, DataBits, __VA_ARGS__)
+#define HID_RI_UNIT(DataBits, ...)              _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x60, DataBits, __VA_ARGS__)
+#define HID_RI_REPORT_SIZE(DataBits, ...)       _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x70, DataBits, __VA_ARGS__)
+#define HID_RI_REPORT_ID(DataBits, ...)         _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x80, DataBits, __VA_ARGS__)
+#define HID_RI_REPORT_COUNT(DataBits, ...)      _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x90, DataBits, __VA_ARGS__)
+#define HID_RI_PUSH(DataBits, ...)              _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xA0, DataBits, __VA_ARGS__)
+#define HID_RI_POP(DataBits, ...)               _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xB0, DataBits, __VA_ARGS__)
+#define HID_RI_USAGE(DataBits, ...)             _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x00, DataBits, __VA_ARGS__)
+#define HID_RI_USAGE_MINIMUM(DataBits, ...)     _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x10, DataBits, __VA_ARGS__)
+#define HID_RI_USAGE_MAXIMUM(DataBits, ...)     _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x20, DataBits, __VA_ARGS__)
+//@}
 
 
 /** @}  */

+ 346 - 315
inc/usb_std.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -25,10 +25,12 @@ extern "C" {
 /**\addtogroup USB_STD USB Standard
  * \brief This module contains generic USB device framework definitions
  * \details This module based on
- * + Chapter 9 of the [Universal Serial Bus Specification Revision 2.0](http://www.usb.org/developers/docs/usb20_docs/usb_20_080416.zip)
+ * + Chapter 9 of the [Universal Serial Bus Specification Revision 2.0]
+ * (http://www.usb.org/developers/docs/usb20_docs/usb_20_080416.zip)
  * + [LUFA - the Lightweight USB Framework for AVRs.](https://github.com/abcminiuser/lufa)
- * @{
- *\name Utility functional macros
+ * @{ */
+
+/**\name Utility functional macros
  * @{ */
 /** Macro to encode major/minor/version number into BCD code
  * \param maj Major version
@@ -38,9 +40,13 @@ extern "C" {
 #define VERSION_BCD(maj, min, rev)  (((maj & 0xFF) << 8) | ((min & 0x0F) << 4) | (rev & 0x0F))
 
 /** Macro to create \ref usb_string_descriptor from array */
-#define USB_ARRAY_DESC(...)        {.bLength = 2 + sizeof((uint16_t[]){__VA_ARGS__}), .bDescriptorType = USB_DTYPE_STRING, .wString = {__VA_ARGS__}}
+#define USB_ARRAY_DESC(...)        {.bLength = 2 + sizeof((uint16_t[]){__VA_ARGS__}),\
+                                    .bDescriptorType = USB_DTYPE_STRING,\
+                                    .wString = {__VA_ARGS__}}
 /** Macro to create \ref usb_string_descriptor from string */
-#define USB_STRING_DESC(s)         {.bLength = sizeof(CAT(u,s)), .bDescriptorType = USB_DTYPE_STRING, .wString = {CAT(u,s)}}
+#define USB_STRING_DESC(s)         {.bLength = sizeof(CAT(u,s)),\
+                                    .bDescriptorType = USB_DTYPE_STRING,\
+                                    .wString = {CAT(u,s)}}
 
 /**\brief Macro to set мaximum power consumption field for the \ref usb_config_descriptor */
 #define USB_CFG_POWER_MA(mA)        ((mA) >> 1)
@@ -55,89 +61,97 @@ extern "C" {
 /** \anchor USB_ENDPOINT_DEF
  *  \name USB endpoint attributes definitions
  * @{ */
-#define USB_EPDIR_IN                0x00        /**< indicates host-to-device endpoint direction  */
-#define USB_EPDIR_OUT               0x80        /**< indicates device-to-host endpoint direction */
-#define USB_EPTYPE_CONTROL          0x00
-#define USB_EPTYPE_ISOCHRONUS       0x01
-#define USB_EPTYPE_BULK             0x02
-#define USB_EPTYPE_INTERRUPT        0x03
-#define USB_EPATTR_NO_SYNC          0x00
-#define USB_EPATTR_ASYNC            0x04
-#define USB_EPATTR_ADAPTIVE         0x08
-#define USB_EPATTR_SYNC             0x0C
-#define USB_EPUSAGE_DATA            0x00
-#define USB_EPUSAGE_FEEDBACK        0x10
-#define USB_EPUSAGE_IMP_FEEDBACK    0x20
+#define USB_EPDIR_IN                0x00    /**<\brief Host-to-device endpoint direction.*/
+#define USB_EPDIR_OUT               0x80    /**<\brief Device-to-host endpoint direction.*/
+#define USB_EPTYPE_CONTROL          0x00    /**<\brief Control endpoint.*/
+#define USB_EPTYPE_ISOCHRONUS       0x01    /**<\brief Isochronous endpoint.*/
+#define USB_EPTYPE_BULK             0x02    /**<\brief Bbulk endpoint.*/
+#define USB_EPTYPE_INTERRUPT        0x03    /**<\brief Interrupt endpoint.*/
+#define USB_EPATTR_NO_SYNC          0x00    /**<\brief No synchronization.*/
+#define USB_EPATTR_ASYNC            0x04    /**<\brief Asynchronous endpoint.*/
+#define USB_EPATTR_ADAPTIVE         0x08    /**<\brief Adaptive endpoint.*/
+#define USB_EPATTR_SYNC             0x0C    /**<\brief Synchronous endpoint.*/
+#define USB_EPUSAGE_DATA            0x00    /**<\brief Data endpoint.*/
+#define USB_EPUSAGE_FEEDBACK        0x10    /**<\brief Feedback endpoint.*/
+#define USB_EPUSAGE_IMP_FEEDBACK    0x20    /**<\brief Implicit feedback Data endpoint.*/
 /** @} */
 
 /**\name Special string descriptor indexes
  * @{ */
-#define NO_DESCRIPTOR               0x00    /**< \brief Indicates that a given string descriptor doesn't exists in the device */
-#define INTSERIALNO_DESCRIPTOR      0xFE    /**< \brief Indicates that a given string descriptor is a internal serial number provided by hardware driver */
+#define NO_DESCRIPTOR               0x00    /**<\brief String descriptor doesn't exists in the device.*/
+#define INTSERIALNO_DESCRIPTOR      0xFE    /**<\brief String descriptor is an internal serial number
+                                             * provided by hardware driver.*/
 /** @} */
 
 /**\name USB class definitions
  * @{ */
-#define USB_CLASS_PER_INTERFACE     0x00 /**< Class defined on interface level */
-#define USB_SUBCLASS_NONE           0x00
-#define USB_PROTO_NONE              0x00
-#define USB_CLASS_AUDIO             0x01 /**< Interface belongs to the Audio device class. */
-#define USB_CLASS_PHYSICAL          0x05 /**< Interface belongs to the Physical device class. */
-#define USB_CLASS_STILL_IMAGE       0x06 /**< Interface belongs to the Still Imaging device class. */
-#define USB_CLASS_PRINTER           0x07 /**< Interface belongs to the Printer device class. */
-#define USB_CLASS_MASS_STORAGE      0x08 /**< Interface belongs to the Mass Storage device class. */
-#define USB_CLASS_HUB               0x09 /**< Device belongs to the HUB device class. */
-#define USB_CLASS_CSCID             0x0B /**< Interface belongs to the Smart Card device class. */
-#define USB_CLASS_CONTENT_SEC       0x0D /**< Interface belongs to the Content Security device class. */
-#define USB_CLASS_VIDEO             0x0E /**< Interface belongs to the Video device class. */
-#define USB_CLASS_HEALTHCARE        0x0F /**< Interface belongs to the Personal Healthcare device class. */
-#define USB_CLASS_AV                0x10 /**< Interface belongs to the Audio/Video device class. */
-#define USB_CLASS_BILLBOARD         0x11 /**< Device belongs to the Billboard device class. */
-#define USB_CLASS_CBRIDGE           0x12 /**< Interface belongs to the USB Type-C Bridge device class. */
-#define USB_CLASS_DIAGNOSTIC        0xDC /**< Device/Interface belongs to the Diagnostic device class. */
-#define USB_CLASS_WIRELESS          0xE0 /**< Interface belongs to the Wireless controller class. */
-#define USB_CLASS_MISC              0xEF /**< Device/Interface belongs to the Miscellanious device class. */
-#define USB_CLASS_APP_SPEC          0xFE /**< Interface belongs to the Application Specific class. */
-#define USB_CLASS_VENDOR            0xFF /**< Device belongs to a vendor specific class. */
-#define USB_SUBCLASS_VENDOR         0xFF /**< Subclass belongs to a vendor specific subclass. */
-#define USB_PROTO_VENDOR            0xFF /**< Protocol belongs to a vendor specific protocol. */
+#define USB_CLASS_PER_INTERFACE     0x00    /**<\brief Class defined on interface level.*/
+#define USB_SUBCLASS_NONE           0x00    /**<\brief No subclass defined.*/
+#define USB_PROTO_NONE              0x00    /**<\brief No protocol defined.*/
+#define USB_CLASS_AUDIO             0x01    /**<\brief Audio device class.*/
+#define USB_CLASS_PHYSICAL          0x05    /**<\brief Physical device class.*/
+#define USB_CLASS_STILL_IMAGE       0x06    /**<\brief Still Imaging device class.*/
+#define USB_CLASS_PRINTER           0x07    /**<\brief Printer device class.*/
+#define USB_CLASS_MASS_STORAGE      0x08    /**<\brief Mass Storage device class.*/
+#define USB_CLASS_HUB               0x09    /**<\brief HUB device class.*/
+#define USB_CLASS_CSCID             0x0B    /**<\brief Smart Card device class.*/
+#define USB_CLASS_CONTENT_SEC       0x0D    /**<\brief Content Security device class.*/
+#define USB_CLASS_VIDEO             0x0E    /**<\brief Video device class.*/
+#define USB_CLASS_HEALTHCARE        0x0F    /**<\brief Personal Healthcare device class.*/
+#define USB_CLASS_AV                0x10    /**<\brief Audio/Video device class.*/
+#define USB_CLASS_BILLBOARD         0x11    /**<\brief Billboard device class.*/
+#define USB_CLASS_CBRIDGE           0x12    /**<\brief USB Type-C Bridge device class.*/
+#define USB_CLASS_DIAGNOSTIC        0xDC    /**<\brief Diagnostic device class.*/
+#define USB_CLASS_WIRELESS          0xE0    /**<\brief Wireless controller class.*/
+#define USB_CLASS_MISC              0xEF    /**<\brief Miscellanious device class.*/
+#define USB_CLASS_APP_SPEC          0xFE    /**<\brief Application Specific class.*/
+#define USB_CLASS_VENDOR            0xFF    /**<\brief Vendor specific class.*/
+#define USB_SUBCLASS_VENDOR         0xFF    /**<\brief Vendor specific subclass.*/
+#define USB_PROTO_VENDOR            0xFF    /**<\brief Vendor specific protocol.*/
 /** @} */
 
 /**\name USB Standard descriptor types
  * @{ */
-#define USB_DTYPE_DEVICE            0x01 /**< Indicates that the descriptor is a \ref usb_device_descriptor*/
-#define USB_DTYPE_CONFIGURATION     0x02 /**< Indicates that the descriptor is a \ref usb_config_descriptor */
-#define USB_DTYPE_STRING            0x03 /**< Indicates that the descriptor is a \ref usb_string_descriptor */
-#define USB_DTYPE_INTERFACE         0x04 /**< Indicates that the descriptor is a \ref usb_interface_descriptor */
-#define USB_DTYPE_ENDPOINT          0x05 /**< Indicates that the descriptor is an endpoint descriptor. */
-#define USB_DTYPE_QUALIFIER         0x06 /**< Indicates that the descriptor is a \ref usb_qualifier_descriptor */
-#define USB_DTYPE_OTHER             0x07 /**< Indicates that the descriptor is of other type. */
-#define USB_DTYPE_INTERFACEPOWER    0x08 /**< Indicates that the descriptor is an interface power descriptor. */
-#define USB_DTYPE_OTG               0x09 /**< Indicates that the descroptor is an OTG descriptor */
-#define USB_DTYPE_DEBUG             0x0A /**< Indicates that the descriptor is a Debug descriptor */
-#define USB_DTYPE_INTERFASEASSOC    0x0B /**< Indicates that the descriptor is an interface association descriptor. */
-#define USB_DTYPE_CS_INTERFACE      0x24 /**< Indicates that the descriptor is a class specific interface descriptor. */
-#define USB_DTYPE_CS_ENDPOINT       0x25 /**< Indicates that the descriptor is a class specific endpoint descriptor. */
+#define USB_DTYPE_DEVICE            0x01    /**<\brief Device descriptor.*/
+#define USB_DTYPE_CONFIGURATION     0x02    /**<\brief Configuration descriptor.*/
+#define USB_DTYPE_STRING            0x03    /**<\brief String descriptor.*/
+#define USB_DTYPE_INTERFACE         0x04    /**<\brief Interface descriptor.*/
+#define USB_DTYPE_ENDPOINT          0x05    /**<\brief Endpoint  descriptor.*/
+#define USB_DTYPE_QUALIFIER         0x06    /**<\brief Qualifier descriptor.*/
+#define USB_DTYPE_OTHER             0x07    /**<\brief Descriptor is of other type. */
+#define USB_DTYPE_INTERFACEPOWER    0x08    /**<\brief Interface power descriptor. */
+#define USB_DTYPE_OTG               0x09    /**<\brief OTG descriptor.*/
+#define USB_DTYPE_DEBUG             0x0A    /**<\brief Debug descriptor.*/
+#define USB_DTYPE_INTERFASEASSOC    0x0B    /**<\brief Interface association descriptor.*/
+#define USB_DTYPE_CS_INTERFACE      0x24    /**<\brief Class specific interface descriptor.*/
+#define USB_DTYPE_CS_ENDPOINT       0x25    /**<\brief Class specific endpoint descriptor.*/
 /** @} */
 
 /**\name USB Standard requests
  * @{ */
-#define USB_STD_GET_STATUS          0x00 /**< This request returns status for the specified recipient */
-#define USB_STD_CLEAR_FEATURE       0x01 /**< This request is used to clear or disable a specific feature */
-#define USB_STD_SET_FEATURE         0x03 /**< This request is used to set or enable a specific feature */
-#define USB_STD_SET_ADDRESS         0x05 /**< This request sets the device address for all future device accesses */
-#define USB_STD_GET_DESCRIPTOR      0x06 /**< This request returns the specified descriptor if the descriptor exists */
-#define USB_STD_SET_DESCRIPTOR      0x07 /**< This request is optional and may be used to update existing descriptors or new descriptors may be added */
-#define USB_STD_GET_CONFIG          0x08 /**< This request returns the current device configuration value */
-#define USB_STD_SET_CONFIG          0x09 /**< This request sets the device configuration */
-#define USB_STD_GET_INTERFACE       0x0A /**< This request returns the selected alternate setting for the specified interface */
-#define USB_STD_SET_INTERFACE       0x0B /**< This request allows the host to select an alternate setting for the specified interface */
-#define USB_STD_SYNCH_FRAME         0x0C /**< This request is used to set and then report an endpoint's synchronization frame */
+#define USB_STD_GET_STATUS          0x00    /**<\brief Returns status for the specified recipient.*/
+#define USB_STD_CLEAR_FEATURE       0x01    /**<\brief Used to clear or disable a specific feature.*/
+#define USB_STD_SET_FEATURE         0x03    /**<\brief Used to set or enable a specific feature.*/
+#define USB_STD_SET_ADDRESS         0x05    /**<\brief Sets the device address for all future device
+                                             * accesses.*/
+#define USB_STD_GET_DESCRIPTOR      0x06    /**<\brief Returns the specified descriptor if the
+                                             * descriptor exists.*/
+#define USB_STD_SET_DESCRIPTOR      0x07    /**<\brief This request is optional and may be used to
+                                             * update existing descriptors or new descriptors may be
+                                             * added.*/
+#define USB_STD_GET_CONFIG          0x08    /**<\brief Returns the current device configuration value.*/
+#define USB_STD_SET_CONFIG          0x09    /**<\brief Sets the device configuration.*/
+#define USB_STD_GET_INTERFACE       0x0A    /**<\brief Returns the selected alternate setting for
+                                             * the specified interface.*/
+#define USB_STD_SET_INTERFACE       0x0B    /**<\brief Allows the host to select an alternate setting
+                                             * for the specified interface.*/
+#define USB_STD_SYNCH_FRAME         0x0C    /**<\brief Used to set and then report an endpoint's
+                                             * synchronization frame.*/
 /** @} */
 
 /**\name USB Feature selector
  * @{ */
-#define USB_FEAT_ENDPOINT_HALT      0x00
+#define USB_FEAT_ENDPOINT_HALT      0x00    /**<\brief Halt endpoint.*/
 #define USB_FEAT_REMOTE_WKUP        0x01
 #define USB_FEAT_TEST_MODE          0x02
 #define USB_FEAT_DEBUG_MODE         0x06
@@ -145,279 +159,296 @@ extern "C" {
 
 /**\name USB Test mode Selectors
  * @{ */
-#define USB_TEST_J                  0x01
-#define USB_TEST_K                  0x02
-#define USB_TEST_SE0_NAK            0x03
-#define USB_TEST_PACKET             0x04
-#define USB_TEST_FOECR_ENABLE       0x05
+#define USB_TEST_J                  0x01    /**<\brief Test J.*/
+#define USB_TEST_K                  0x02    /**<\brief Test K.*/
+#define USB_TEST_SE0_NAK            0x03    /**<\brief Test SE0 NAK.*/
+#define USB_TEST_PACKET             0x04    /**<\brief Test Pcaket.*/
+#define USB_TEST_FORCE_ENABLE       0x05    /**<\brief Test Force Enable.*/
 /** @} */
 
 /** \addtogroup USB_STD_LANGID USB standard LANGID codes
  * @{ */
-#define USB_LANGID_AFR          0x0436   /**< Afrikaans */
-#define USB_LANGID_SQI          0x041c   /**< Albanian */
-#define USB_LANGID_ARA_SA       0x0401   /**< Arabic (Saudi Arabia) */
-#define USB_LANGID_ARA_IQ       0x0801   /**< Arabic (Iraq) */
-#define USB_LANGID_ARA_EG       0x0c01   /**< Arabic (Egypt) */
-#define USB_LANGID_ARA_LY       0x1001   /**< Arabic (Libya) */
-#define USB_LANGID_ARA_DZ       0x1401   /**< Arabic (Algeria) */
-#define USB_LANGID_ARA_MA       0x1801   /**< Arabic (Morocco) */
-#define USB_LANGID_ARA_TN       0x1c01   /**< Arabic (Tunisia) */
-#define USB_LANGID_ARA_OM       0x2001   /**< Arabic (Oman) */
-#define USB_LANGID_ARA_YE       0x2401   /**< Arabic (Yemen) */
-#define USB_LANGID_ARA_SY       0x2801   /**< Arabic (Syria) */
-#define USB_LANGID_ARA_JO       0x2c01   /**< Arabic (Jordan) */
-#define USB_LANGID_ARA_LB       0x3001   /**< Arabic (Lebanon) */
-#define USB_LANGID_ARA_KW       0x3401   /**< Arabic (Kuwait) */
-#define USB_LANGID_ARA_AE       0x3801   /**< Arabic (U.A.E.) */
-#define USB_LANGID_ARA_BH       0x3c01   /**< Arabic (Bahrain) */
-#define USB_LANGID_ARA_QA       0x4001   /**< Arabic (Qatar) */
-#define USB_LANGID_HYE          0x042b   /**< Armenian */
-#define USB_LANGID_ASM          0x044d   /**< Assamese */
-#define USB_LANGID_AZE_LAT      0x042c   /**< Azeri (Latin) */
-#define USB_LANGID_AZE_CYR      0x082c   /**< Azeri (Cyrillic) */
-#define USB_LANGID_EUS          0x042d   /**< Basque */
-#define USB_LANGID_BEL          0x0423   /**< Belarussian */
-#define USB_LANGID_BEN          0x0445   /**< Bengali */
-#define USB_LANGID_BUL          0x0402   /**< Bulgarian */
-#define USB_LANGID_MYA          0x0455   /**< Burmese */
-#define USB_LANGID_CAT          0x0403   /**< Catalan */
-#define USB_LANGID_ZHO_TW       0x0404   /**< Chinese (Taiwan) */
-#define USB_LANGID_ZHO_CN       0x0804   /**< Chinese (PRC) */
-#define USB_LANGID_ZHO_HK       0x0c04   /**< Chinese (Hong Kong SAR, PRC) */
-#define USB_LANGID_ZHO_SG       0x1004   /**< Chinese (Singapore) */
-#define USB_LANGID_ZHO_MO       0x1404   /**< Chinese (Macau SAR) */
-#define USB_LANGID_HRV          0x041a   /**< Croatian */
-#define USB_LANGID_CZE          0x0405   /**< Czech */
-#define USB_LANGID_DAN          0x0406   /**< Danish */
-#define USB_LANGID_NLD_NL       0x0413   /**< Dutch (Netherlands) */
-#define USB_LANGID_NLD_BE       0x0813   /**< Dutch (Belgium) */
-#define USB_LANGID_ENG_US       0x0409   /**< English (United States) */
-#define USB_LANGID_ENG_UK       0x0809   /**< English (United Kingdom) */
-#define USB_LANGID_ENG_AU       0x0c09   /**< English (Australian) */
-#define USB_LANGID_ENG_CA       0x1009   /**< English (Canadian) */
-#define USB_LANGID_ENG_NZ       0x1409   /**< English (New Zealand) */
-#define USB_LANGID_ENG_IE       0x1809   /**< English (Ireland) */
-#define USB_LANGID_ENG_ZA       0x1c09   /**< English (South Africa) */
-#define USB_LANGID_ENG_JM       0x2009   /**< English (Jamaica) */
-#define USB_LANGID_ENG_CAR      0x2409   /**< English (Caribbean) */
-#define USB_LANGID_ENG_BZ       0x2809   /**< English (Belize) */
-#define USB_LANGID_ENG_TH       0x2c09   /**< English (Trinidad) */
-#define USB_LANGID_ENG_ZW       0x3009   /**< English (Zimbabwe) */
-#define USB_LANGID_ENG_PH       0x3409   /**< English (Philippines) */
-#define USB_LANGID_EST          0x0425   /**< Estonian */
-#define USB_LANGID_FAO          0x0438   /**< Faeroese */
-#define USB_LANGID_FAS          0x0429   /**< Farsi */
-#define USB_LANGID_FIN          0x040b   /**< Finnish */
-#define USB_LANGID_FRA          0x040c   /**< French (Standard) */
-#define USB_LANGID_FRA_BE       0x080c   /**< French (Belgian) */
-#define USB_LANGID_FRA_CA       0x0c0c   /**< French (Canadian) */
-#define USB_LANGID_FRA_SZ       0x100c   /**< French (Switzerland) */
-#define USB_LANGID_FRA_LU       0x140c   /**< French (Luxembourg) */
-#define USB_LANGID_FRA_MC       0x180c   /**< French (Monaco) */
-#define USB_LANGID_KAT          0x0437   /**< Georgian */
-#define USB_LANGID_DEU          0x0407   /**< German (Standard) */
-#define USB_LANGID_DEU_SZ       0x0807   /**< German (Switzerland) */
-#define USB_LANGID_DEU_AT       0x0c07   /**< German (Austria) */
-#define USB_LANGID_DEU_LU       0x1007   /**< German (Luxembourg) */
-#define USB_LANGID_DEU_LI       0x1407   /**< German (Liechtenstein) */
-#define USB_LANGID_ELL          0x0408   /**< Greek */
-#define USB_LANGID_GUJ          0x0447   /**< Gujarati */
-#define USB_LANGID_HEB          0x040d   /**< Hebrew */
-#define USB_LANGID_HIN          0x0439   /**< Hindi */
-#define USB_LANGID_HUN          0x040e   /**< Hungarian */
-#define USB_LANGID_ISL          0x040f   /**< Icelandic */
-#define USB_LANGID_IND          0x0421   /**< Indonesian */
-#define USB_LANGID_ITA          0x0410   /**< Italian (Standard) */
-#define USB_LANGID_ITA_SZ       0x0810   /**< Italian (Switzerland) */
-#define USB_LANGID_JPN          0x0411   /**< Japanese */
-#define USB_LANGID_KAN          0x044b   /**< Kannada */
-#define USB_LANGID_KAS          0x0860   /**< Kashmiri (India) */
-#define USB_LANGID_KAZ          0x043f   /**< Kazakh */
-#define USB_LANGID_KOK          0x0457   /**< Konkani */
-#define USB_LANGID_KOR          0x0412   /**< Korean */
-#define USB_LANGID_KOR_JOH      0x0812   /**< Korean (Johab) */
-#define USB_LANGID_LAV          0x0426   /**< Latvian */
-#define USB_LANGID_LIT          0x0427   /**< Lithuanian */
-#define USB_LANGID_LIT_CLS      0x0827   /**< Lithuanian (Classic) */
-#define USB_LANGID_MKD          0x042f   /**< Macedonian */
-#define USB_LANGID_MSA          0x043e   /**< Malay (Malaysian) */
-#define USB_LANGID_MSA_BN       0x083e   /**< Malay (Brunei Darussalam) */
-#define USB_LANGID_MAL          0x044c   /**< Malayalam */
-#define USB_LANGID_MNI          0x0458   /**< Manipuri */
-#define USB_LANGID_MAR          0x044e   /**< Marathi */
-#define USB_LANGID_NEP          0x0861   /**< Nepali (India) */
-#define USB_LANGID_NOB          0x0414   /**< Norwegian (Bokmal) */
-#define USB_LANGID_NNO          0x0814   /**< Norwegian (Nynorsk) */
-#define USB_LANGID_ORI          0x0448   /**< Oriya */
-#define USB_LANGID_POL          0x0415   /**< Polish */
-#define USB_LANGID_POR_BR       0x0416   /**< Portuguese (Brazil) */
-#define USB_LANGID_POR          0x0816   /**< Portuguese (Standard) */
-#define USB_LANGID_PAN          0x0446   /**< Punjabi */
-#define USB_LANGID_RON          0x0418   /**< Romanian */
-#define USB_LANGID_RUS          0x0419   /**< Russian */
-#define USB_LANGID_SAN          0x044f   /**< Sanskrit */
-#define USB_LANGID_SRB_CYR      0x0c1a   /**< Serbian (Cyrillic) */
-#define USB_LANGID_SRB_LAT      0x081a   /**< Serbian (Latin) */
-#define USB_LANGID_SND          0x0459   /**< Sindhi */
-#define USB_LANGID_SLK          0x041b   /**< Slovak */
-#define USB_LANGID_SLV          0x0424   /**< Slovenian */
-#define USB_LANGID_SPA          0x040a   /**< Spanish (Traditional Sort) */
-#define USB_LANGID_SPA_MX       0x080a   /**< Spanish (Mexican) */
-#define USB_LANGID_SPA_MDN      0x0c0a   /**< Spanish (Modern Sort) */
-#define USB_LANGID_SPA_GT       0x100a   /**< Spanish (Guatemala) */
-#define USB_LANGID_SPA_CR       0x140a   /**< Spanish (Costa Rica) */
-#define USB_LANGID_SPA_PA       0x180a   /**< Spanish (Panama) */
-#define USB_LANGID_SPA_DO       0x1c0a   /**< Spanish (Dominican Republic) */
-#define USB_LANGID_SPA_VE       0x200a   /**< Spanish (Venezuela) */
-#define USB_LANGID_SPA_CO       0x240a   /**< Spanish (Colombia) */
-#define USB_LANGID_SPA_PE       0x280a   /**< Spanish (Peru) */
-#define USB_LANGID_SPA_AR       0x2c0a   /**< Spanish (Argentina) */
-#define USB_LANGID_SPA_EC       0x300a   /**< Spanish (Ecuador) */
-#define USB_LANGID_SPA_CL       0x340a   /**< Spanish (Chile) */
-#define USB_LANGID_SPA_UY       0x380a   /**< Spanish (Uruguay) */
-#define USB_LANGID_SPA_PY       0x3c0a   /**< Spanish (Paraguay) */
-#define USB_LANGID_SPA_BO       0x400a   /**< Spanish (Bolivia) */
-#define USB_LANGID_SPA_SV       0x440a   /**< Spanish (El Salvador) */
-#define USB_LANGID_SPA_HN       0x480a   /**< Spanish (Honduras) */
-#define USB_LANGID_SPA_NI       0x4c0a   /**< Spanish (Nicaragua) */
-#define USB_LANGID_SPA_PR       0x500a   /**< Spanish (Puerto Rico) */
-#define USB_LANGID_NSO          0x0430   /**< Sutu, Sotho. */
-#define USB_LANGID_SWA          0x0441   /**< Swahili (Kenya) */
-#define USB_LANGID_SWE          0x041d   /**< Swedish */
-#define USB_LANGID_SWE_FI       0x081d   /**< Swedish (Finland) */
-#define USB_LANGID_TAM          0x0449   /**< Tamil */
-#define USB_LANGID_TAT          0x0444   /**< Tatar (Tatarstan) */
-#define USB_LANGID_TEL          0x044a   /**< Telugu */
-#define USB_LANGID_THA          0x041e   /**< Thai */
-#define USB_LANGID_TUR          0x041f   /**< Turkish */
-#define USB_LANGIG_UKR          0x0422   /**< Ukrainian */
-#define USB_LANGID_URD_PK       0x0420   /**< Urdu (Pakistan) */
-#define USB_LANGID_URD_IN       0x0820   /**< Urdu (India) */
-#define USB_LANGID_UZB_LAT      0x0443   /**< Uzbek (Latin) */
-#define USB_LANGID_UZB_CYR      0x0843   /**< Uzbek (Cyrillic) */
-#define USB_LANGID_VIE          0x042a   /**< Vietnamese. */
+#define USB_LANGID_AFR              0x0436   /**<\brief Afrikaans */
+#define USB_LANGID_SQI              0x041c   /**<\brief Albanian */
+#define USB_LANGID_ARA_SA           0x0401   /**<\brief Arabic (Saudi Arabia) */
+#define USB_LANGID_ARA_IQ           0x0801   /**<\brief Arabic (Iraq) */
+#define USB_LANGID_ARA_EG           0x0c01   /**<\brief Arabic (Egypt) */
+#define USB_LANGID_ARA_LY           0x1001   /**<\brief Arabic (Libya) */
+#define USB_LANGID_ARA_DZ           0x1401   /**<\brief Arabic (Algeria) */
+#define USB_LANGID_ARA_MA           0x1801   /**<\brief Arabic (Morocco) */
+#define USB_LANGID_ARA_TN           0x1c01   /**<\brief Arabic (Tunisia) */
+#define USB_LANGID_ARA_OM           0x2001   /**<\brief Arabic (Oman) */
+#define USB_LANGID_ARA_YE           0x2401   /**<\brief Arabic (Yemen) */
+#define USB_LANGID_ARA_SY           0x2801   /**<\brief Arabic (Syria) */
+#define USB_LANGID_ARA_JO           0x2c01   /**<\brief Arabic (Jordan) */
+#define USB_LANGID_ARA_LB           0x3001   /**<\brief Arabic (Lebanon) */
+#define USB_LANGID_ARA_KW           0x3401   /**<\brief Arabic (Kuwait) */
+#define USB_LANGID_ARA_AE           0x3801   /**<\brief Arabic (U.A.E.) */
+#define USB_LANGID_ARA_BH           0x3c01   /**<\brief Arabic (Bahrain) */
+#define USB_LANGID_ARA_QA           0x4001   /**<\brief Arabic (Qatar) */
+#define USB_LANGID_HYE              0x042b   /**<\brief Armenian */
+#define USB_LANGID_ASM              0x044d   /**<\brief Assamese */
+#define USB_LANGID_AZE_LAT          0x042c   /**<\brief Azeri (Latin) */
+#define USB_LANGID_AZE_CYR          0x082c   /**<\brief Azeri (Cyrillic) */
+#define USB_LANGID_EUS              0x042d   /**<\brief Basque */
+#define USB_LANGID_BEL              0x0423   /**<\brief Belarussian */
+#define USB_LANGID_BEN              0x0445   /**<\brief Bengali */
+#define USB_LANGID_BUL              0x0402   /**<\brief Bulgarian */
+#define USB_LANGID_MYA              0x0455   /**<\brief Burmese */
+#define USB_LANGID_CAT              0x0403   /**<\brief Catalan */
+#define USB_LANGID_ZHO_TW           0x0404   /**<\brief Chinese (Taiwan) */
+#define USB_LANGID_ZHO_CN           0x0804   /**<\brief Chinese (PRC) */
+#define USB_LANGID_ZHO_HK           0x0c04   /**<\brief Chinese (Hong Kong SAR, PRC) */
+#define USB_LANGID_ZHO_SG           0x1004   /**<\brief Chinese (Singapore) */
+#define USB_LANGID_ZHO_MO           0x1404   /**<\brief Chinese (Macau SAR) */
+#define USB_LANGID_HRV              0x041a   /**<\brief Croatian */
+#define USB_LANGID_CZE              0x0405   /**<\brief Czech */
+#define USB_LANGID_DAN              0x0406   /**<\brief Danish */
+#define USB_LANGID_NLD_NL           0x0413   /**<\brief Dutch (Netherlands) */
+#define USB_LANGID_NLD_BE           0x0813   /**<\brief Dutch (Belgium) */
+#define USB_LANGID_ENG_US           0x0409   /**<\brief English (United States) */
+#define USB_LANGID_ENG_UK           0x0809   /**<\brief English (United Kingdom) */
+#define USB_LANGID_ENG_AU           0x0c09   /**<\brief English (Australian) */
+#define USB_LANGID_ENG_CA           0x1009   /**<\brief English (Canadian) */
+#define USB_LANGID_ENG_NZ           0x1409   /**<\brief English (New Zealand) */
+#define USB_LANGID_ENG_IE           0x1809   /**<\brief English (Ireland) */
+#define USB_LANGID_ENG_ZA           0x1c09   /**<\brief English (South Africa) */
+#define USB_LANGID_ENG_JM           0x2009   /**<\brief English (Jamaica) */
+#define USB_LANGID_ENG_CAR          0x2409   /**<\brief English (Caribbean) */
+#define USB_LANGID_ENG_BZ           0x2809   /**<\brief English (Belize) */
+#define USB_LANGID_ENG_TH           0x2c09   /**<\brief English (Trinidad) */
+#define USB_LANGID_ENG_ZW           0x3009   /**<\brief English (Zimbabwe) */
+#define USB_LANGID_ENG_PH           0x3409   /**<\brief English (Philippines) */
+#define USB_LANGID_EST              0x0425   /**<\brief Estonian */
+#define USB_LANGID_FAO              0x0438   /**<\brief Faeroese */
+#define USB_LANGID_FAS              0x0429   /**<\brief Farsi */
+#define USB_LANGID_FIN              0x040b   /**<\brief Finnish */
+#define USB_LANGID_FRA              0x040c   /**<\brief French (Standard) */
+#define USB_LANGID_FRA_BE           0x080c   /**<\brief French (Belgian) */
+#define USB_LANGID_FRA_CA           0x0c0c   /**<\brief French (Canadian) */
+#define USB_LANGID_FRA_SZ           0x100c   /**<\brief French (Switzerland) */
+#define USB_LANGID_FRA_LU           0x140c   /**<\brief French (Luxembourg) */
+#define USB_LANGID_FRA_MC           0x180c   /**<\brief French (Monaco) */
+#define USB_LANGID_KAT              0x0437   /**<\brief Georgian */
+#define USB_LANGID_DEU              0x0407   /**<\brief German (Standard) */
+#define USB_LANGID_DEU_SZ           0x0807   /**<\brief German (Switzerland) */
+#define USB_LANGID_DEU_AT           0x0c07   /**<\brief German (Austria) */
+#define USB_LANGID_DEU_LU           0x1007   /**<\brief German (Luxembourg) */
+#define USB_LANGID_DEU_LI           0x1407   /**<\brief German (Liechtenstein) */
+#define USB_LANGID_ELL              0x0408   /**<\brief Greek */
+#define USB_LANGID_GUJ              0x0447   /**<\brief Gujarati */
+#define USB_LANGID_HEB              0x040d   /**<\brief Hebrew */
+#define USB_LANGID_HIN              0x0439   /**<\brief Hindi */
+#define USB_LANGID_HUN              0x040e   /**<\brief Hungarian */
+#define USB_LANGID_ISL              0x040f   /**<\brief Icelandic */
+#define USB_LANGID_IND              0x0421   /**<\brief Indonesian */
+#define USB_LANGID_ITA              0x0410   /**<\brief Italian (Standard) */
+#define USB_LANGID_ITA_SZ           0x0810   /**<\brief Italian (Switzerland) */
+#define USB_LANGID_JPN              0x0411   /**<\brief Japanese */
+#define USB_LANGID_KAN              0x044b   /**<\brief Kannada */
+#define USB_LANGID_KAS              0x0860   /**<\brief Kashmiri (India) */
+#define USB_LANGID_KAZ              0x043f   /**<\brief Kazakh */
+#define USB_LANGID_KOK              0x0457   /**<\brief Konkani */
+#define USB_LANGID_KOR              0x0412   /**<\brief Korean */
+#define USB_LANGID_KOR_JOH          0x0812   /**<\brief Korean (Johab) */
+#define USB_LANGID_LAV              0x0426   /**<\brief Latvian */
+#define USB_LANGID_LIT              0x0427   /**<\brief Lithuanian */
+#define USB_LANGID_LIT_CLS          0x0827   /**<\brief Lithuanian (Classic) */
+#define USB_LANGID_MKD              0x042f   /**<\brief Macedonian */
+#define USB_LANGID_MSA              0x043e   /**<\brief Malay (Malaysian) */
+#define USB_LANGID_MSA_BN           0x083e   /**<\brief Malay (Brunei Darussalam) */
+#define USB_LANGID_MAL              0x044c   /**<\brief Malayalam */
+#define USB_LANGID_MNI              0x0458   /**<\brief Manipuri */
+#define USB_LANGID_MAR              0x044e   /**<\brief Marathi */
+#define USB_LANGID_NEP              0x0861   /**<\brief Nepali (India) */
+#define USB_LANGID_NOB              0x0414   /**<\brief Norwegian (Bokmal) */
+#define USB_LANGID_NNO              0x0814   /**<\brief Norwegian (Nynorsk) */
+#define USB_LANGID_ORI              0x0448   /**<\brief Oriya */
+#define USB_LANGID_POL              0x0415   /**<\brief Polish */
+#define USB_LANGID_POR_BR           0x0416   /**<\brief Portuguese (Brazil) */
+#define USB_LANGID_POR              0x0816   /**<\brief Portuguese (Standard) */
+#define USB_LANGID_PAN              0x0446   /**<\brief Punjabi */
+#define USB_LANGID_RON              0x0418   /**<\brief Romanian */
+#define USB_LANGID_RUS              0x0419   /**<\brief Russian */
+#define USB_LANGID_SAN              0x044f   /**<\brief Sanskrit */
+#define USB_LANGID_SRB_CYR          0x0c1a   /**<\brief Serbian (Cyrillic) */
+#define USB_LANGID_SRB_LAT          0x081a   /**<\brief Serbian (Latin) */
+#define USB_LANGID_SND              0x0459   /**<\brief Sindhi */
+#define USB_LANGID_SLK              0x041b   /**<\brief Slovak */
+#define USB_LANGID_SLV              0x0424   /**<\brief Slovenian */
+#define USB_LANGID_SPA              0x040a   /**<\brief Spanish (Traditional Sort) */
+#define USB_LANGID_SPA_MX           0x080a   /**<\brief Spanish (Mexican) */
+#define USB_LANGID_SPA_MDN          0x0c0a   /**<\brief Spanish (Modern Sort) */
+#define USB_LANGID_SPA_GT           0x100a   /**<\brief Spanish (Guatemala) */
+#define USB_LANGID_SPA_CR           0x140a   /**<\brief Spanish (Costa Rica) */
+#define USB_LANGID_SPA_PA           0x180a   /**<\brief Spanish (Panama) */
+#define USB_LANGID_SPA_DO           0x1c0a   /**<\brief Spanish (Dominican Republic) */
+#define USB_LANGID_SPA_VE           0x200a   /**<\brief Spanish (Venezuela) */
+#define USB_LANGID_SPA_CO           0x240a   /**<\brief Spanish (Colombia) */
+#define USB_LANGID_SPA_PE           0x280a   /**<\brief Spanish (Peru) */
+#define USB_LANGID_SPA_AR           0x2c0a   /**<\brief Spanish (Argentina) */
+#define USB_LANGID_SPA_EC           0x300a   /**<\brief Spanish (Ecuador) */
+#define USB_LANGID_SPA_CL           0x340a   /**<\brief Spanish (Chile) */
+#define USB_LANGID_SPA_UY           0x380a   /**<\brief Spanish (Uruguay) */
+#define USB_LANGID_SPA_PY           0x3c0a   /**<\brief Spanish (Paraguay) */
+#define USB_LANGID_SPA_BO           0x400a   /**<\brief Spanish (Bolivia) */
+#define USB_LANGID_SPA_SV           0x440a   /**<\brief Spanish (El Salvador) */
+#define USB_LANGID_SPA_HN           0x480a   /**<\brief Spanish (Honduras) */
+#define USB_LANGID_SPA_NI           0x4c0a   /**<\brief Spanish (Nicaragua) */
+#define USB_LANGID_SPA_PR           0x500a   /**<\brief Spanish (Puerto Rico) */
+#define USB_LANGID_NSO              0x0430   /**<\brief Sutu, Sotho. */
+#define USB_LANGID_SWA              0x0441   /**<\brief Swahili (Kenya) */
+#define USB_LANGID_SWE              0x041d   /**<\brief Swedish */
+#define USB_LANGID_SWE_FI           0x081d   /**<\brief Swedish (Finland) */
+#define USB_LANGID_TAM              0x0449   /**<\brief Tamil */
+#define USB_LANGID_TAT              0x0444   /**<\brief Tatar (Tatarstan) */
+#define USB_LANGID_TEL              0x044a   /**<\brief Telugu */
+#define USB_LANGID_THA              0x041e   /**<\brief Thai */
+#define USB_LANGID_TUR              0x041f   /**<\brief Turkish */
+#define USB_LANGIG_UKR              0x0422   /**<\brief Ukrainian */
+#define USB_LANGID_URD_PK           0x0420   /**<\brief Urdu (Pakistan) */
+#define USB_LANGID_URD_IN           0x0820   /**<\brief Urdu (India) */
+#define USB_LANGID_UZB_LAT          0x0443   /**<\brief Uzbek (Latin) */
+#define USB_LANGID_UZB_CYR          0x0843   /**<\brief Uzbek (Cyrillic) */
+#define USB_LANGID_VIE              0x042a   /**<\brief Vietnamese */
 /** @} */
 
-/** \brief common USB descriptor header */
+/**\brief common USB descriptor header */
 struct usb_header_descriptor {
-    uint8_t bLength;                /**< Size of the descriptor, in bytes. */
-    uint8_t bDescriptorType;        /**< Type of the descriptor. */
+    uint8_t bLength;                /**<\brief Size of the descriptor, in bytes. */
+    uint8_t bDescriptorType;        /**<\brief Type of the descriptor. */
 } __attribute__((packed));
 
-/** \brief Represents a USB device descriptor
- *  \details A device descriptor describes general information about a USB device. It includes information that applies
- *           globally to the device and all of the device’s configurations. A USB device has only one device descriptor.
- *           A high-speed capable device that has different device information for full-speed and high-speed must also
- *           have a \ref usb_qualifier_descriptor
- */
+/**\brief Represents a USB device descriptor
+ * \details A device descriptor describes general information about a USB device. It includes
+ * information that applies globally to the device and all of the device’s configurations. A USB
+ * device has only one device descriptor. A high-speed capable device that has different device
+ * information for full-speed and high-speed must also  have a \ref usb_qualifier_descriptor.*/
 struct usb_device_descriptor {
-    uint8_t  bLength;               /**< Size of the descriptor, in bytes. */
-    uint8_t  bDescriptorType;       /**< Type of the descriptor, must be a \ref USB_DTYPE_DEVICE. */
-    uint16_t bcdUSB;                /**< BCD of the supported USB specification. \ref VERSION_BCD utility macro. */
-    uint8_t  bDeviceClass;          /**< USB device class. */
-    uint8_t  bDeviceSubClass;       /**< USB device subclass. */
-    uint8_t  bDeviceProtocol;       /**< USB device protocol. */
-    uint8_t  bMaxPacketSize0;       /**< Size of the control (address 0) endpoint's bank in bytes. */
-    uint16_t idVendor;              /**< Vendor ID for the USB product. */
-    uint16_t idProduct;             /**< Unique product ID for the USB product. */
-    uint16_t bcdDevice;             /**< Product release (version) number. \ref VERSION_BCD utility macro. */
-    uint8_t  iManufacturer;         /**< String index for the manufacturer's name. */
-    uint8_t  iProduct;              /**< String index for the product name/details. */
-    uint8_t  iSerialNumber;         /**< String index for the product serial number, \ref INTSERIALNO_DESCRIPTOR can be used*/
-    uint8_t  bNumConfigurations;    /**< Total number of configurations supported by the device. */
+    uint8_t  bLength;               /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t  bDescriptorType;       /**<\brief \ref USB_DTYPE_DEVICE Device descriptor.*/
+    uint16_t bcdUSB;                /**<\brief BCD of the supported USB specification.*/
+    uint8_t  bDeviceClass;          /**<\brief USB device class.*/
+    uint8_t  bDeviceSubClass;       /**<\brief USB device subclass.*/
+    uint8_t  bDeviceProtocol;       /**<\brief USB device protocol.*/
+    uint8_t  bMaxPacketSize0;       /**<\brief Size of the control endpoint's bank in bytes.*/
+    uint16_t idVendor;              /**<\brief Vendor ID for the USB product.*/
+    uint16_t idProduct;             /**<\brief Unique product ID for the USB product.*/
+    uint16_t bcdDevice;             /**<\brief Product release (version) number.*/
+    uint8_t  iManufacturer;         /**<\brief String index for the manufacturer's name.*/
+    uint8_t  iProduct;              /**<\brief String index for the product name/details.*/
+    uint8_t  iSerialNumber;         /**<\brief String index for the product serial number.*/
+    uint8_t  bNumConfigurations;    /**<\brief Total number of configurations supported by the device.*/
 } __attribute__((packed));
 
-/** \brief USB device qualifier descriptor
- *  \details The device_qualifier descriptor describes information about a high-speed capable device that would
- *           change if the device were operating at the other speed. For example, if the device is currently operating
- *           at full-speed, the device qualifier returns information about how it would operate at high-speed and vice-versa.
- */
+/**\brief USB device qualifier descriptor
+ * \details The device_qualifier descriptor describes information about a high-speed capable device
+ * that would change if the device were operating at the other speed. For example, if the device is
+ * currently operating at full-speed, the device qualifier returns information about how it would
+ * operate at high-speed and vice-versa.*/
 struct usb_qualifier_descriptor {
-    uint8_t  bLength;               /**< Size of the descriptor, in bytes. */
-    uint8_t  bDescriptorType;       /**< Type of the descriptor, must be a \ref USB_DTYPE_QUALIFIER. */
-    uint16_t bcdUSB;                /**< BCD of the supported USB specification. \ref VERSION_BCD utility macro. */
-    uint8_t  bDeviceClass;          /**< USB device class. */
-    uint8_t  bDeviceSubClass;       /**< USB device subclass. */
-    uint8_t  bDeviceProtocol;       /**< USB device protocol. */
-    uint8_t  bMaxPacketSize0;       /**< Size of the control (address 0) endpoint's bank in bytes. */
-    uint8_t  bNumConfigurations;    /**< Total number of configurations supported by the device. */
-    uint8_t  bReserved;             /**< Reserved for future use, must be 0. */
+    uint8_t  bLength;               /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t  bDescriptorType;       /**<\brief Qualifier descriptor.*/
+    uint16_t bcdUSB;                /**<\brief BCD of the supported USB specification.*/
+    uint8_t  bDeviceClass;          /**<\brief USB device class.*/
+    uint8_t  bDeviceSubClass;       /**<\brief USB device subclass.*/
+    uint8_t  bDeviceProtocol;       /**<\brief USB device protocol.*/
+    uint8_t  bMaxPacketSize0;       /**<\brief Size of the control endpoint's bank in bytes.*/
+    uint8_t  bNumConfigurations;    /**<\brief Total number of configurations supported by the device.*/
+    uint8_t  bReserved;             /**<\brief Reserved for future use, must be 0.*/
 } __attribute__((packed));
-/** \brief USB device configuration descriptor
- *  \details The configuration descriptor describes information about a specific device configuration. The descriptor
- *           contains a bConfigurationValue field with a value that, when used as a parameter to the SetConfiguration()
- *           request, causes the device to assume the described configuration.
- */
+
+/**\brief USB device configuration descriptor
+ * \details The configuration descriptor describes information about a specific device configuration.
+ * The descriptor contains a bConfigurationValue field with a value that, when used as a parameter
+ * to the SetConfiguration() request, causes the device to assume the described configuration.*/
 struct usb_config_descriptor {
-    uint8_t  bLength;               /**< Size of the descriptor, in bytes. */
-    uint8_t  bDescriptorType;       /**< Type of the descriptor, must be a \ref USB_DTYPE_CONFIGURATION. */
-    uint16_t wTotalLength;          /**< Size of the configuration descriptor header, and all sub descriptors inside the configuration. */
-    uint8_t  bNumInterfaces;        /**< Total number of interfaces in the configuration. */
-    uint8_t  bConfigurationValue;   /**< Configuration index of the current configuration. */
-    uint8_t  iConfiguration;        /**< Index of a string descriptor describing the configuration. */
-    uint8_t  bmAttributes;          /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks. On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. */
-    uint8_t  bMaxPower;             /**< Maximum power consumption of the device while in the current configuration, calculated by the \ref USB_CFG_POWER_MA() macro. */
+    uint8_t  bLength;               /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t  bDescriptorType;       /**<\brief Configuration descriptor.*/
+    uint16_t wTotalLength;          /**<\brief Size of the configuration descriptor header, and all
+                                     * sub descriptors inside the configuration. */
+    uint8_t  bNumInterfaces;        /**<\brief Total number of interfaces in the configuration.*/
+    uint8_t  bConfigurationValue;   /**<\brief Configuration index of the current configuration.*/
+    uint8_t  iConfiguration;        /**<\brief Index of a string descriptor describing the configuration.*/
+    uint8_t  bmAttributes;          /**<\brief Configuration attributes.
+                                     * \details Comprised of a mask of \c USB_CONFIG_ATTR_ masks. On
+                                     * all devices, this should include USB_CONFIG_ATTR_RESERVED at
+                                     * a minimum. */
+    uint8_t  bMaxPower;             /**<\brief Maximum power consumption of the device.
+                                     * \ref USB_CFG_POWER_MA() macro.*/
 } __attribute__((packed));
-/** \brief USB interface descriptor
- *  \details The interface descriptor describes a specific interface within a configuration. A configuration provides one or more interfaces,
- *           each with zero or more endpoint descriptors describing a unique set of endpoints within the configuration.
- */
+
+/**\brief USB interface descriptor
+ * \details The interface descriptor describes a specific interface within a configuration. A
+ *configuration provides one or more interfaces, each with zero or more endpoint descriptors
+ * describing a unique set of endpoints within the configuration.*/
 struct usb_interface_descriptor {
-    uint8_t bLength;                /**< Size of the descriptor, in bytes. */
-    uint8_t bDescriptorType;        /**< Type of the descriptor, must be \ref USB_DTYPE_INTERFACE */
-    uint8_t bInterfaceNumber;       /**< Index of the interface in the current configuration. */
-    uint8_t bAlternateSetting;      /**< Alternate setting for the interface number. */
-    uint8_t bNumEndpoints;          /**< Total number of endpoints in the interface. */
-    uint8_t bInterfaceClass;        /**< Interface class ID. */
-    uint8_t bInterfaceSubClass;     /**< Interface subclass ID. */
-    uint8_t bInterfaceProtocol;     /**< Interface protocol ID. */
-    uint8_t iInterface;             /**< Index of the string descriptor describing the interface. */
+    uint8_t bLength;                /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t bDescriptorType;        /**<\brief Interface descriptor.*/
+    uint8_t bInterfaceNumber;       /**<\brief Index of the interface in the current configuration.*/
+    uint8_t bAlternateSetting;      /**<\brief Alternate setting for the interface number.*/
+    uint8_t bNumEndpoints;          /**<\brief Total number of endpoints in the interface.*/
+    uint8_t bInterfaceClass;        /**<\brief Interface class ID.*/
+    uint8_t bInterfaceSubClass;     /**<\brief Interface subclass ID.*/
+    uint8_t bInterfaceProtocol;     /**<\brief Interface protocol ID. */
+    uint8_t iInterface;             /**<\brief Index of the string descriptor describing the interface. */
 } __attribute__((packed));
+
+/**\brief USB interface association descriptor
+ * \details USB interface association descriptor (IAD) allows the device to group interfaces that
+ * belong to a function.*/
 struct usb_iad_descriptor {
-    uint8_t bLength;                /**< Size of the descriptor, in bytes. */
-    uint8_t bDescriptorType;        /**< Type of the descriptor, either a value in */
-    uint8_t bFirstInterface;        /**< Index of the first associated interface. */
-    uint8_t bInterfaceCount;        /**< Total number of associated interfaces. */
-    uint8_t bFunctionClass;         /**< Interface class ID. */
-    uint8_t bFunctionSubClass;      /**< Interface subclass ID. */
-    uint8_t bFunctionProtocol;      /**< Interface protocol ID. */
-    uint8_t iFunction;              /**< Index of the string descriptor describing the interface association. */
+    uint8_t bLength;                /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t bDescriptorType;        /**<\brief IAD descriptor */
+    uint8_t bFirstInterface;        /**<\brief Index of the first associated interface. */
+    uint8_t bInterfaceCount;        /**<\brief Total number of associated interfaces. */
+    uint8_t bFunctionClass;         /**<\brief Function class ID. */
+    uint8_t bFunctionSubClass;      /**<\brief Function subclass ID. */
+    uint8_t bFunctionProtocol;      /**<\brief Function protocol ID. */
+    uint8_t iFunction;              /**<\brief Index of the string descriptor describing the
+                                     * interface association. */
 } __attribute__((packed));
-/** \brief USB endpoint descriptor
- *  \details This descriptor contains the information required by the host to determine the bandwidth requirements of each endpoint.
- */
+
+/**\brief USB endpoint descriptor
+ * \details This descriptor contains the information required by the host to determine the bandwidth
+ * requirements of each endpoint.*/
 struct usb_endpoint_descriptor {
-    uint8_t  bLength;               /**< Size of the descriptor, in bytes. */
-    uint8_t  bDescriptorType;       /**< Type of the descriptor, must be \ref USB_DTYPE_ENDPOINT */
-    uint8_t  bEndpointAddress;      /**< Logical address of the endpoint within the device for the current configuration, including direction mask. */
-    uint8_t  bmAttributes;          /**< Endpoint attributes, \ref USB_ENDPOINT_DEF. */
-    uint16_t wMaxPacketSize;        /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size that the endpoint can receive at a time. */
-    uint8_t  bInterval;             /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or ISOCHRONOUS type. */
+    uint8_t  bLength;               /**<\brief Size of the descriptor, in bytes. */
+    uint8_t  bDescriptorType;       /**<\brief Endpoint descriptor.*/
+    uint8_t  bEndpointAddress;      /**<\brief Logical address of the endpoint within the device for
+                                     * the current configuration, including direction mask. */
+    uint8_t  bmAttributes;          /**<\brief Endpoint attributes, \ref USB_ENDPOINT_DEF. */
+    uint16_t wMaxPacketSize;        /**<\brief Size of the endpoint bank, in bytes. This indicates the
+                                     * maximum packet size that the endpoint can receive at a time. */
+    uint8_t  bInterval;             /**<\brief Polling interval in milliseconds for the endpoint if
+                                     * it is an INTERRUPT or ISOCHRONOUS type.*/
 } __attribute__((packed));
-/** \brief USB string descriptor
- *  \details String descriptors are referenced by their one-based index number. A string descriptor contains one or more not NULL-terminated Unicode strings.
- *  \note String descriptors are optional. if a device does not support string descriptors, all references to string descriptors within device, configuration,
- *        and interface descriptors must be reset to zero.
- */
+
+/**\brief USB string descriptor
+ * \details String descriptors are referenced by their one-based index number. A string descriptor
+ * contains one or more not NULL-terminated Unicode strings.
+ * \note String descriptors are optional. if a device does not support string descriptors, all
+ * references to string descriptors within device, configuration, and interface descriptors must be
+ * reset to zero.*/
 struct usb_string_descriptor {
-    uint8_t  bLength;               /**< Size of the descriptor, in bytes. */
-    uint8_t  bDescriptorType;       /**< Type of the descriptor, must be \ref USB_DTYPE_STRING */
-    uint16_t wString[];             /**< String data, as unicode characters (for zero-indexed descriptor, array of \ref USB_STD_LANGID ). */
+    uint8_t  bLength;               /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t  bDescriptorType;       /**<\brief String descriptor type.*/
+    uint16_t wString[];             /**<\brief String data, as unicode characters or array of
+                                     * \ref USB_STD_LANGID codes. */
 } __attribute__((packed));
-/** \brief USB debug descriptor
- *  \details This descriptor is used to describe certain characteristics of the device that the host debug port driver needs to know
- *           to communicate with the device. Specifically, the debug descriptor lists the addresses of the endpoints that comprise the
- *           Debug Pipe. The endpoints are identified by endpoint number.
- */
+
+/**\brief USB debug descriptor
+ * \details This descriptor is used to describe certain characteristics of the device that the host
+ * debug port driver needs to know to communicate with the device. Specifically, the debug descriptor
+ * lists the addresses of the endpoints that comprise the Debug Pipe. The endpoints are identified by
+ * endpoint number.*/
 struct usb_debug_descriptor {
-    uint8_t  bLength;               /**< Size of the descriptor, in bytes. */
-    uint8_t  bDescriptorType;       /**< Type ot the descriptor, must be \ref USB_DTYPE_DEBUG */
-    uint8_t  bDebugInEndpoint;      /**< Endpoint number of the Debug Data IN endpoint. This is a Bulk-type endpoint with a maximum packet size of 8 bytes.  */
-    uint8_t  bDebugOutEndpoint;     /**< Endpoint number of the Debug Data OUTendpoint. This is a Bulk-type endpoint with a maximum packet size of 8 bytes.  */
+    uint8_t  bLength;               /**<\brief Size of the descriptor, in bytes.*/
+    uint8_t  bDescriptorType;       /**<\brief Debug descriptor type.*/
+    uint8_t  bDebugInEndpoint;      /**<\brief Endpoint number of the Debug Data IN endpoint.*/
+    uint8_t  bDebugOutEndpoint;     /**<\brief Endpoint number of the Debug Data OUTendpoint.*/
 } __attribute__((packed));
 
-
 /** @} */
 
 #if defined (__cplusplus)

+ 194 - 192
inc/usbd_core.h

@@ -1,4 +1,4 @@
-/* This file is the part of the LUS32 project
+/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  *
  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  *
@@ -11,14 +11,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- */
-
-/** \file usbd_core.h
- * \brief Core and hardware driver framework.
- * \author Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
- * \version 1.0
- * \copyright Apache License, Version 2.0
- */
+.*/
 
 #ifndef _USBD_CORE_H_
 #define _USBD_CORE_H_
@@ -26,121 +19,152 @@
     extern "C" {
 #endif
 
-
-/** \addtogroup USBD_CORE USB device core
- * \brief Contains core and hardware driver framework definitions
+/**\addtogroup USBD_HW_CORE USB Device HW driver and core API
  * @{ */
-#define USB_EPTYPE_DBLBUF       0x04        /**< indicates a doublebuffered endpoint (bulk endpoint only) */
 
-/** \name bmRequestType bitmapped field
+/**\addtogroup USBD_HW USB hardware driver
+ * \brief Contains HW driver API 
  * @{ */
-#define USB_REQ_DIRECTION       (1 << 7)
-#define USB_REQ_HOSTTODEV       (0 << 7)
-#define USB_REQ_DEVTOHOST       (1 << 7)
-#define USB_REQ_TYPE            (3 << 5)
-#define USB_REQ_STANDARD        (0 << 5)
-#define USB_REQ_CLASS           (1 << 5)
-#define USB_REQ_VENDOR          (2 << 5)
-#define USB_REQ_RECIPIENT       (3 << 0)
-#define USB_REQ_DEVICE          (0 << 0)
-#define USB_REQ_INTERFACE       (1 << 0)
-#define USB_REQ_ENDPOINT        (2 << 0)
-#define USB_REQ_OTHER           (3 << 0)
-/** @} */
-
-/** \name USB device events
+/**\anchor USB_EVENTS
+ * \name USB device events
  * @{ */
-#define usbd_evt_reset      0   /**< Reset */
-#define usbd_evt_sof        1   /**< Start of frame */
-#define usbd_evt_susp       2   /**< Suspend */
-#define usbd_evt_wkup       3   /**< Wakeup */
-#define usbd_evt_eptx       4   /**< Data packet transmitted*/
-#define usbd_evt_eprx       5   /**< Data packet received */
-#define usbd_evt_epsetup    6   /**< Setup packet received */
-#define usbd_evt_error      7   /**< Data error */
-#define usbd_evt_esof       8   /**< Missed SOF */
+#define usbd_evt_reset      0   /**<\brief Reset.*/
+#define usbd_evt_sof        1   /**<\brief Start of frame.*/
+#define usbd_evt_susp       2   /**<\brief Suspend.*/
+#define usbd_evt_wkup       3   /**<\brief Wakeup.*/
+#define usbd_evt_eptx       4   /**<\brief Data packet transmitted*/
+#define usbd_evt_eprx       5   /**<\brief Data packet received.*/
+#define usbd_evt_epsetup    6   /**<\brief Setup packet received.*/
+#define usbd_evt_error      7   /**<\brief Data error.*/
+#define usbd_evt_esof       8   /**<\brief Missed SOF.*/
 #define usbd_evt_count      9
 /** @} */
 
-/**\anchor USB_LANE_STATUS
+/**\anchor USB_LANES_STATUS
  * \name USB lanes connection states
  * @{ */
-#define usbd_lane_unk       0   /**< Unknown or proprietary charger */
-#define usbd_lane_dsc       1   /**< Lanes disconnected */
-#define usbd_lane_sdp       2   /**< Connected to standard downstream port */
-#define usbd_lane_cdp       3   /**< Connected to charging downstream port */
-#define usbd_lane_dcp       4   /**< Connected to dedicated charging port */
+#define usbd_lane_unk       0   /**<\brief Unknown or proprietary charger.*/
+#define usbd_lane_dsc       1   /**<\brief Lanes disconnected.*/
+#define usbd_lane_sdp       2   /**<\brief Lanes connected to standard downstream port.*/
+#define usbd_lane_cdp       3   /**<\brief Lanes connected to charging downstream port.*/
+#define usbd_lane_dcp       4   /**<\brief Lanes connected to dedicated charging port.*/
 /** @} */
 
-
 /** \name USB HW capabilities
  * @{ */
-#define USBD_HW_ADDRFST     (1 << 0)    /**< Set address before STATUS_OUT */
-#define USBD_HW_BC          (1 << 1)    /**< Battery charging detection supported */
+#define USBD_HW_ADDRFST     (1 << 0)    /**<\brief Set address before STATUS_OUT.*/
+#define USBD_HW_BC          (1 << 1)    /**<\brief Battery charging detection supported.*/
+/** @} */
+/** @} */
+
+/**\addtogroup USBD_CORE USB device core
+ * \brief Contains core API 
+ * @{ */
+#define USB_EPTYPE_DBLBUF   0x04    /**<\brief Doublebuffered endpoint (bulk endpoint only).*/
+
+/**\name bmRequestType bitmapped field
+ * @{ */
+#define USB_REQ_DIRECTION   (1 << 7)    /**<\brief Request direction mask.*/
+#define USB_REQ_HOSTTODEV   (0 << 7)    /**<\brief Request direction is HOST to DEVICE.*/
+#define USB_REQ_DEVTOHOST   (1 << 7)    /**<\brief Request direction is DEVICE to HOST.*/
+#define USB_REQ_TYPE        (3 << 5)    /**<\brief Request type mask.*/
+#define USB_REQ_STANDARD    (0 << 5)    /**<\brief Standard request.*/
+#define USB_REQ_CLASS       (1 << 5)    /**<\brief Class specified request.*/
+#define USB_REQ_VENDOR      (2 << 5)    /**<\brief Vendor specified request.*/
+#define USB_REQ_RECIPIENT   (3 << 0)    /**<\brief Request recipient mask.*/
+#define USB_REQ_DEVICE      (0 << 0)    /**<\brief Request to device.*/
+#define USB_REQ_INTERFACE   (1 << 0)    /**<\brief Request to interface.*/
+#define USB_REQ_ENDPOINT    (2 << 0)    /**<\brief Request to endpoint.*/
+#define USB_REQ_OTHER       (3 << 0)    /**<\brief Other request.*/
 /** @} */
 
-#if !defined(__ASSEMBLER__)
 
-/** USB device machine states */
+#if !defined(__ASSEMBLER__)
+/**\brief USB device machine states.*/
 enum usbd_machine_state {
     usbd_state_disabled,
     usbd_state_disconnected,
-    usbd_state_default,         /**< Default */
-    usbd_state_addressed,       /**< Addressed */
-    usbd_state_configured,      /**< Configured */
+    usbd_state_default,         /**< Default.*/
+    usbd_state_addressed,       /**< Addressed.*/
+    usbd_state_configured,      /**< Configured.*/
 };
 
-/** USB device control endpoint machine state */
+/**\brief USB device control endpoint machine state.*/
 enum usbd_ctl_state {
-    usbd_ctl_idle,              /**< Idle. Awaiting for SETUP packet */
-    usbd_ctl_rxdata,            /**< RX. Receiving DATA-OUT payload */
-    usbd_ctl_txdata,            /**< TX. Transmitting DATA-IN payload */
-    usbd_ctl_ztxdata,           /**< TX. Transmitting DATA-IN payload. Zero length packet maybe required. */
-    usbd_ctl_lastdata,          /**< TX. Last DATA-IN packed passed to buffer. Awaiting for the TX completion */
-    usbd_ctl_statusin,          /**< STATUS-IN stage */
-    usbd_ctl_statusout,         /**< STATUS-OUT stage */
+    usbd_ctl_idle,              /**<\brief Idle stage. Awaiting for SETUP packet.*/
+    usbd_ctl_rxdata,            /**<\brief RX stage. Receiving DATA-OUT payload.*/
+    usbd_ctl_txdata,            /**<\brief TX stage. Transmitting DATA-IN payload.*/
+    usbd_ctl_ztxdata,           /**<\brief TX stage. Transmitting DATA-IN payload. Zero length
+                                 * packet maybe required..*/
+    usbd_ctl_lastdata,          /**<\brief TX stage. Last DATA-IN packed passed to buffer. Awaiting
+                                 * for the TX completion.*/
+    usbd_ctl_statusin,          /**<\brief STATUS-IN stage.*/
+    usbd_ctl_statusout,         /**<\brief STATUS-OUT stage.*/
 };
 
-/** Asynchronous device control commands  */
+/**\brief Asynchronous device control commands.*/
 enum usbd_commands {
-    usbd_cmd_enable,            /**< Enables device */
-    usbd_cmd_disable,           /**< Disables device */
-    usbd_cmd_connect,           /**< Connects device to host */
-    usbd_cmd_disconnect,        /**< Disconnects device from host */
-    usbd_cmd_reset,             /**< Resets device */
+    usbd_cmd_enable,            /**<\brief Enables device.*/
+    usbd_cmd_disable,           /**<\brief Disables device.*/
+    usbd_cmd_connect,           /**<\brief Connects device to host.*/
+    usbd_cmd_disconnect,        /**<\brief Disconnects device from host.*/
+    usbd_cmd_reset,             /**<\brief Resets device.*/
 };
 
-/** Reporting status results */
+/**\brief Reporting status results.*/
 typedef enum _usbd_respond {
-    usbd_fail,                  /**< Function has an error, STALLPID will be issued */
-    usbd_ack,                   /**< Function completes request accepted ZLP or data will be send */
-    usbd_nak,                   /**< Function is busy. NAK handshake */
+    usbd_fail,                  /**<\brief Function has an error, STALLPID will be issued.*/
+    usbd_ack,                   /**<\brief Function completes request accepted ZLP or data will be send.*/
+    usbd_nak,                   /**<\brief Function is busy. NAK handshake.*/
 } usbd_respond;
 
 typedef struct _usbd_device usbd_device;
-typedef struct _usbd_ctlreq usbd_ctlreq;
-typedef struct _usbd_status usbd_status;
 
-/** \addtogroup USB_CORE_API Core API functions
- * @{ */
- /** Generic USB device event callback for events and endpoints processing
+/**\brief Represents generic USB control request.*/
+typedef struct {
+    uint8_t     bmRequestType;  /**<\brief This bitmapped field identifies the characteristics of
+                                 * the specific request.*/
+    uint8_t     bRequest;       /**<\brief This field specifies the particular request.*/
+    uint16_t    wValue;         /**<\brief It is used to pass a parameter to the device, specific to
+                                 * the request.*/
+    uint16_t    wIndex;         /**<\brief It is used to pass a parameter to the device, specific to
+                                 * the request.*/
+    uint16_t    wLength;        /**<\brief This field specifies the length of the data transferred
+                                 * during the second phase of the control transfer.*/
+    uint8_t     data[];         /**<\brief Data payload.*/
+} usbd_ctlreq;
+
+/** USB device status data.*/
+typedef struct {
+    void        *data_buf;      /**<\brief Pointer to data buffer used for control requests.*/
+    void        *data_ptr;      /**<\brief Pointer to current data for control request.*/
+    uint16_t    data_count;     /**<\brief Count remained data for control request.*/
+    uint16_t    data_maxsize;   /**<\brief Size of the data buffer for control requests.*/
+    uint8_t     ep0size;        /**<\brief Size of the control endpoint.*/
+    uint8_t     device_cfg;     /**<\brief Current device configuration number.*/
+    uint8_t     device_state;   /**<\brief Current \ref usbd_machine_state.*/
+    uint8_t     control_state;  /**<\brief Current \ref usbd_ctl_state.*/
+} usbd_status;
+
+/**\brief Generic USB device event callback for events and endpoints processing
   * \param[in] dev pointer to USB device
-  * \param event \ref usbd_evt "USB event"
+  * \param event \ref USB_EVENTS "USB event"
   * \param ep active endpoint number
   * \note endpoints with same indexes i.e. 0x01 and 0x81 shares same callback.
   */
 typedef void (*usbd_evt_callback)(usbd_device *dev, uint8_t event, uint8_t ep);
 
-/** USB control transfer completed callback function.
+/**\brief USB control transfer completed callback function.
  * \param[in] dev pointer to USB device
  * \param[in] req pointer to usb request structure
- * \note When this callback will be completed usbd_device#complete_callback will be reseted to NULL
+ * \note usbd_device->complete_callback will be set to NULL after this callback completion.
  */
 typedef void (*usbd_rqc_callback)(usbd_device *dev, usbd_ctlreq *req);
 
-/** USB control callback function.
+/**\brief USB control callback function.
  * \details Uses for the control request processing.
- *          Some requests will be handled by core if callback don't process it (returns FALSE). If request was not processed STALL PID will be issued.
+ *          Some requests will be handled by core if callback don't process it (returns FALSE).
+ *            If request was not processed STALL PID will be issued.
  *          - GET_CONFIGURATION
  *          - SET_CONFIGURATION (passes to \ref usbd_cfg_callback)
  *          - GET_DESCRIPTOR (passes to \ref usbd_dsc_callback)
@@ -149,21 +173,22 @@ typedef void (*usbd_rqc_callback)(usbd_device *dev, usbd_ctlreq *req);
  *          - SET_ADDRESS
  * \param[in] dev points to USB device
  * \param[in] req points to usb control request
- * \param[out] *callback \ref usbd_rqc_callback "pointer to USB control transfer completed callback", default is NULL (no callback)
+ * \param[out] *callback USB control transfer completion callback, default is NULL (no callback)
  * \return usbd_respond status.
  */
 typedef usbd_respond (*usbd_ctl_callback)(usbd_device *dev, usbd_ctlreq *req, usbd_rqc_callback *callback);
 
-/** USB get descriptor callback function
+/**\brief USB get descriptor callback function
  * \details Called when GET_DESCRIPTOR request issued
  * \param[in] req pointer to usb control request structure
- * \param[in,out] address pointer to the descriptor in memory. Points to req->data by default. You can use this buffer.
+ * \param[in,out] address pointer to the descriptor in memory. Points to req->data by default. You 
+ * can use this buffer.
  * \param[in,out] dsize descriptor size. maximum buffer size by default.
  * \return usbd_ack if you passed the correct descriptor, usbd_fail otherwise.
  */
 typedef usbd_respond (*usbd_dsc_callback)(usbd_ctlreq *req, void **address, uint16_t *dsize);
 
-/** USB set configuration callback function
+/**\brief USB set configuration callback function
  * \details called when SET_CONFIGURATION request issued
  * \param[in] dev pointer to USB device
  * \param[in] cfg configuration number.
@@ -174,29 +199,29 @@ typedef usbd_respond (*usbd_cfg_callback)(usbd_device *dev, uint8_t cfg);
 
 /** @} */
 
-/**\addtogroup USB_HW_API Hardware driver API functions
+/**\addtogroup USBD_HW
  * @{ */
 
-/** Enables or disables USB hardware
- * \param enable Enables USB when TRUE disables otherwise
+/**\brief Enables or disables USB hardware
+ * \param enable Enables USB when TRUE disables otherwise.
  */
 typedef void (*usbd_hw_enable)(bool enable);
 
-/** Resets USB hardware */
+/**\brief Resets USB hardware.*/
 typedef void (*usbd_hw_reset)(void);
 
 /** Connects or disconnects USB hardware to/from usb host
  * \param connect Connects USB to host if TRUE, disconnects otherwise
- * \return lanes connection status. \ref USB_LANES_STATUS
+ * \return lanes connection status.
  */
 typedef uint8_t (*usbd_hw_connect)(bool connect);
 
-/** Sets USB hardware address
+/**\brief Sets USB hardware address
  * \param address USB address
  */
 typedef void (*usbd_hw_setaddr)(uint8_t address);
 
-/** Configures endpoint
+/**\brief Configures endpoint
  * \param ep endpoint address. Use USB_EPDIR_ macros to set endpoint direction
  * \param eptype endpoint type. Use USB_EPTYPE_* macros.
  * \param epsize endpoint size in bytes
@@ -204,13 +229,14 @@ typedef void (*usbd_hw_setaddr)(uint8_t address);
  */
 typedef bool (*usbd_hw_ep_config)(uint8_t ep, uint8_t eptype, uint16_t epsize);
 
-/** De-configures, cleans and disables endpoint
+/**\brief De-configures, cleans and disables endpoint
  * \param ep endpoint index
- * \note if you have two one-direction single-buffered endpoints with same index (i.e. 0x02 and 0x82) both will be deconfigured.
+ * \note if you have two one-direction single-buffered endpoints with same index (i.e. 0x02 and 0x82)
+ * both will be deconfigured.
  */
 typedef void (*usbd_hw_ep_deconfig)(uint8_t ep);
 
-/** Reads data from OUT or control endpoint
+/**\brief Reads data from OUT or control endpoint
  * \param ep endpoint index, should belong to OUT or CONTROL endpoint.
  * \param buf pointer to read buffer
  * \param blen size of the read buffer in bytes
@@ -218,7 +244,7 @@ typedef void (*usbd_hw_ep_deconfig)(uint8_t ep);
  */
 typedef int32_t (*usbd_hw_ep_read)(uint8_t ep, void *buf, uint16_t blen);
 
-/** Writes data to IN or control endpoint
+/**\brief Writes data to IN or control endpoint
  * \param ep endpoint index, hould belong to IN or CONTROL endpoint
  * \param buf pointer to data buffer
  * \param blen size of data will be written
@@ -233,95 +259,72 @@ typedef int32_t (*usbd_hw_ep_write)(uint8_t ep, void *buf, uint16_t blen);
  */
 typedef void (*usbd_hw_ep_setstall)(uint8_t ep, bool stall);
 
-/** Checks endpoint for stalled state
+/**\brief Checks endpoint for stalled state
  * \param ep endpoint address
  * \return TRUE if endpoint is stalled
  */
 typedef bool (*usbd_hw_ep_isstalled)(uint8_t ep);
 
-/** Polls USB hardware for the events
+/**\brief Polls USB hardware for the events
  * \param[in] dev pointer to usb device structure
- * \param drv_callback callback to event processing subroutine
+ * \param callback callback to event processing subroutine
  */
-typedef void (*usbd_hw_poll)(usbd_device *dev, usbd_evt_callback drv_callback);
+typedef void (*usbd_hw_poll)(usbd_device *dev, usbd_evt_callback callback);
 
-/** Gets frame number from usb hardware
- */
+/**\brief Gets frame number from usb hardware.*/
 typedef uint16_t (*usbd_hw_get_frameno)(void);
 
 
-/** Makes a string descriptor contains unique serial number from hardware ID's
+/**\brief Makes a string descriptor contains unique serial number from hardware ID's
  * \param[in] buffer pointer to buffer for the descriptor
  * \return of the descriptor in bytes
  */
 typedef uint16_t (*usbd_hw_get_serialno)(void *buffer);
 
-/** @} */
-
-/** Represents generic USB control request */
-struct _usbd_ctlreq {
-    uint8_t     bmRequestType;  /**< This bitmapped field identifies the characteristics of the specific request. */
-    uint8_t     bRequest;       /**< This field specifies the particular request. */
-    uint16_t    wValue;         /**< It is used to pass a parameter to the device, specific to the request. */
-    uint16_t    wIndex;         /**< It is used to pass a parameter to the device, specific to the request. */
-    uint16_t    wLength;        /**< This field specifies the length of the data transferred during the second phase of the control transfer */
-    uint8_t     data[];         /**< Data payload */
+/**\brief Represents a hardware USB driver call table.*/
+struct usbd_driver {
+    uint32_t                caps;               /**<\brief HW capabilities */
+    usbd_hw_enable          enable;             /**<\copybrief usbd_hw_enable */
+    usbd_hw_reset           reset;              /**<\copybrief usbd_hw_reset */
+    usbd_hw_connect         connect;            /**<\copybrief usbd_hw_connect */
+    usbd_hw_setaddr         setaddr;            /**<\copybrief usbd_hw_setaddr */
+    usbd_hw_ep_config       ep_config;          /**<\copybrief usbd_hw_ep_config */
+    usbd_hw_ep_deconfig     ep_deconfig;        /**<\copybrief usbd_hw_ep_deconfig */
+    usbd_hw_ep_read         ep_read;            /**<\copybrief usbd_hw_ep_read */
+    usbd_hw_ep_write        ep_write;           /**<\copybrief usbd_hw_ep_write */
+    usbd_hw_ep_setstall     ep_setstall;        /**<\copybrief usbd_hw_ep_setstall */
+    usbd_hw_ep_isstalled    ep_isstalled;       /**<\copybrief usbd_hw_ep_isstalled */
+    usbd_hw_poll            poll;               /**<\copybrief usbd_hw_poll */
+    usbd_hw_get_frameno     frame_no;           /**<\copybrief usbd_hw_get_frameno */
+    usbd_hw_get_serialno    get_serialno_desc;  /**<\copybrief usbd_hw_get_serialno */
 };
 
-/** USB device status data */
-struct _usbd_status {
-    void        *data_buf;      /**< Pointer to data buffer used for control requests */
-    void        *data_ptr;      /**< Pointer to current data for control request */
-    uint16_t    data_count;     /**< Count remained data for control request */
-    uint16_t    data_maxsize;   /**< Size of the data buffer for control requests */
-    uint8_t     ep0size;        /**< Size of the control endpoint */
-    uint8_t     device_cfg;     /**< Current device configuration number */
-    uint8_t     device_state;   /**< Current \ref usbd_machine_state */
-    uint8_t     control_state;  /**< Current \ref usbd_ctl_state */
-};
+/** @} */
 
-/** Represents a hardware USB driver call table */
-struct usbd_driver {
-    uint32_t                caps;               /**< HW capabilities **/
-    usbd_hw_enable          enable;             /**< \copydoc usbd_hw_enable */
-    usbd_hw_reset           reset;              /**< \copydoc usbd_hw_reset */
-    usbd_hw_connect         connect;            /**< \copydoc usbd_hw_connect */
-    usbd_hw_setaddr         setaddr;            /**< \copydoc usbd_hw_setaddr */
-    usbd_hw_ep_config       ep_config;          /**< \copydoc usbd_hw_ep_config */
-    usbd_hw_ep_deconfig     ep_deconfig;        /**< \copydoc usbd_hw_ep_deconfig */
-    usbd_hw_ep_read         ep_read;            /**< \copydoc usbd_hw_ep_read */
-    usbd_hw_ep_write        ep_write;           /**< \copydoc usbd_hw_ep_write */
-    usbd_hw_ep_setstall     ep_setstall;        /**< \copydoc usbd_hw_ep_setstall */
-    usbd_hw_ep_isstalled    ep_isstalled;       /**< \copydoc usbd_hw_ep_isstalled */
-    usbd_hw_poll            poll;               /**< \copydoc usbd_hw_poll */
-    usbd_hw_get_frameno     frame_no;           /**< \copydoc usbd_hw_get_frameno */
-    usbd_hw_get_serialno    get_serialno_desc;  /**< \copydoc usbd_hw_get_serialno */
-};
+/**\addtogroup USBD_CORE
+ * @{ */
 
-/** Represents a USB device data.
- */
+/**\brief Represents a USB device data.*/
 struct _usbd_device {
-    const struct usbd_driver    *driver;
-    usbd_ctl_callback           control_callback;           /**< \copydoc usbd_ctl_callback */
-    usbd_rqc_callback           complete_callback;          /**< \copydoc usbd_rqc_callback */
-    usbd_cfg_callback           config_callback;            /**< \copydoc usbd_cfg_callback */
-    usbd_dsc_callback           descriptor_callback;        /**< \copydoc usbd_dsc_callback */
-    usbd_evt_callback           events[usbd_evt_count];     /**< events callbacks array */
-    usbd_evt_callback           endpoint[8];                /**< endpoint callbacks array for tx, rx and setup events */
-    usbd_status                 status;                     /**< \copydoc _usbd_status */
+    const struct usbd_driver    *driver;                /**<\copybrief usbd_driver */
+    usbd_ctl_callback           control_callback;       /**<\copybrief usbd_ctl_callback */
+    usbd_rqc_callback           complete_callback;      /**<\copybrief usbd_rqc_callback */
+    usbd_cfg_callback           config_callback;        /**<\copybrief usbd_cfg_callback */
+    usbd_dsc_callback           descriptor_callback;    /**<\copybrief usbd_dsc_callback */
+    usbd_evt_callback           events[usbd_evt_count]; /**<\brief array of the event callbacks.*/
+    usbd_evt_callback           endpoint[8];            /**<\brief array of the endpoint callbacks.*/
+    usbd_status                 status;                 /**<\copybrief usbd_status */
 };
 
-/** \addtogroup USB_CORE_API
- * @{ */
-
-/** Initializes device structure
+/**\brief Initializes device structure
  * \param dev USB device that will be initialized
  * \param drv Pointer to hardware driver
  * \param ep0size Control endpoint 0 size
  * \param buffer Pointer to control request data buffer (32-bit aligned)
  * \param bsize Size of the data buffer
  */
-inline static void usbd_init(usbd_device *dev, const struct usbd_driver *drv, const uint8_t ep0size, uint32_t *buffer, const uint16_t bsize) {
+inline static void usbd_init(usbd_device *dev, const struct usbd_driver *drv,
+                             const uint8_t ep0size, uint32_t *buffer, const uint16_t bsize) {
     dev->driver = drv;
     dev->status.ep0size = ep0size;
     dev->status.data_ptr = buffer;
@@ -329,118 +332,118 @@ inline static void usbd_init(usbd_device *dev, const struct usbd_driver *drv, co
     dev->status.data_maxsize = bsize - __builtin_offsetof(usbd_ctlreq, data);
 }
 
-/** Polls USB for events
+/**\brief Polls USB for events
  * \param dev Pointer to device structure
  * \note can be called as from main routine as from USB interrupt
  */
 void usbd_poll(usbd_device *dev);
 
-/** Asynchronous device control
- * \param dev USB device
- * \param cmd control command
+/**\brief Asynchronous device control
+ * \param dev dev usb device \ref _usbd_device
+ * \param cmd Asynchronous control command
  */
 void usbd_control(usbd_device *dev, enum usbd_commands cmd) __attribute__((deprecated));
 
-/** Register callback for all control requests
- * \param dev pointer to \ref usbd_device structure
- * \param cb pointer to user \ref usbd_ctl_callback
+/**\brief Register callback for all control requests
+ * \param dev usb device \ref _usbd_device
+ * \param callback user control callback \ref usbd_ctl_callback
  */
 inline static void usbd_reg_control(usbd_device *dev, usbd_ctl_callback callback) {
     dev->control_callback = callback;
 }
 
-/** Register callback for SET_CONFIG control request
- * \param dev pointer to \ref usbd_device structure
- * \param cb pointer to user \ref usbd_cfg_callback
+/**\brief Register callback for SET_CONFIG control request
+ * \param dev dev usb device \ref _usbd_device
+ * \param callback pointer to user \ref usbd_cfg_callback
  */
 inline static void usbd_reg_config(usbd_device *dev, usbd_cfg_callback callback) {
     dev->config_callback = callback;
 }
 
-/** Register callback for GET_DESCRIPTOR control request
- * \param dev pointer to \ref usbd_device structure
- * \param cb pointer to user \ref usbd_ctl_callback
+/**\brief Register callback for GET_DESCRIPTOR control request
+ * \param dev dev usb device \ref _usbd_device
+ * \param callback pointer to user \ref usbd_ctl_callback
  */
 inline static void usbd_reg_descr(usbd_device *dev, usbd_dsc_callback callback) {
     dev->descriptor_callback = callback;
 }
 
-/** Configure endpoint
- * \param dev pointer to \ref usbd_device structure
+/**\brief Configure endpoint
+ * \param dev dev usb device \ref _usbd_device
  * \copydetails usbd_hw_ep_config
  */
 inline static bool usbd_ep_config(usbd_device *dev, uint8_t ep, uint8_t eptype, uint16_t epsize) {
     return dev->driver->ep_config(ep, eptype, epsize);
 }
 
-/** Deconfigure endpoint
- * \param dev pointer to \ref usbd_device structure
+/**\brief Deconfigure endpoint
+ * \param dev dev usb device \ref _usbd_device
  * \copydetails usbd_hw_ep_deconfig
  */
 inline static void usbd_ep_deconfig(usbd_device *dev, uint8_t ep) {
     dev->driver->ep_deconfig(ep);
 }
 
-/** Register endpoint callback
- * \param dev pointer to \ref usbd_device structure
+/**\brief Register endpoint callback
+ * \param dev dev usb device \ref _usbd_device
  * \param ep endpoint index
- * \param cb pointer to user \ref usbd_evt_callback callback for endpoint events
+ * \param callback pointer to user \ref usbd_evt_callback callback for endpoint events
  */
 inline static void usbd_reg_endpoint(usbd_device *dev, uint8_t ep, usbd_evt_callback callback) {
     dev->endpoint[ep & 0x07] = callback;
 }
 
-/** Registers event callback
- * \param dev pointer to \ref usbd_device structure
- * \param evt device \ref usbd_evt "event" wants to be registered
- * \param cb pointer to user \ref usbd_evt_callback for this event
+/**\brief Registers event callback
+ * \param dev dev usb device \ref _usbd_device
+ * \param evt device \ref USB_EVENTS "event" wants to be registered
+ * \param callback pointer to user \ref usbd_evt_callback for this event
  */
 inline static void usbd_reg_event(usbd_device *dev, uint8_t evt, usbd_evt_callback callback) {
     dev->events[evt] = callback;
 }
 
-/** Write data to endpoint
- * \param dev pointer to \ref usbd_device structure
+/**\brief Write data to endpoint
+ * \param dev dev usb device \ref _usbd_device
  * \copydetails usbd_hw_ep_write
  */
 inline static int32_t usbd_ep_write(usbd_device *dev, uint8_t ep, void *buf, uint16_t blen) {
     return dev->driver->ep_write(ep, buf, blen);
 }
 
-/** Read data from endpoint
- * \param dev pointer to \ref usbd_device structure
+/**\brief Read data from endpoint
+ * \param dev dev usb device \ref _usbd_device
  * \copydetails usbd_hw_ep_read
  */
 inline static int32_t usbd_ep_read(usbd_device *dev, uint8_t ep, void *buf, uint16_t blen) {
     return dev->driver->ep_read(ep, buf, blen);
 }
 
-/** Stall endpoint
- * \param dev pointer to \ref usbd_device structure
+/**\brief Stall endpoint
+ * \param dev dev usb device \ref _usbd_device
  * \param ep endpoint address
  */
 inline static void usbd_ep_stall(usbd_device *dev, uint8_t ep) {
     dev->driver->ep_setstall(ep, 1);
 }
 
-/** Unstall endpoint
- * \param dev pointer to \ref usbd_device structure
+/**\brief Unstall endpoint
+ * \param dev dev usb device \ref _usbd_device
  * \param ep endpoint address
  */
 inline static void usbd_ep_unstall(usbd_device *dev, uint8_t ep) {
     dev->driver->ep_setstall(ep, 0);
 }
 
-/** Enables or disables USB hardware
- * \param dev pointer to \ref usbd_device structure
+/**\brief Enables or disables USB hardware
+ * \param dev dev usb device \ref _usbd_device
  * \param enable Enables USB when TRUE disables otherwise
  */
 inline static void usbd_enable(usbd_device *dev, bool enable) {
     dev->driver->enable(enable);
 }
 
-/** Connects or disconnects USB hardware to/from usb host
- * \param dev pointer to \ref usbd_device structure
+/**\brief Connects or disconnects USB hardware to/from usb host
+ * \param dev dev usb device \ref _usbd_device
  * \param connect Connects USB to host if TRUE, disconnects otherwise
  * \return lanes connection status. \ref USB_LANES_STATUS
  */
@@ -452,7 +455,6 @@ inline static uint8_t usbd_connect(usbd_device *dev, bool connect) {
 /** @} */
 /** @} */
 
-
 #if defined(__cplusplus)
     }
 #endif