in Driver Writing getting char pointer

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
TRMrNo
Posts: 15
Joined: Fri May 28, 2021 9:24 pm

in Driver Writing getting char pointer

Post by TRMrNo » Wed Jul 20, 2022 4:33 pm

hello,

I am trying to write my own driver at C level.

I want to pass a char pointer but I could not find a suitable micropython function.

for float mp_obj_get_float()
for int mp_obj_get_int()
for char* ???

Best Regards

User avatar
karfas
Posts: 193
Joined: Sat Jan 16, 2021 12:53 pm
Location: Vienna, Austria

Re: in Driver Writing getting char pointer

Post by karfas » Wed Jul 20, 2022 8:23 pm

There is no such thing like a char * in (micro)python. The address of something is usually a plain int.

You might want to acces a bytes or string object.
Check out any functios (e.g. in ports/*/*.c) which get a string or bytes object.
A few hours of debugging might save you from minutes of reading the documentation! :D
My repositories: https://github.com/karfas

Post Reply