diff options
| -rw-r--r-- | hal/usb.h | 4 | ||||
| -rw-r--r-- | main.cpp | 12 | 
2 files changed, 13 insertions, 3 deletions
| @@ -65,8 +65,8 @@ class USB_t {  	public:  		USB_reg_t& reg;  		USB_dev_reg_t& dev_reg; -		USB_dev_iep_reg_t const* dev_iep_reg; -		USB_dev_oep_reg_t const* dev_oep_reg; +		USB_dev_iep_reg_t * const dev_iep_reg; +		USB_dev_oep_reg_t * const dev_oep_reg;  		USB_t(uint32_t reg_addr) :  			reg(*(USB_reg_t*)reg_addr), @@ -21,6 +21,16 @@ template<>  void interrupt<(Interrupt::IRQ)67>() {  	led_blue.toggle();  	led_red.toggle(); + +	if(OTG_FS.reg.GINTSTS & (1 << 12)) { +		led_yellow.toggle(); +		OTG_FS.dev_oep_reg[0].DOEPCTL = (1 << 27); +		OTG_FS.dev_reg.DAINTMSK = (1 << 16) | 1; +		OTG_FS.dev_reg.DOEPMSK = (1 << 3) | 1; +		OTG_FS.dev_reg.DIEPEMPMSK = (1 << 3) | 1; +		OTG_FS.reg.GRXFSIZ = 256; +		OTG_FS.dev_oep_reg[0].DOEPTSIZ = (3 << 29); +	}  	OTG_FS.reg.GINTSTS = 0xffffffff;  } @@ -56,7 +66,7 @@ int main() {  	OTG_FS.reg.GAHBCFG = 1;  	// USB configuration -	OTG_FS.reg.GUSBCFG = (1 << 30) | (0xf << 10) | (1 << 9) | (1 << 8); +	OTG_FS.reg.GUSBCFG = (1 << 30) | (0xf << 10) | (0 << 9) | (0 << 8);  	//                   FDMOD       TRDT          HNPCAP     SRPCAP  	// interrupt mask | 
