Skip to content

Commit f538749

Browse files
committedAug 4, 2020
Link to and improve README for RaspPi
1 parent a261da2 commit f538749

File tree

3 files changed

+51
-6
lines changed

3 files changed

+51
-6
lines changed
 

‎README.md

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ fn HardFault(ef: &ExceptionFrame) -> ! {
9393

9494
```
9595

96+
### Raspberry Pi
97+
98+
A sample project is available under [examples/raspi](./examples/raspi)
99+
96100
## License
97101

98102
Licensed under either of

‎examples/raspi/README.md

+47-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
1-
# raspi demo for oled(ssd1306)
1+
# SSD1306 demo on Raspberry pi
22

3-
in rust
3+
This is a sample that uses the built-in I2C bus available in Linux on the Raspberry Pi B/2/3/4.
44

5-
## Quick start
5+
## Connections
6+
7+
This sample relies on the default [Raspberry Pi pinout](https://www.raspberrypi.org/documentation/usage/gpio/) for i2c:
8+
9+
| Pin | Description |
10+
|-----|-------------------------------------|
11+
| 1 | 3.3 v power |
12+
| 3 | GPIO 2 (SDA) |
13+
| 5 | GPIO 3 (SCL) |
14+
| 6 | ground |
15+
16+
17+
Some boards such as the [Adafruit OLED bonnet](https://www.adafruit.com/product/3531) use this same pinout if you want something ready to use without extra wiring or soldering.
18+
19+
## OS Configuration
20+
21+
If you're using Raspbian - [raspi-config](https://www.raspberrypi.org/documentation/configuration/raspi-config.md) has an option to enable I2C by default. If you're using another distro - do a quick search and you will probably find a solution to enable it.
22+
23+
Before running this sample, you can check that your OLED display is detected by installing `i2c-tools` from your distro, then running `i2cdetect -y 1`. The first connected SSD1306 will usually be at address `0x3c`. This sample assumes `0x3c`. If your device is at a different address, then you may need to modify the code for it to work.
24+
25+
```
26+
$ sudo i2cdetect -y 1
27+
0 1 2 3 4 5 6 7 8 9 a b c d e f
28+
00: -- -- -- -- -- -- -- -- -- -- -- -- --
29+
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30+
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
31+
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
32+
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
33+
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
34+
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
35+
70: -- -- -- -- -- -- -- --
36+
```
37+
38+
## Building the code
639

740
The easiest way to build this sample is with [Cross](https://github.com/rust-embedded/cross).
841

@@ -24,8 +57,16 @@ Then SSH to your Pi and run it
2457
sudo ./raspi-oled
2558
```
2659

27-
## Example
60+
## It works!
61+
62+
Once the code is running, it will look like this :)
63+
64+
Commodity SSD1306 boards
65+
66+
![A Raspberry Pi hooked up to a yellow+blue OLED showing the Rust logo](./images/01.jpg)
67+
68+
![A Raspberry Pi hooked up to a yellow+blue OLED showing the IP and some shapes](./images/02.jpg)
2869

29-
![picture](./images/01.jpg)
70+
Adafruit 128x64 OLED bonnet
3071

31-
![primitive](./images/02.jpg)
72+
![A Raspberry Pi hooked up to a yellow+blue OLED showing the IP and some shapes](./images/adafruit-oled.jpg)
326 KB
Loading

0 commit comments

Comments
 (0)
Failed to load comments.