forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maintenance] USB HID control packet as struct (qmk#21688)
* ChibiOS: USB HID control request as dedicated struct Instead of accessing the raw USB setup packet and documenting the values as the corresponding USB HID control request fields we introduce a struct that allows direct access to the fields. This is safer and self documenting. * Rename usb_request.h to usb_types.h In the future all shared USB data types can live in this file.
- Loading branch information
Showing
2 changed files
with
82 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2023 Stefan Kerkmann | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#include "util.h" | ||
|
||
/** | ||
* @brief Common USB 2.0 control request structure | ||
*/ | ||
typedef struct { | ||
uint8_t bmRequestType; // [0] (Bitmask) | ||
uint8_t bRequest; // [1] | ||
union { | ||
struct { | ||
uint8_t lbyte; // [2] (LSB) | ||
uint8_t hbyte; // [3] (MSB) | ||
}; | ||
uint16_t word; // [2,3] (LSB,MSB) | ||
} wValue; | ||
uint16_t wIndex; // [4,5] (LSB,MSB) | ||
uint16_t wLength; // [6,7] (LSB,MSB) | ||
} PACKED usb_control_request_t; |