aboutsummaryrefslogtreecommitdiff
path: root/examples/mspm0g3507/src/bin
diff options
context:
space:
mode:
authorSiarhei B <[email protected]>2025-07-29 15:26:34 +0200
committerSiarhei B <[email protected]>2025-08-04 10:19:14 +0200
commitd6a87b411432d9c6eedd48aa30b72cda069bd86c (patch)
tree7520ed4baec23265bf0b43e75ecf2e80be14967a /examples/mspm0g3507/src/bin
parentdc52ead73231ee963d1a492e70e49013df7e7127 (diff)
mspm0-I2C: mention blocking API's restrictions
- blocking API for transfering max 8 bytes - async API has no such limitations
Diffstat (limited to 'examples/mspm0g3507/src/bin')
-rw-r--r--examples/mspm0g3507/src/bin/i2c.rs3
-rw-r--r--examples/mspm0g3507/src/bin/i2c_async.rs8
2 files changed, 6 insertions, 5 deletions
diff --git a/examples/mspm0g3507/src/bin/i2c.rs b/examples/mspm0g3507/src/bin/i2c.rs
index b87a0184f..2e3bf2ca1 100644
--- a/examples/mspm0g3507/src/bin/i2c.rs
+++ b/examples/mspm0g3507/src/bin/i2c.rs
@@ -1,4 +1,5 @@
1//! Example of using blocking I2C 1//! This example uses FIFO with polling, and the maximum FIFO size is 8.
2//! Refer to async example to handle larger packets.
2//! 3//!
3//! This uses the virtual COM port provided on the LP-MSPM0G3507 board. 4//! This uses the virtual COM port provided on the LP-MSPM0G3507 board.
4 5
diff --git a/examples/mspm0g3507/src/bin/i2c_async.rs b/examples/mspm0g3507/src/bin/i2c_async.rs
index 044a71355..294550605 100644
--- a/examples/mspm0g3507/src/bin/i2c_async.rs
+++ b/examples/mspm0g3507/src/bin/i2c_async.rs
@@ -1,4 +1,4 @@
1//! Example of using async I2C 1//! The example uses FIFO and interrupts, wrapped in async API.
2//! 2//!
3//! This uses the virtual COM port provided on the LP-MSPM0G3507 board. 3//! This uses the virtual COM port provided on the LP-MSPM0G3507 board.
4 4
@@ -28,10 +28,10 @@ async fn main(_spawner: Spawner) -> ! {
28 28
29 let mut i2c = unwrap!(I2c::new_async(instance, scl, sda, Irqs, Config::default())); 29 let mut i2c = unwrap!(I2c::new_async(instance, scl, sda, Irqs, Config::default()));
30 30
31 let mut to_read = [0u8; 1]; 31 let mut to_read = [1u8; 17];
32 let to_write: u8 = 0x0F; 32 let to_write = [0u8; 17];
33 33
34 match i2c.async_write_read(ADDRESS, &[to_write], &mut to_read).await { 34 match i2c.async_write_read(ADDRESS, &to_write, &mut to_read).await {
35 Ok(()) => info!("Register {}: {}", to_write, to_read[0]), 35 Ok(()) => info!("Register {}: {}", to_write, to_read[0]),
36 Err(e) => error!("I2c Error: {:?}", e), 36 Err(e) => error!("I2c Error: {:?}", e),
37 } 37 }