Closed xsrf closed 7 months ago
Okay, I messed this one up. BOOTLOADER_BTN_PORT != USB_PORT
doesn't work as expected. I guess because both are undefined in the end as A
, C
or D
are not defined...
So I came up with this:
#define PORTIDA 0
#define PORTIDC 2
#define PORTIDD 3
#define LOCAL_CONCAT(A, B) A##B
#define LOCAL_EXP(A, B) LOCAL_CONCAT(A,B)
#define LOCAL_EQUALS(A, B) (LOCAL_CONCAT(PORTID,A) == LOCAL_CONCAT(PORTID,B))
// Then use it like this:
#if defined(BOOTLOADER_BTN_PORT) && LOCAL_EQUALS(BOOTLOADER_BTN_PORT, USB_PORT)
...
Is there an easier way? One without additional #define
s ? I couldn't get it to work with the existing GPIO_PortSourceGPIOx
...
This adds the option to configure a Button you have to press during boot to enter the Bootloader instead of (or in addition to) using Timeouts. The Pin can be configured freely and even be on a different Port than the USB. It can be set to be a floating input, or pulled up or down. The level that triggers the bootloader can also be configured.
While you can still use the Timeouts and USB Host detection feature from https://github.com/cnlohr/rv003usb/pull/39 together with the button, it makes sense to disable them. All features together won't fit the 1920 Bytes anymore.
This includes https://github.com/cnlohr/rv003usb/pull/39 and https://github.com/cnlohr/rv003usb/pull/38