mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Add link to example in book
This commit is contained in:
parent
03f3a3389d
commit
af9c7379f9
@ -127,4 +127,8 @@ async fn toggle_led(control: Sender<'static, ThreadModeRawMutex, LedState, 64>,
|
|||||||
This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure
|
This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure
|
||||||
that the operation is completed before continuing to do other work in your task.
|
that the operation is completed before continuing to do other work in your task.
|
||||||
|
|
||||||
An example showcasing more methods for sharing link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here].
|
An example showcasing more methods for sharing link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here].
|
||||||
|
|
||||||
|
== Sharing an I2C or SPI bus between multiple devices
|
||||||
|
|
||||||
|
An example of how to deal with multiple devices sharing a common I2C or SPI bus link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/shared_bus.rs[can be found here].
|
||||||
|
@ -92,7 +92,7 @@ async fn spi_task_b(spi_bus: &'static Spi1Bus, cs: Output<'static>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dummy I2C device driver, implementing `embedded-hal-async`
|
// Dummy I2C device driver, using `embedded-hal-async`
|
||||||
struct DummyI2cDeviceDriver<I2C: embedded_hal_async::i2c::I2c> {
|
struct DummyI2cDeviceDriver<I2C: embedded_hal_async::i2c::I2c> {
|
||||||
_i2c: I2C,
|
_i2c: I2C,
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ impl<I2C: embedded_hal_async::i2c::I2c> DummyI2cDeviceDriver<I2C> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dummy SPI device driver, implementing `embedded-hal-async`
|
// Dummy SPI device driver, using `embedded-hal-async`
|
||||||
struct DummySpiDeviceDriver<SPI: embedded_hal_async::spi::SpiDevice> {
|
struct DummySpiDeviceDriver<SPI: embedded_hal_async::spi::SpiDevice> {
|
||||||
_spi: SPI,
|
_spi: SPI,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user