boilerplate

  • no standard library
  • no standard main function

tasks

  • embassy defines async functions and labels them “tasks”
  • tasks are spawned by the spawner
  • we pass gpio pins into the tasks
  • the passed objects need lifetimes, as the data objects passed into the tasks need to live as long as the function is able to be ran
  • these example tasks were run indefinitely, so 'static lifetime works

peripherals

  • pins are retrieved from the peripherals object
  • gpio can be set_high() and set_low() with function calls, abstracting away rcc and mode registers etc.
  • pins can be read with pin.is_high() and pin.is_low()

timers

  • timers can be called globally with Timer::after_millis(500)

exti input

  • pass pin as exti input to trigger interrupts
  • external interrupts can be setup with wait_for_any_edge().await inside a task

tooling

  • panic-probe
    • creates hooks for probe-rs to be able to catch and debug caught panics
  • defmt
    • “deformat” allows you to create debug / info debug lines that avoids strings to get copied to the binary, only visible during debugging

resources