Hi, I'm flirting with the idea of creating a pure rust port of the rasperry pi ws2811 library with an end goal of creating a PoC for a Falcon Player replacement in Rust (lots of people in the community complain of crashes, perhaps a Rust version could improve the situation).
I'm a java guy by day, and also new to low level IO programming, so I've been using google a lot to try and understand what it might take to achieve this project. Most of my searches are landing on code/posts from @japaric and I'm generally getting the idea that I should be looking into basing my project upon the work on the embedded-hal.
And now to my main question. The code in rpi_ws281x uses mmap to access/control the gpio, pwm and dma, whereas the embedded-rust community have established libraries for managing gpio and pwm via the sysfs interface. Are there any potential consequences of using the sysfs interface instead of implementing an mmap version of the same functionality? Potential perfomance impact, for example?
I don't see anything similar for the DMA access, yet sysfs appears to have an interface for that too, should I continue down that route?
My general plan for implementing this would be;
- clone rpi_ws281x and rip out all code relating to SPI, PCM, and reduce it to only one PWM output (this is to reduce my scope as small as possible, while remaining useful and help me to understand the existing code).
- write a small demo app to ensure I didn't break the above code
- Start porting the code to rust implementing/using the functionality from embedded-hal/sysfs-gpio/sysfs-pwm
- Once working parameterize to add back in the functionality I scoped out in 1.
Does this sound like a sane way forward?
Note: I'm aware of the rust wrapper for ws281x (not linked as I'm only allowed two links as a new user) but I thought that a pure rust port might also be an interesting exercise.