Address: Room 1705,Block A1, Longyuan Plaza, Longkouxi Road, Guangzhou, China, 510640 Website: http://www.arm9.net
Sales: +86-20-85201025 Tech Support: +86-13719442657 Fax: +86-20-85261505
Email for Business and Cooperation: capbily@163.com Email for Tech Support: dev_friendlyarm@163.com
int fd,
int pos,
byte byteData);
pos: position where data to be written
(0~255)
byteData: data to be written
Return Value:
If this operation succeeds it will return the
number of characters written otherwise it
will return -1.
write operaration).
Note: this operation is time consuming. It
costs about 10 ms.
int
readByteDataFromI2C(
int fd,
int pos);
fd: file descriptor
pos: position where data to be read (0~255)
Return Value:
If this operation succeeds it will return data
it reads otherwise it will return -1. If before
this function is called the file pointer has
reached the end of the device it will return
0. The return value’s type is int you need to
convert it to a byte value.
Read data from EEPROM.
Note: this operation is time consuming. It
costs about 10 ms.
fd: file descriptor
Return Value:No
Notes:
First you need to open a serial device with “openI2CDevice”, then your can call
“writeByteDataToI2C” to write data and “readByteDataFromI2C” to read data. These
operations are time consuming and will usually cost 10ms therefore it is better to call
them in a new thread.
The EEPROM device can store 256 bytes data so the position parameter’s value
ranges from 0 to 255 and each time it can only read/write one byte
If you don’t need to operate the device you need to “close” it.
6.2.3 Code Samples
In the “Android” directory in the shipped CO there is a LED Demo program you can
open it in Eclipse and learn how to use the libfriendlyarm-hardware.so library.
You can debug, download and run it on the board via the shipped miniUSB cable.