rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
296 stars 68 forks source link

Raspberry Pi example #48

Open jamwaffles opened 6 years ago

jamwaffles commented 6 years ago

This should be a good test to exercise the driver. There's still the outstanding question of how we organise examples but having a variety should help people get up and running quickly.

fmckeogh commented 6 years ago

Done :)

Only thrown together very quickly, but does demonstrate some range of the libraries capabilities as well as differences between I2C and SPI interfaces.

Obviously, I'd like to write some kind of guide (pinouts, and detailed code explanation), but was unsure of how you would like this to be integrated into the project.

img_1201

img_1204

jamwaffles commented 6 years ago

That's awesome! A section in the readme about Raspi support with a quick getting started guide, small code sample and a link to your examples repo and/or a blog post if you decide to write one would be useful.

What do you think about including the examples in this repo, with a comment stating they might not build out of the box with cargo run --example <name> like the others? It would keep them in the same place at the cost of development ease. How hard would it be to get them working with cargo run --example?

fmckeogh commented 6 years ago

I tried that, and even though I think having different build flags and using cargo build --example pi_graphics_spi --target=armv7-unknown-linux-musleabihf would work, the fact that examples can't have their own dependencies will break everything. Some of the cortex-m crates aren't happy with the Pi target, and one of the Pi dependencies requires std. It's a shame cause it really would be the best option.

What do you think about using a workspace to isolate dependencies? I think just a separate repository might be easiest, but it is an option.

jamwaffles commented 6 years ago

I like the idea of a workspace. It should be possible to test that the RPi examples at least build which is much easier when that code is part of the same project. I'd suggest two sub-folders; ssd1306 and examples-rpi. The Cortex M examples might move into their own workspace later, but that's out of scope for this stuff. Do you have any objections to moving your example code into this repo?

fmckeogh commented 6 years ago

Sounds great!

None at all, I'll have a PR from my fork soon :)

jamwaffles commented 6 years ago

Beaut, thank you!

chux0519 commented 4 years ago

@chocol4te 's example doesn't work now. I modified it a little bit, and using docker image to cross compile. here is the working example for now.

jamwaffles commented 4 years ago

Thanks for the fix!

PatrickLang commented 4 years ago

@chux0519 @chocol4te - are either of you planning to submit this? I did a bit more cleanup https://github.com/PatrickLang/raspi-oled/tree/ctrlc. If you're not planning to open a PR, I'm happy to help. From a legal standpoint it would be best if you could add a license file to your repos so I can do this cleanly as a merge and you'll get credit in the history. Otherwise I can write a sample from scratch and submit it separately.

chux0519 commented 4 years ago

@PatrickLang I've added a license to the repo, and for me, feel free to modify that and file a PR

fmckeogh commented 4 years ago

Oops sorry! Which license would be best? The examples I wrote are now 2 years old so do you think its even worth adding mine, especially when https://github.com/chux0519/raspi-oled and https://github.com/PatrickLang/raspi-oled/tree/ctrlc seem a lot more complete?

ukscone commented 3 years ago

I tried to build the example on a raspberry pi and it fails pi@raspberrypi:~/ssd1306/examples/raspi $ cargo clean pi@raspberrypi:~/ssd1306/examples/raspi $ cargo build Compiling void v1.0.2 error[E0463]: can't find crate forstd | = note: thethumbv7m-none-eabi` target may not be installed

error: aborting due to previous error

For more information about this error, try rustc --explain E0463. error: could not compile void.

To learn more, run the command again with --verbose. pi@raspberrypi:~/ssd1306/examples/raspi $

i've tried everything I can think of (not a lot as i'm a Rust newbie)

can anyone give me any hints on how to build this ON a raspberry pi please`

ukscone commented 3 years ago

managed to find a solution. i have to put the target on the build or run command otherwise it tries to use the thumbv7m-none-eabi toolchain rather than the default toolchain for some reason.

btielen commented 2 years ago

I opened a new PR with a simple text example

mgomez0 commented 1 year ago

Would adding an example for a Raspberry Pi Pico be helpful? They would likely be very similar to the Blue Pill examples, but there are enough differences to provide a faster starting point for people using that board. I have a simple "terminal mode" example running now, printing characters to the display.

mgomez0 commented 1 year ago

Ah, I just saw the issue that argues against platform-specific examples in the repo 😅 well, I'm going to keep hacking with this driver on the RPi Pico, and I'm more than willing to open PRs and fix issues as I find them. Thanks for your hard work!