Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Latest commit

 

History

History
89 lines (58 loc) · 2.69 KB

README.md

File metadata and controls

89 lines (58 loc) · 2.69 KB

wio-terminal Examples

Various examples demonstrating the use of the Wio Terminal's peripherals.

Getting Started

All commands below are executed from the project's root directory, ie. that containing Cargo.toml.

Building

Build all examples, in developer mode:

$ cargo build --examples

Build one specific example, in release mode:

$ cargo build --release --example=blinky

Flashing

Regardless of which method used, be sure to put your device in bootloader mode first by toggling the reset switch twice.

Linux permissions

On Linux, you may wish to use udev to grant you access to the bootloader USB port, without being root. You can do this by creating a file /etc/udev/rules.d/99-wio-terminal.rules with the following contents:

ATTRS{idVendor}=="2886", ATTRS{idProduct}=="002d", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2886", ATTRS{idProduct}=="002d", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2886", ATTRS{idProduct}=="002d", MODE="0666"

And reloading your udev rules like this:

sudo udevadm control --reload-rules
sudo udevadm trigger

arm-none-eabi-objcopy & bossac

Make sure you have built the desired example in release mode first, as described above.

Convert the resulting file to a binary using arm-none-eabi-objcopy (make sure this is on your PATH first!), then flash to your device using BOSSA. Make sure you change <PORT> in the command to the appropriate value.

$ arm-none-eabi-objcopy \
>   -O binary \
>   /target/thumbv7em-none-eabihf/release/examples/blinky \
>   /target/thumbv7em-none-eabihf/release/examples/blinky.bin
$ bossac \
>   -i -d -v \
>   --port=<PORT> -U \
>   -w /target/thumbv7em-none-eabihf/release/examples/blinky.bin \
>   -R

cargo-hf2

The hf2-rs project provides a crate, cargo-hf2, which allows us to build and flash all in one go using cargo:

$ cargo install cargo-hf2
$ cargo hf2 --release --example=blinky --vid 0x2886 --pid 0x002d

Examples

Flash the (blue) User LED, located on the bottom of the device beside the USB port, at a set interval.

Demonstrate the use of the buttons and 5-way switch. Displays arrows indicating which button was pressed.

Display Ferris centered on the screen. Maintain the correct orientation of the image as determined by the accelerometer.

Makes the Wio Terminal appear as a USB serial port. The screen can be written to by sending messages down the serial port.