Skip to content

OPTA: allow vid/pid function override from derived core #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions variants/OPTA/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ static const uint8_t SCK = PIN_SPI_SCK;
// Use these only if bootloader data is not available / valid
#define _BOARD_VENDORID 0x2341
#define _BOARD_PRODUCTID 0x0264

#ifndef FIRST_PROGRAMMING
uint16_t _getVid_();
uint16_t _getPid_();

// Retrieve (Arduino OUI) Ethernet MAC Address from QSPIF OTP
uint8_t _getSecureEthMac_(uint8_t *);
#endif

#define BOARD_NAME "Arduino Opta"

Expand Down
10 changes: 2 additions & 8 deletions variants/OPTA/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,26 +313,19 @@ uint16_t boardRevision() {
return (((OptaBoardInfo*)_boardInfo)->revision);
}

#ifndef FIRST_PROGRAMMING
uint16_t _getVid_() {
#ifdef FIRST_PROGRAMMING
return _BOARD_VENDORID;
#else
if (!has_otp_info) {
getSecureFlashData();
}
return ((OptaBoardInfo*)_boardInfo)->vid;
#endif
}

uint16_t _getPid_() {
#ifdef FIRST_PROGRAMMING
return _BOARD_PRODUCTID;
#else
if (!has_otp_info) {
getSecureFlashData();
}
return ((OptaBoardInfo*)_boardInfo)->pid;
#endif
}

uint8_t _getSecureEthMac_(uint8_t *mac_address) {
Expand All @@ -349,6 +342,7 @@ uint8_t mbed_otp_mac_address(char *mac)
auto ret = _getSecureEthMac_(reinterpret_cast<uint8_t *>(mac));
return ret;
}
#endif

#define BOARD_REVISION(x,y) (x << 8 | y)

Expand Down