Hi everyone, I'd like to introduce you libdaisy_nim , a Nim wrapper for the libDaisy HAL for the Electro-Smith Daisy embedded platform ! I've wanted to use Nim in embedded audio for a while now and thanks to copilot cli I've been able to write a wrapper for libDaisy to use it with. It's still in it's early days and while it's far from complete but I think the global architecture of the wrapper is sufficiently stable to share it with people now. There's a technical document explaining how the wrapper works in detail for those who are curious. Feel free to contribute to and/or correct my poorly written Nim as it is my first project with it and my first open source project on top of that !
Since I'm on the Nim forum I'll take this opportunity to ask: Is there a way to map a Nim generics to a C++ template class ? Basically for the SSD1306 driver I've been unable to map the template class SSD130xDriver to a Nim generic since Nim generates invalid C++ forward declarations for functions returning generic template types (basically the parameter aren't replaced in the forward declaration). For now I've manually wrapped each alias for the different screen sizes but idealy I would like the end user to be able to pass the screen size to Nim and that Nim generate the correct type at compile time. This has also been a roadblock for updating the June library (a JUCE C++ wrapper) to Nim 2.x.
Hello everyone !
I’ve reworked my Nim wrapper for libDaisy and I think it is now mostly feature complete (90% percent coverage of libDaisy and 95% for the user-facing features) with full board support, comprehensive documentation and full DocGen, automated setup and build using nimble ! It also provides some new niceties, like a small DSL for menu creation compatible with libDaisy UI modules.
I’ve changed the name to Nimphea (stylized from the French Nymphéa, which means white water lily) and started a new repo.
I’ve tried to make it as robust as possible by following libDaisy’s method of testing, so it now includes unit tests for the pure Nim modules that don’t depend on hardware and there is a comprehensive test table for the example. Since it’s a wrapper it shouldn’t introduce too many bugs apart from libDaisy’s one, but I’ve been using agents to wrap libDaisy so some bugs might have slipped through.
I hope you find it some use cases as I really think Nim has some strong arguments for embedded and audio applications. Happy coding everyone !
Since I'm on the Nim forum I'll take this opportunity to ask: Is there a way to map a Nim generics to a C++ template class ?
Not as far as I'm ware of. Maybe somebody would a way with macros and .emit though.
Old but useful I think:
https://scripter.co/binding-nim-to-c-plus-plus-std-list/
Although it discuss about cpp stdlib template but I think it will be useful.
dsp_filtering, dsp_transforms, dsp_statistics, dsp_fastmath, dsp_matrix, dsp_complex, and more)
types)
I didn't had hardware on hand while developing it so it may be a bit rough around the edges but I just got my Daisy Seed back with some components to test in real conditions so it should become more stable in the coming weeks.
Contributions are welcomed !