summaryrefslogtreecommitdiff
path: root/usb/dfu.h
blob: ed6c6c9595a618a57c0965f76a2f6b068a2192d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef DFU_H
#define DFU_H

struct DFU_Functional_desc {
	uint8_t bLength;
	uint8_t bDescriptorType;
	uint8_t bmAttributes;
	uint16_t wDetachTimeOut;
	uint16_t wTransferSize;
	uint16_t bcdDFUVersion;
} __attribute__((packed));

constexpr DFU_Functional_desc dfu_functional_desc(
		uint8_t bmAttributes,
		uint16_t wDetachTimeOut,
		uint16_t wTransferSize,
		uint16_t bcdDFUVersion
	) {
	
	return {
		sizeof(DFU_Functional_desc),
		0x21,
		bmAttributes,
		wDetachTimeOut,
		wTransferSize,
		bcdDFUVersion
	};
}

#endif