BV: set version in USB serial string
This commit is contained in:
parent
c2a573ea65
commit
ee3d9c505a
|
@ -276,8 +276,8 @@ void main(void)
|
|||
// setup board
|
||||
board_setup(); // setup board
|
||||
uart_setup(); // setup USART (for printing)
|
||||
usb_cdcacm_setup(); // setup USB CDC ACM (for printing)
|
||||
busvoodoo_setup(); // setup BusVoodoo board
|
||||
usb_cdcacm_setup(); // setup USB CDC ACM (for printing)
|
||||
printf("\nwelcome to \x1b[32mBus\x1b[35mVoodoo\x1b[0m (%s)\n", busvoodoo_full ? "full" : "light"); // print welcome message
|
||||
|
||||
// setup terminal
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
/* own libraries */
|
||||
#include "global.h" // global utilities
|
||||
#include "usb_cdcacm.h" // USB CDC ACM header and definitions
|
||||
#include "busvoodoo_global.h" // to know version
|
||||
#include "print.h" // to set serial number based on version and ID
|
||||
|
||||
/** maximum packet size for USB data transfer */
|
||||
#define USB_DATA_TRANSFER_SIZE 64 // 64 is the maximum for full speed devices
|
||||
|
@ -435,6 +437,11 @@ static void usb_cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue)
|
|||
|
||||
void usb_cdcacm_setup(void)
|
||||
{
|
||||
// set serial
|
||||
static char serial[] = "H_YYYY-MM-DD_AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD";
|
||||
snprintf(serial, sizeof(serial), "%c_%04u-%02u-%02u_%08x%08x%08x", busvoodoo_version, BUILD_YEAR, BUILD_MONTH, BUILD_DAY, DESIG_UNIQUE_ID0, DESIG_UNIQUE_ID1, DESIG_UNIQUE_ID2);
|
||||
usb_strings[2] = serial;
|
||||
|
||||
// initialize USB
|
||||
rcc_periph_reset_pulse(RST_USB); // reset USB peripheral
|
||||
usb_disconnect(); // disconnect to force re-enumeration
|
||||
|
|
Loading…
Reference in New Issue