[core] Add lt_get_device_mac() function
This commit is contained in:
@@ -38,6 +38,7 @@ uint32_t lt_cpu_get_unique_id();
|
||||
/**
|
||||
* @brief Get CPU ID based on the last three octets of MAC address.
|
||||
* Note: the number is 24-bit (with the MSB being zero).
|
||||
* The 3rd-to-last octet is least-significant, the last octet is most-significant.
|
||||
*/
|
||||
uint32_t lt_cpu_get_mac_id();
|
||||
|
||||
|
||||
@@ -20,6 +20,13 @@ const char *lt_get_board_code();
|
||||
*/
|
||||
const char *lt_get_device_name();
|
||||
|
||||
/**
|
||||
* @brief Read device's *default* MAC address into 'mac' array.
|
||||
* This can be used even without Wi-Fi enabled, and will ignore
|
||||
* user-changed Wi-Fi MAC (if changing is possible).
|
||||
*/
|
||||
void lt_get_device_mac(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Reboot the CPU.
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,12 @@ __attribute__((weak)) uint32_t lt_cpu_get_unique_id() {
|
||||
return lt_cpu_get_mac_id();
|
||||
}
|
||||
|
||||
__attribute__((weak)) uint32_t lt_cpu_get_mac_id() {
|
||||
uint8_t mac[6];
|
||||
lt_get_device_mac(mac);
|
||||
return (mac[3] << 0) | (mac[4] << 8) | (mac[5] << 16);
|
||||
}
|
||||
|
||||
__attribute__((weak)) uint8_t lt_cpu_get_core_count() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user