MEDIATEK LinkIt Smart 7688 Developer's Manual page 63

Hide thumbs Also See for LinkIt Smart 7688:
Table of Contents

Advertisement

import
mraa
i2c = mraa.I2c(0)
# Grove - 3-Axis Digital Accelerometer(+-16g)
# is a ADXL345 configured to I2C address 0x53.
i2c.address(0x53)
# The device ID should be
if
0xE5
== i2c.readReg(0x00):
print
"Grove - 3-Axis Digital Accelerometer found on I2C Bus"
else:
print
"Grove - 3-Axis Digital Accelerometer not found"
For more details on I2C API, please see here.
To drive an I2C device, you need to operate multiple I2C sequences. LinkIt Smart 7688 also
comes with libUPM pre-installed, which is a set of driver repository built upon libmraa.
Please see
here
SPI
SPI (Serial Peripheral Interface) can also be used to control peripheral devices. On LinkIt
Smart 7688 it consists of 4 pins:
SPI_CS1(P25).
and
It's important to note that the SPI device is also used for communicating with the internal
flash storage on the board. Therefore, developers should access the SPI functionality
through SPI modules only and avoid treating these SPI pins as general GPIO. Otherwise,
the flash storage may work incorrectly.
The SPI module in libmraa is initialized by device index, instead of pin number.
import
mraa
spi = mraa.Spi(0)
The SPI protocol allows flexible configurations on signal patterns. Depending on your
peripheral, you may need to configure the pattern with APIs like
Please see
here
Please see MediaTek Labs' website for tutorials on how to blink the Wi-Fi LED on LinkIt Smart
7688 using mraa in Python and Node.js.
5.1.4.
LED blink example using mraa in LinkIt Smart 7688 GPIO in Python
This example shows you how to use mraa library in Python to make the Wi-Fi LED on LinkIt Smart
7688 blink.
In LinkIt Smart 7688 SSH system console, create a directory called app and go to that
1)
directory. For example:
mkdir app
cd app
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide
for a driver example of Seeed Studio 3-Axis Digital Accelerometer.
SPI_MOSI(P22), SPI_MISO(P23), SPI_CLK(P24),
for API details.
© 2015, 2016 MediaTek Inc.
bitPerWord
mode
and
.
Page 63

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents