Page 1 of 1

C libraries for stuff

Posted: Wed Sep 18, 2019 5:29 am
by maludwig
Hi friends,

So, I've just made my first PR into micropython (yay):
https://github.com/micropython/micropython/pull/5117

And I now want to expand my work on the neopixel code, so that it has a whole huge assortment of functionality, animations, wifi integration, that kind of thing. It feels like the core port shouldn't have such a mess like that though, and should be kept clean and simple.
I'd like to implement as much of it in Python as possible, but it's likely that I'll have to implement a bunch of the maximally performant bits in C.

Is there a way for me to develop a C library, as a upip package? Is that a thing?

Re: C libraries for stuff

Posted: Wed Sep 18, 2019 11:22 am
by jimmo
Thanks for sending the PR, looks like a great improvement.

Just a note, the maintainers tend to prefer unrelated changes to be broken up into separate PRs (or at best separate commits). So the Makefile and README changes should probably be moved. Also support for the v4.0 IDF was just added yesterday.

Hopefully most of the animation and utility functions can be implemented in Python, and even better, perhaps shared with drivers for APA102 LEDs too. (FYI see https://github.com/micropython/micropython/pull/5060 which is adding a dotstar library as a board-level module but I hope can actually be moved to /drivers).

I've done a bit with LED animations with MicroPython and so far was able to achieve all the performance I needed using @native and @viper in a small number of places (which are very soon to be supported on ESP32). (I know you've seen that PR :p )

To answer your question though, I think the feature you want is what was discussed in this thread: viewtopic.php?f=3&t=6884
The summary is though, there is active development on a feature to implement MicroPython equivalents of shared libraries (or DLLs on Windows).
See Matt's talk: https://2019.pycon-au.org/talks/extendi ... c-for-good
and Damien's talk: https://www.youtube.com/watch?v=AshUrGVrp-A (Native Modules in MicroPython (part 2))