diff options
-rw-r--r-- | hal/usb.h | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -25,12 +25,27 @@ struct USB_reg_t { volatile uint32_t DIEPTXF3; }; +struct USB_dev_reg_t { + volatile uint32_t DCFG; + volatile uint32_t DCTL; + volatile uint32_t DSTS; + volatile uint32_t DIEPMSK; + volatile uint32_t DOEPMSK; + volatile uint32_t DAINT; + volatile uint32_t DAINTMSK; + volatile uint32_t DVBUSDIS; + volatile uint32_t DVBUSPULSE; + volatile uint32_t DIEPEMPMSK; +}; + class USB_t { public: USB_reg_t& reg; + USB_dev_reg_t& dev_reg; - USB_t(uint32_t reg_addr) : reg(*(USB_reg_t*)reg_addr) {} - + USB_t(uint32_t reg_addr) : + reg(*(USB_reg_t*)reg_addr), + dev_reg(*(USB_dev_reg_t*)(reg_addr + 0x800)) {} }; #if defined(STM32F1) |