cnlohr / rv003usb

CH32V003 RISC-V Pure Software USB Controller
MIT License
436 stars 43 forks source link

exti availability #54

Closed thirstyone closed 4 months ago

thirstyone commented 5 months ago

I'd like to repurpose the demo_composite_hid example to read an AB encoder so that it mimics the usb keyboard. For the encoder part I want to use EXTI. I've read about some limitations (as to not use PORTD for other purposes, and retain the highest priority for external inteerrupts. I looked through the code, and it seems, your EXTI handler is in rv003usb.S file. So, does it mean that learning assembly is the only way to implement it?

cnlohr commented 4 months ago

I don't recall the specifics, but you would need to reduce the priority of the EXTI interrupt for the IO you are working with, as compared to the priority of the GPIO for the USB.

There are EXTI examples in C. the reason we did EXTI in assebmly for USB was to reduce the overhead getting into and working with the IO.