🎛️ hal::regs
Direct Register Access & Bit Manipulation
366 satır
Memory-Mapped I/O
📖 Genel Bakış
Register modülü, donanım registerlerine doğrudan erişim ve bit manipulation fonksiyonları sağlar.
🚀 Kullanım
içe_aktar hal::regs
// Read/Write registers
değişken value = regs.read(0x40020000) // Read GPIOA base
regs.write(0x40020014, 0x2000) // Write to GPIOA_ODR
// Bit operations
regs.set_bit(0x40020000, 13) // Set bit 13
regs.clear_bit(0x40020000, 13) // Clear bit 13
regs.toggle_bit(0x40020000, 13) // Toggle bit 13
// Bit field operations
regs.modify(0x40020000, 0x0F, 0x05, 4) // Modify bits [7:4]
⚠️ Önemli Notlar
- Doğrudan register erişimi tehlikeli olabilir
- HAL fonksiyonlarını tercih edin
- Atomic operations için critical section kullanın