devanlai / dapboot

DFU Bootloader for STM32 chips
Other
339 stars 111 forks source link

Allow more flexibility when configuring from config.h #38

Closed obra closed 3 years ago

obra commented 3 years ago

In order to be able to override the VID and PID for a device from inside its config.h, config.h needs to be included before usb_conf.h

This lets you stick something like this in config.h and have it 'just work'


#define USB_VID 0x1209
#define USB_PID 0x2306

#define INNER_STRINGIFY(str) #str
#define STRINGIFY(str) INNER_STRINGIFY(str)

#define LANDING_PAGE_URL "dfu.keyboard.io?vid=" STRINGIFY(USB_VID) ";pid=" STRINGIFY(USB_PID)  ";version=" STRINGIFY(GIT_BUILD_SHA)
devanlai commented 3 years ago

This seems pretty reasonable to me and it builds cleanly.