this post was submitted on 03 Aug 2023
8 points (90.0% liked)

Embedded

452 readers
1 users here now

This sub is dedicated to discussion and questions about embedded systems: "a controller programmed and controlled by a real-time operating system (RTOS) with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints."

founded 2 years ago
MODERATORS
 

I'm trying to run an LED matrix display (with a Max7219 controller) from a raspberry pi pico using rust. There is a max7219-crate that I used. But i am unsure about how to prepare the pins I want to use. Can I Use any of the pins? Do I have to set them to push-pull-output?

you are viewing a single comment's thread
view the rest of the comments
[–] orclev 3 points 1 year ago* (last edited 1 year ago)

If you follow that link I provided there's an example in there of exactly how to initialize SPI. The example uses it to control a MMC, but most of the setup (except the speed) should be essentially identical for you.

Here's a direct link to the relevant example: SPI SD Card example

Also the example code on the crate itself is a pretty good place to start. It's using bit bashing rather than hardware SPI, but if you follow everything after the from_pins call and use most of the stuff from the SPI SD card example but init the MAX7219 using from_spi instead you should be up an running in no time.