|
|
@ -162,3 +162,14 @@ void mp_hal_pin_config_speed(mp_hal_pin_obj_t pin_obj, uint32_t speed) { |
|
|
|
uint32_t pin = pin_obj->pin; |
|
|
|
gpio->OSPEEDR = (gpio->OSPEEDR & ~(3 << (2 * pin))) | (speed << (2 * pin)); |
|
|
|
} |
|
|
|
|
|
|
|
MP_WEAK void mp_hal_get_mac(int idx, uint8_t buf[6]) { |
|
|
|
// Generate a random locally administered MAC address (LAA)
|
|
|
|
uint8_t *id = (uint8_t *)MP_HAL_UNIQUE_ID_ADDRESS; |
|
|
|
buf[0] = 0x02; // LAA range
|
|
|
|
buf[1] = (id[11] << 4) | (id[10] & 0xf); |
|
|
|
buf[2] = (id[9] << 4) | (id[8] & 0xf); |
|
|
|
buf[3] = (id[7] << 4) | (id[6] & 0xf); |
|
|
|
buf[4] = id[2]; |
|
|
|
buf[5] = (id[0] << 2) | idx; |
|
|
|
} |
|
|
|