Skip to content

Ledstrip based matrix to light your room, made alive by using a simple Game Of Life algorithm.Toy project to play with embassy-rs and rust on raspberry-pi Pico, use with appropriate care.

License

Notifications You must be signed in to change notification settings

pmirabel/pico-game-of-light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pico-game-of-light : Mathematically alive lighting

⚠️ 🚧 Toy project to play with embassy-rs and rust on raspberry-pi Pico, use with appropriate care.

nice_gif_here

1.2. Hardware

1.2.1. BOM (bill of material)

1.2.2. Schematics

                           ┌──RP2040───┐
                      ┌────┤VSYS       │
                      │    │           │
                      │  ┌─┤GND    IO8 │
                      │  │ └─────────┬─┘
  ┌─────┐   ┌────┐    │  │ ┌─────────┴─┐ ┌──────┐
  │  +5V├─>─┤ C1 ├──┬─┴──┼─┤           ├─┤+3.3V │
──►     │   │100 │  │    │ │ TTL LLV   │ │      ◄──
  │  GND├─>─┤ùF  ├──┼───┬┴─┤ 3.3 -> 5V ├─┤GND   │
  └─────┘   └────┘  │   │  └─────────┬─┘ └──────┘
                    │   │   ┌────────┘
                  ┌─┴─┬─┴─┬─┴─┐
                  │+5V│GND│Din│
        ┌─┬───────┼───┼───┼───┼───────┐
        │ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤▼│
        │▼├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ │
        │ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤▼│
        │▼├┼┼┼┼┼┼┼───┼─────┼┼┼┼┼┼┼┼┼│ │
        │ │┼┼┼┼┼┼│LED│STRIP│┼┼┼┼┼┼┼┼┤▼│
        │▼├┼┼┼┼┼┼┼───┼─────┼┼┼┼┼┼┼┼┼│ │
        │ │┼┼┼┼┼┼┼┼────┼┼┼┼┼┼┼┼┼┼┼┼┼┤▼│
        │▼├┼┼┼┼┼┼┼│8*18│┼┼┼┼┼┼┼┼┼┼┼┼│ │
        │ │┼┼┼┼┼┼┼┼────┼┼┼┼┼┼┼┼┼┼┼┼┼│ │
        └─┴─────────────────────────┴─┘

1.3. Software

1.3.1. Requirements

source : rp-rs github project requirements

  • The standard Rust tooling (cargo, rustup) : eg. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Toolchain support for the cortex-m0+ processors in the rp2040 (thumbv6m-none-eabi) : eg. rustup target add thumbv6m-none-eabi
  • flip-link - this allows you to detect stack-overflows on the first core, which is the only supported target for now. : eg. cargo install flip-link
  • probe-run. Upstream support for RP2040 was added with version 0.3.1. eg. cargo install probe-run
  • A CMSIS-DAP probe. (J-Link and other probes will not work with probe-run)
    • I use a second Pico as a CMSIS-DAP debug probe.

To develop with async (embedded) Rust 🦀 with embassy framwework

1.3.2. GOL rules

graph TD
    loop{{for each cell}}--> living_or_not{{is cell alive ?}}
    living_or_not-->|yes|should_survive{{if N < 2 or N >3}}
    should_survive--> |yes|cell_die[cell die <br/><i>loneliness or overpopulation]
    should_survive--> |no|cell_live[cell stay alive]
    living_or_not-->|no|should_born{{if N == 3}}
    should_born-->|yes|born[living cell born]
    should_born-->|no|dead[cell still dead]
Loading

1.3.3. Notes for future me

  • The boilerplate to develop on RP2040 is here : https://github.com/SupImDos/embassy-rp-skeleton

  • Section about how to use a second Pico as probe : https://github.com/SupImDos/embassy-rp-skeleton#hardware-setup

  • Write tests. See below discussion about how to ...

  • Use nightly : rustup override set nightly

  • Me

    ...would you tell me how do you implement test (mainly unit testing, but why not integ too) in your embassy based projects?

  • dirbaio

    if it's hardware-independent logic, so you can run the tests in the host, it's easiest to separate that code into its own crate, and use regular Rust tests if it's hardware-dependent then there's defmt-test. defmt-test has some limitations though (can't have tests in multiple modules, can't reinitialize hardware between tests) so for some I've ended up doing one binary for each test, and scripting something to flash+run them in succession

About

Ledstrip based matrix to light your room, made alive by using a simple Game Of Life algorithm.Toy project to play with embassy-rs and rust on raspberry-pi Pico, use with appropriate care.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published