ssd1306 icon indicating copy to clipboard operation
ssd1306 copied to clipboard

Raspberry Pi example

Open jamwaffles opened this issue 6 years ago • 16 comments

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.

jamwaffles avatar Apr 08 '18 21:04 jamwaffles

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

fmckeogh avatar Aug 14 '18 20:08 fmckeogh

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?

jamwaffles avatar Aug 14 '18 21:08 jamwaffles

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.

fmckeogh avatar Aug 15 '18 17:08 fmckeogh

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?

jamwaffles avatar Aug 16 '18 08:08 jamwaffles

Sounds great!

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

fmckeogh avatar Aug 16 '18 08:08 fmckeogh

Beaut, thank you!

jamwaffles avatar Aug 16 '18 08:08 jamwaffles

@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.

chux0519 avatar Nov 15 '19 14:11 chux0519

Thanks for the fix!

jamwaffles avatar Nov 18 '19 09:11 jamwaffles

@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.

PatrickLang avatar Aug 04 '20 05:08 PatrickLang

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

chux0519 avatar Aug 04 '20 05:08 chux0519

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?

fmckeogh avatar Aug 04 '20 06:08 fmckeogh

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 for std| = 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 avatar Sep 26 '20 03:09 ukscone

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.

ukscone avatar Sep 28 '20 19:09 ukscone

I opened a new PR with a simple text example

btielen avatar Nov 09 '21 10:11 btielen

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 avatar May 31 '23 13:05 mgomez0

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!

mgomez0 avatar May 31 '23 16:05 mgomez0