I2C read and write

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
yoLo_
Posts: 9
Joined: Fri Mar 24, 2017 2:34 am

I2C read and write

Post by yoLo_ » Thu Nov 09, 2017 6:32 pm

There is this i2c memory operations...
http://docs.micropython.org/en/latest/p ... adfrom_mem

I2C.readfrom_mem_into(addr, memaddr, buf, *, addrsize=8)

after the buf, there is this parameter with *
what goes there ???
and if addrsize = 8 then by inserting a value in the parameter change the size of length of the data read ??
also is there anyway i can read from memory and know if read has been successful..
like return a 1 if successful or 0 if not ??
because i got try: ..... except in mind but what if buf is empty after readinto buf has been performed

any examples ??

Regards

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: I2C read and write

Post by pythoncoder » Thu Nov 09, 2017 6:51 pm

The * signifies that subsequent arguments must be supplied as keyword args. See https://stackoverflow.com/questions/222 ... -parameter.
Peter Hinch
Index to my micropython libraries.

Post Reply