Call C functions from Micropython script.

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
tarun2121
Posts: 9
Joined: Wed Oct 22, 2014 9:55 am

Call C functions from Micropython script.

Post by tarun2121 » Mon Nov 24, 2014 7:15 am

Hello All
I need to call C functions(from some .c file) to micropython script running on STM board. How it could be done?
I tried to call in same way CPython does, But I am getting error while importing C file in python script.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Call C functions from Micropython script.

Post by dhylands » Mon Nov 24, 2014 7:51 am

In order to call C from MicroPython (on the pyboard) you need to create a module like the ones in the stmhal directory.

For example: https://github.com/micropython/micropyt ... mhal/led.c

Also see this thread: http://forum.micropython.org/viewtopic. ... =153&p=625

Post Reply