The patch to the original source code and the updated source code are available here: https://github.com/vzaigrin/newi2c
To get source code of the original
i2c(8) utility we need:
- To get
- To compile
- To run command
svn checkout svn0.eu.FreeBSD.org/base/head/usr.sbin /usr/src/usr.sbin
After that we can to apply patch to the original source code of
Then we can compile and install it:
We can also just to compile the updated source code:
cc -o i2c newi2c.c
cp i2c /usr/sbin
chown root:wheel /usr/bin/i2c
chmod 555 /usr/sbin/i2c
Let’s try to work with the new
I have connected to my Raspberry Pi the DS1307 Real Time Clock breakout board.
Starting from 0x08H offset it has 56 bytes available as RAM.
So we can read and write to it without changing the time set on it.
When we want to write data and enter from the keyboard
0 we does not write
zero, we write the value of symbol
'0'. That is 30 in HEX.
Also when we enter on the keyboard
abcd we write values
61 62 63 64.
ASCII table is available here: http://en.wikipedia.org/wiki/ASCII
For ‘zeroing’ registers we need to write
zero to its.
Zero we can get from the