cnlohr / ch32v003fun

Open source minimal stack for the ch32 line of WCH processors, including the ch32v003, a 10¢ 48 MHz RISC-V Microcontroller - as well as many other chips within the ch32v/x line.
MIT License
958 stars 146 forks source link

Add timeout to `WaitForDebuggerToAttach` #430

Closed BogdanTheGeek closed 2 weeks ago

BogdanTheGeek commented 2 weeks ago

Added timeout in milliseconds argument and a return value to indicate weather timeout was reached.

Possible future enhancements:

eeucalyptus commented 2 weeks ago

I'm not exactly happy with the inline defines for the type. Would

#if defined(CH32V20x) || defined(CH32V30x)
uint64_t start = SysTick->CNT;
#elif defined(CH32V10x) || defined(CH32X03x)
uint32_t start = SysTick->CNTL;
#else
uint32_t start = SysTick->CNT
#endif

be fine too? If I'm being too pedantic lmk, I'd just accept this PR then xD

eeucalyptus commented 2 weeks ago

Yes I am being too pedantic ;)