mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
61e06c632a
This patch introduces an example application to demonstrate how to use GPIO driver APIs to manipulate input pins. The application uses default galileo pinmux initialization and sets the GPIO 5 (IO2) as output pin and GPIO 6 (IO3) as input. It toggles the output pin state at every half second and checks the value on input pin.
64 lines
2.0 KiB
Plaintext
64 lines
2.0 KiB
Plaintext
Galileo Specific Examples
|
|
=======================
|
|
|
|
This directory contains galileo-specific example applications to illustrate
|
|
how to use galileo APIs.
|
|
|
|
In order to build a application, you should set the EXAMPLE environment
|
|
variable to the name of the application you want to build. For instance, if
|
|
you want to build gpio-output application, run the following command:
|
|
$ make TARGET=galileo EXAMPLE=gpio-output
|
|
|
|
============
|
|
= GPIO =
|
|
============
|
|
|
|
GPIO Output
|
|
===========
|
|
|
|
This application shows how to use the GPIO driver APIs to manipulate output
|
|
pins. This application sets the GPIO 4 pin as output pin and toggles its
|
|
state at every half second.
|
|
|
|
For a visual effect, you should wire shield pin IO1 to a led in a protoboard.
|
|
Once the application is running, you should see a blinking LED.
|
|
|
|
GPIO Input
|
|
==========
|
|
|
|
This application shows how to use the GPIO driver APIs to manipulate input
|
|
pins. This application uses default galileo pinmux initialization and sets
|
|
the GPIO 5 (IO2) as output pin and GPIO 6 (IO3) as input. It toggles the
|
|
output pin state at every half second and checks the value on input pin.
|
|
|
|
=======
|
|
= I2C =
|
|
=======
|
|
|
|
I2C LSM9DS0
|
|
===========
|
|
This application shows how to use I2C driver APIs to configure I2C Master
|
|
controller and communicate with LSM9DS0 sensor. At every 5 seconds, the
|
|
application reads the "who am I" register from gyroscope sensor and prints if
|
|
the register value matches the expected value described in the spec [1].
|
|
|
|
According to the sensor spec, to read the value in "who am I" register, we
|
|
should first perform an i2c write operation to select the register we want
|
|
to read from and then we perform the i2c read operation to actually read
|
|
the register contents.
|
|
|
|
The wiring setup is as follows (left column from Galileo and right column from LSM9DS0):
|
|
- 3.3v and Vin
|
|
- GND and GND
|
|
- GND and SDOG
|
|
- 3.3v and CSG
|
|
- SDA and SDA
|
|
- SCL and SCL
|
|
|
|
==============
|
|
= References =
|
|
==============
|
|
|
|
[1] http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00087365.pdf
|
|
|