hardware_id.c (581B)
1 // Copyright 2022 QMK 2 // SPDX-License-Identifier: GPL-2.0-or-later 3 4 // For some reason this bit is undocumented for some AVR parts and not defined in their avr-libc IO headers 5 // See https://stackoverflow.com/questions/12350914/how-to-read-atmega-32-signature-row 6 #ifndef SIGRD 7 # define SIGRD 5 8 #endif // SIGRD 9 10 #include <avr/boot.h> 11 #include "hardware_id.h" 12 13 __attribute__((weak)) hardware_id_t get_hardware_id(void) { 14 hardware_id_t id = {0}; 15 for (uint8_t i = 0; i < 10; i += 1) { 16 ((uint8_t *)&id)[i] = boot_signature_byte_get(i + 0x0E); 17 } 18 return id; 19 }