@@ -22,19 +22,18 @@ that just happens to have the same address. As you can read in the LSM303AGR's
2222device. (The "A" is for "Accelerometer" and the "M" is for "Magnetometer".)
2323
2424The only thing missing now is the software part: we need to determine which API of the ` microbit ` or
25- a HAL crate we should use for this. If you read through the datasheet of the nRF chip you are using
26- you will soon find out that it doesn't actually have an I2C-specific peripheral. Instead, it has
27- more general-purpose I2C-compatible peripherals called TWI ("Two-Wire Interface"), TWIM ("Two-Wire
28- Interface Master") and TWIS ("Two-Wire Interface Slave"). We will normally be operating in
29- controller mode and will use the newer TWIM, which supports "Easy DMA" — the TWI is provided mostly
30- for backward compatibility with older devices.
25+ a HAL crate we should use for this. If you read through the [ nRF52833 Product Specification]
26+ you will soon find out that it doesn't actually have an I2C-specific peripheral.
27+ Instead, it has more general-purpose I2C-compatible peripherals called TWI ("Two-Wire
28+ Interface"), TWIM ("Two-Wire Interface Master") and TWIS ("Two-Wire Interface Slave").
29+ We will normally be operating in controller mode and will use the newer TWIM, which
30+ supports "Easy DMA" — the TWI is provided mostly for backward compatibility with older
31+ devices.
3132
3233Now if we put the documentation of the [ ` twi(m) ` module] from the ` microbit ` crate
3334together with all the other information we have gathered so far we'll end up with this
3435piece of code to read out and print the two device IDs (` examples/chip-id.rs ` ):
3536
36- [ `twi(m)` module ] : https://docs.rs/microbit-v2/0.11.0/microbit/hal/twim/index.html
37-
3837``` rust
3938{{#include examples / chip - id . rs}}
4039```
@@ -45,6 +44,9 @@ chapter. We pass the peripheral as well as the pins that are used to communicat
4544the constructor; and then the frequency we wish the bus to operate on, in this case 100 kHz (` K100 ` ,
4645since identifiers can't start with a digit).
4746
47+ [ nRF52833 Product Specification ] : https://docs-be.nordicsemi.com/bundle/ps_nrf52833/attach/nRF52833_PS_v1.7.pdf
48+ [ `twi(m)` module ] : https://docs.rs/microbit-v2/0.11.0/microbit/hal/twim/index.html
49+
4850## Testing it
4951As usual
5052
0 commit comments