diff --git a/Makefile b/Makefile index 7ced991..72d3974 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,10 @@ BOARD ?= cynthion # These should default to the latest hardware revision but can be set on the command line. BOARD_REVISION_MAJOR ?= 1 -BOARD_REVISION_MINOR ?= 3 +BOARD_REVISION_MINOR ?= 4 + +VERSION_MAJOR = 1 +VERSION_MINOR = 0 CROSS=arm-none-eabi- @@ -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 diff --git a/usb.c b/usb.c index 5e26de4..9518a05 100644 --- a/usb.c +++ b/usb.c @@ -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, @@ -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, @@ -260,4 +264,4 @@ char *get_serial_number_string(void) return buf; -} \ No newline at end of file +}