SPI
Last updated
Last updated
LinkIt 7697 supports SPI Master with some limitations.
The built-in SPI library is implemented in software based on GPIO APIs. A hardware library is not provided because the design of hardware SPI function of MT7697 is not fully compatible with the SPI API usage defined by Arduino IDE. If you want to access the hardware SPI feature of LinkIt 7697, please refer to the LinkIt SDK API. For most users, the software implementation should be sufficient.
As an example, we show how to use the SPI interface to connect to a BMP183 Barometric Pressure & Altitude Sensor.
Connect the board with the BMP183 sensor as shown in the above figure.
Download the zip file for the Adafruit Unified Sensor Driver and Adafruit BMP183 Library.
In the Arduino IDE, select the Sketch / Include Library / Add .Zip Library and choose the two zip files (Adafruit_Sensor-master.zip and Adafruit_BMP183_Library-master.zip) downloaded in the previous step to add them in.
Open the Adafruit_BMP183.cpp file in the user-installed library folder.
Add a line to define the _delay_ms()
function in line 25, as shown below:
Comment out line 46 and replace it with the SPISettings()
class as line 47 in the following code block:
Save the edited file.
Click the Upload icon to compile and upload the sketch to the board.
You should be able to see the output from the BMP183 in the Serial Monitor (with baud rate 9,600), for example: