Simple MicroPython to C interface
Posted: Mon Jan 06, 2020 8:17 pm
Hi,
I would like to write a C library for interfacing a micropyton command.
In C something like this (of course, the types are wrong ...)
...
STATIC mp_obj_t myLibrary_call(mp_obj_t array_obj) {
uint32_t i;
for (i = 0; i < 10; i++) {
array_obj = i;
}
}
...
In micropyton, something like this :
buffer = [0] * 10
print(buffer)
0 0 0 0 0 0 0 0 0 0
myLibrary.call(buffer)
print(buffer)
0 1 2 3 4 5 6 7 8 9
In the package I found some examples that use to pass simple integers (but no arrays).
Any suggestion to help me to write the C & micropython code for this simple array example?
Thank you
efr
I would like to write a C library for interfacing a micropyton command.
In C something like this (of course, the types are wrong ...)
...
STATIC mp_obj_t myLibrary_call(mp_obj_t array_obj) {
uint32_t i;
for (i = 0; i < 10; i++) {
array_obj = i;
}
}
...
In micropyton, something like this :
buffer = [0] * 10
print(buffer)
0 0 0 0 0 0 0 0 0 0
myLibrary.call(buffer)
print(buffer)
0 1 2 3 4 5 6 7 8 9
In the package I found some examples that use to pass simple integers (but no arrays).
Any suggestion to help me to write the C & micropython code for this simple array example?
Thank you
efr