summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/usb_types.h
blob: 019775a1c43ffbe27b68bc980fec810d92b26b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;