Add own native library (example touch controller)

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
ulno
Posts: 9
Joined: Tue Mar 22, 2016 9:37 am
Contact:

Add own native library (example touch controller)

Post by ulno » Tue Mar 22, 2016 9:52 am

Hi all.

I have recently written a small touch library (http://github.com/ulno/libni) for the esp8266. I also designed a workshop for using this to build with students a tin foil based touch game controller (just presented on FOSSASIA 2016). However, using C in an introductory class (and especially flashing boards where the serial connectors are not soldered on correctly) can be pretty tedious, so I was wondering how I could compile my own native library into the firmware or even load it later. Then students could just use the Python command line to configure their controller. The library is very time critical and some blocks need to run atomically for some microseconds. Python itself is unlikely to be fast enough to handle this core directly. However the major part is probably easy to run also as Python code.

Where would I start with this?

mianos
Posts: 84
Joined: Sat Aug 22, 2015 6:42 am

Re: Add own native library (example touch controller)

Post by mianos » Tue Mar 22, 2016 9:04 pm

Sure you can write the core in C (I have not used c++). There are quite a few examples on the forum and some good ones in the source tree. I have done about 5 C device drivers, it's pretty easy if you can find examples of how to manipulate the python data, so for example the 1wire python binding:https://github.com/mianos/micropython/b ... sp_1wire.c
I am sure there will be a few more of these when the esp8266 code is released later in the year.

ulno
Posts: 9
Joined: Tue Mar 22, 2016 9:37 am
Contact:

Re: Add own native library (example touch controller)

Post by ulno » Thu Mar 31, 2016 6:36 pm

No, this doesn't look too hard and the time critical-part is anyway low level C-code, so should be doable. So, I just check out the stuff from github and set-up cross compiler toolchain and try to get going with a small hello-world based on the 1-wire code?

Thanks,
ulno

Post Reply