Skip to content

Commit

Permalink
Call peripherals by their correct name and link to docs.embassy.dev i…
Browse files Browse the repository at this point in the history
…nstead of docs.rs
  • Loading branch information
diondokter authored and squell committed Nov 8, 2024
1 parent 238ff81 commit f55e0f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion book/src/embedded-ecosystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In both cases you can add the `--release` flag to turn on optimizations.
<details>
<summary><b>Some pointers to help you get started</b></summary>

- You can find the documentation on the HAL here on [docs.rs](https://docs.rs/embassy-nrf/latest/embassy_nrf/twim/struct.Twim.html). This website aggregates documentation on virtually every crate published on <https://crates.io>.
- You can find the documentation on the HAL here on [docs.embassy.dev](https://docs.embassy.dev/embassy-nrf/git/nrf52833/index.html). This website houses the docs for embassy for every available chip. Normally you'd search at [docs.rs](https://docs.rs), but that only shows one possible configuration of the HAL.
- To find out how to configure I2C for the nRF52833: [embassy-nrf TWIM demo example](https://github.com/embassy-rs/embassy/blob/main/examples/nrf52840/src/bin/twim.rs).
- You can find the LSM303AGR data sheet here: <https://www.st.com/resource/en/datasheet/lsm303agr.pdf>. You can find the accelerometer device ID in the `WHO_AM_I_A` register, at register address `0x0F`. You'll need `0x19` to address the accelerometer itself.
- Use the [`Twim::blocking_write_then_read`](https://docs.embassy.dev/embassy-nrf/git/nrf52833/twim/struct.Twim.html#method.blocking_write_read) method to first write the device address, then write the register address, and then read its contents into a buffer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use embassy_nrf as hal;
use hal::twim;
use rtt_target::{rprintln, rtt_init_print};

// STEP 1: Bind the interrupt of peripheral 0 to the TWIM ISR
// STEP 1: Bind the interrupt of TWISPI0 to the TWIM ISR (hint: it has a really long and weird name)

#[cortex_m_rt::entry]
fn main() -> ! {
rtt_init_print!();
Expand All @@ -18,7 +19,7 @@ fn main() -> ! {
rprintln!("Starting");


// STEP 2 Set up the TWIM0 peripheral (that supports I2C), so that it uses
// STEP 2 Set up the TWISPI0 peripheral (that supports I2C), so that it uses
// P0.16 for SDA and P0.08 for SCL

// STEP 3 Read the ID register of the LSM303AGR's accelerometer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() -> ! {
// We prefix a variable name with an underscore to
// turn off warnings about it not being used.
let _cp = cortex_m::Peripherals::take().unwrap();
// Use `dp` to get a handle to the TWIM peripheral
// Use `dp` to get a handle to the TWISPI0 peripheral
let dp = hal::init(Default::default());

rprintln!("Starting");
Expand Down

0 comments on commit f55e0f1

Please sign in to comment.