Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set bcdDevice to 1.0 #14

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ BOARD ?= cynthion
BOARD_REVISION_MAJOR ?= 1
BOARD_REVISION_MINOR ?= 3

VERSION_MAJOR = 1
VERSION_MINOR = 0

CROSS=arm-none-eabi-

# Toolchain
Expand Down Expand Up @@ -44,7 +47,9 @@ CFLAGS += \
-D USB_MANUFACTURER_STR='"Saturn-V Project"' \
-D USB_PRODUCT_STR='$(PRODUCT_STRING)' \
-D_BOARD_REVISION_MAJOR_=$(BOARD_REVISION_MAJOR) \
-D_BOARD_REVISION_MINOR_=$(BOARD_REVISION_MINOR)
-D_BOARD_REVISION_MINOR_=$(BOARD_REVISION_MINOR) \
-D VERSION_MAJOR=$(VERSION_MAJOR) \
-D VERSION_MINOR=$(VERSION_MINOR)

# Header file search path
PRJ_PATH = deps
Expand Down
8 changes: 6 additions & 2 deletions usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ char* get_serial_number_string();

USB_ENDPOINTS(1);

#define BCD_ONES(x) (x % 10)
#define BCD_TENS(x) ((x / 10) % 10)
#define BCDDEVICE(x, y) (BCD_TENS(x)<<12 | BCD_ONES(x)<<8 | BCD_TENS(y)<<4 | BCD_ONES(y))

const USB_DeviceDescriptor device_descriptor = {
.bLength = sizeof(USB_DeviceDescriptor),
.bDescriptorType = USB_DTYPE_Device,
Expand All @@ -28,7 +32,7 @@ const USB_DeviceDescriptor device_descriptor = {
.bMaxPacketSize0 = 64,
.idVendor = 0x1d50,
.idProduct = 0x615c,
.bcdDevice = 0x0000,
.bcdDevice = BCDDEVICE(VERSION_MAJOR, VERSION_MINOR),

.iManufacturer = 0x01,
.iProduct = 0x02,
Expand Down Expand Up @@ -260,4 +264,4 @@ char *get_serial_number_string(void)

return buf;

}
}