ducalex / retro-go

Retro emulation for the ODROID-GO and other ESP32 devices
GNU General Public License v2.0
543 stars 125 forks source link

Add more queue helpers #116

Closed tomvanbraeckel closed 3 months ago

tomvanbraeckel commented 3 months ago

I'm ready to upstream the piezo buzzer audio driver, and this adds 2 simple helper functions that are needed for it.

ducalex commented 3 months ago

Maybe you should use FreeRTOS queues directly if your driver depends on ISRs? rg_queue isn't meant to replicate the full FreeRTOS API, just enough for message passing between threads/tasks.

On the other hand I can see why you'd want to standardize on rg_queue across our entire codebase and messages_waiting is definitely a good addition. So I'm not really opposed to merging the PR as is.

Maybe just change uint32_t for size_t because rg_queue_create establishes that our item counts are size_ts?

tomvanbraeckel commented 3 months ago

I originally used FreeRTOS queues directly, but then I noticed there are rg_ equivalents for it, so I thought it would be preferred to use those. I understand you wouldn't want to copy the whole API, but I guess for this one or two it's fine.

Point taken on the size_t. Fixed!

ducalex commented 3 months ago

Oh dear, I messed up with my git incompetence. Hopefully it's all good now.