File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,29 @@ static const uint8_t SCK = PIN_SPI_SCK;
139139
140140#define SERIAL_CDC 1
141141#define HAS_UNIQUE_ISERIAL_DESCRIPTOR
142- #define BOARD_VENDORID 0x2341
143- #define BOARD_PRODUCTID 0x0264
142+
143+ // Use these only if bootloader data is not available / valid
144+ #define _BOARD_VENDORID 0x2341
145+ #define _BOARD_PRODUCTID 0x0264
146+
147+ static uint8_t * bootloader_data = (uint8_t * )(0x801F000 );
148+ static inline bool _isBootloaderDataValid () {
149+ return bootloader_data [0 ] == 0xA0 ;
150+ }
151+ static inline uint16_t _getVid_ () {
152+ if (_isBootloaderDataValid ()) {
153+ return bootloader_data [1 ] | ((uint16_t )bootloader_data [2 ] << 8 );
154+ } else {
155+ return _BOARD_VENDORID ;
156+ }
157+ }
158+ static inline uint16_t _getPid_ () {
159+ if (_isBootloaderDataValid ()) {
160+ return bootloader_data [3 ] | ((uint16_t )bootloader_data [4 ] << 8 );
161+ } else {
162+ return _BOARD_PRODUCTID ;
163+ }
164+ }
144165#define BOARD_NAME "Arduino Opta"
145166
146167#define DFU_MAGIC_SERIAL_ONLY_RESET 0xb0
You can’t perform that action at this time.
0 commit comments