Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: gavinmc42 on May 26, 2016, 11:58:33 PM
-
Hi Bela,
Been seeing you on the micropython forum.
Embedded Micropython uses pyb to talk to hardware, don't have that for RPi version?
Would be nice to figure out how to do i2c stuff in micropython.
-
In piCore it is the Unix version of MicroPython with os module preinstalled, see /usr/lib/micropython. There is a piCore specific tc.py module also with functions used by the extension loader like reading of kernel version, number of CPU's, dependency lists, etc.
At the moment there are no RPi machine hardware (HAL) module available, someone must make it. As much as possible it must follow the rules I mean use same methods, properties, etc. as other MicroPython implementations are doing it. Which is changing of course, see ongoing discussion at GitHub about that topic.
Many hw stuff can be done via /proc like configuring, reading and writing GPIO, etc. It is easy to code as it requires only file manipulation. Direct programing of hw registers a bit more complicated and requires a C code as well as using interrupts. But you can start with just the simple operations. There are tons of sample codes for RPi written in other languages.
As cPython MicropYthon on Linux is using libffi which makes using of existing libs easy. Study MicroPython modules at GitHub.
-
Ok, that does not mean much to me yet.
In the meantime I wrote some shell script that uses i2cget to read the i2c sensor and format it, then write it to a file.
I then used the micropython code to os.system("xx.sh") the script and then opened the file in micropython to read the data back.
And act as modbus server in 76 lines of code 8)
Clunky but it works.
Done cat /proc/cpuinfo before, can it be used to do GPIO?
I normally use /sys/class/gpio....
-
Done cat /proc/cpuinfo before, can it be used to do GPIO?
I normally use /sys/class/gpio....
Yeah, for GPIO it is /sys/class/...