All Questions
7 questions
-1
votes
1
answer
451
views
Generating JWS token in python (Example in C)
Hi I have this code from this article
https://medium.com/@alexastrum/firebase-auth-for-iot-devices-286679a8b59e
I was wondering what the equivalent python code would be thanks.
String getDeviceToken()
...
4
votes
1
answer
3k
views
Convert CRC16 CCITT code from C to Python
I want to do a Python implementation (actually MicroPython) of a specific checksum calculation based on CRC16-CCITT.
It will be used on a microcontroller to check data integrity over a serial ...
1
vote
1
answer
74
views
Micropython - how to create a type in C that inherits another type also defined in C?
How do I create a new Python type in C that inherits another Python type also defined in C?
The behavior should be like this:
# TypeA defined in C, has members called a1, a2, ...
a = TypeA()
# TypeB ...
1
vote
1
answer
136
views
python - how to apply decorators to Python functions written in C?
Prefer a micropython answer but will accept CPython
I'm implementing a Python function in C.
How do you apply a decorator to Python function written in C?
25
votes
1
answer
6k
views
python - how to implement a C-function as awaitable (coroutine)
Environment: cooperative RTOS in C and micropython virtual machine is one of the tasks.
To make the VM not block the other RTOS tasks, I insert RTOS_sleep() in vm.c:DISPATCH() so that after every ...
0
votes
1
answer
451
views
Load and compile python file without system file with MicroPython
MicroPython Github that I am using.
I want to run some very simple code on MicroPython and I have successfully called C functions from Python and vice versa with my own code. However, it only works ...
0
votes
1
answer
506
views
How does this macro work?
In this Python implementation for microcontrollers, they use C-macro like follows:
MP_ROM_QSTR(MP_QSTR_mem16)
with:
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
and:
#define MP_OBJ_NEW_QSTR(qst) ((...