Skip to content

Commit 004f129

Browse files
committed
Add README with pictures
1 parent 96a015d commit 004f129

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
I’ve previously played with
2+
and [written about](https://github.com/SimonSapin/rust-on-bbc-microbit#readme)
3+
Rust on [BBC micro:bit](http://microbit.co.uk/),
4+
but kind gave up on it because it’s somewhat difficult
5+
to make good electrical connection with the small pins on the edge connector
6+
and I was getting inconsistent brightness when driving LEDs
7+
directly from the microcontroller’s digital I/O pins
8+
and don’t know why.
9+
10+
So I’ve switched to [Teensy](https://www.pjrc.com/teensy/teensy31.html)
11+
and got started with the
12+
[Bare Metal Rust on the Teensy 3.1](http://disconnected.systems/bare-metal-rust-on-the-teensy-3.1/)
13+
blog post.
14+
While not having any C/C++ code (only Rust and a linker script) seems attractive,
15+
it leaves you re-inverting the entire hardware abstraction layer,
16+
which is not so fun when doing stuff more involved than blinking a LED.
17+
18+
So I want to use [Teensyduino](https://www.pjrc.com/teensy/teensyduino.html),
19+
the runtime software environment based on Arduino that everyone else uses for Teensy.
20+
But I don’t want to use the Arduino IDE.
21+
It turns out that the relevant code is available in
22+
the [PaulStoffregen/cores](https://github.com/PaulStoffregen/cores/) repository
23+
with a example Makefile that uses the `arm-none-eabi-gcc` toolchain.
24+
25+
So far I’ve managed to:
26+
27+
* Add a cross-compiled Rust static library into this mix
28+
* Use [Servo’s rust-bindgen](https://github.com/servo/rust-bindgen) (which has some C++ support)
29+
to automatically generate Rust bindings for all of Teensyduino.
30+
* Have Rust code run on the Teensy and use these bindings for:
31+
* USB serial with a Linux laptop
32+
* i2c / TwoWire with an LED driver chip
33+
* SPI with an RTC chip
34+
* Setting up an interrupt on digital I/O input
35+
36+
This is what’s in this repository.
37+
38+
I’ve then tried to flip the build system around so that Rust makes an executable
39+
and the C/C++ code is a couple of static libraries built with the `gcc` crate (yay, no Makefile!)
40+
…but that doesn’t seem to boot and I don’t know why. (Yet, hopefully.)
41+
This can be found in [the `rustbuild` branch](
42+
https://github.com/SimonSapin/teensy-clock/compare/rustbuild).
43+
Any help with this is appreciated!
44+
45+
The prototyping setup looks like this:
46+
47+
<img src=pictures/proto.jpg height=500>
48+
49+
And this is close to what I want to hang on my wall eventually.
50+
A clock that updates for summer time (a.k.a. daylight saving time) automatically.
51+
52+
<img src=pictures/build1.jpg height=300>
53+
<img src=pictures/build2.jpg height=300>

pictures/build1.jpg

157 KB
Loading

pictures/build2.jpg

165 KB
Loading

pictures/proto.jpg

223 KB
Loading

0 commit comments

Comments
 (0)