From a2c1519597dc7da86d09cb9c8468b89e48c08e49 Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Fri, 25 Dec 2020 01:18:50 +0100
Subject: [PATCH] pmw3389 wip, firmare uplode not yet tested

---
 examples/pmw3389.rs | 8 +++++---
 memory.x            | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/pmw3389.rs b/examples/pmw3389.rs
index 9206c47..56bbc27 100644
--- a/examples/pmw3389.rs
+++ b/examples/pmw3389.rs
@@ -88,7 +88,9 @@ const APP: () = {
         // iprintln!(stim, "t1 {}", t1);
         // iprintln!(stim, "t2 {}", t2);
 
-        let mut pmw3389 = pmw3389::Pmw3389::new(spi, cs, delay).unwrap();
+        let mut pmw3389 = pmw3389::Pmw3389::new(spi, cs, delay, &mut core.ITM).unwrap();
+
+        let stim = &mut core.ITM.stim[0];
         let id = pmw3389.product_id().unwrap();
         iprintln!(stim, "id {}", id);
 
@@ -301,7 +303,7 @@ mod pmw3389 {
             spi: SPI,
             cs: CS,
             delay: DwtDelay,
-            mut itm: stm32f4::stm32f411::ITM,
+            itm: &mut stm32f4::stm32f411::ITM,
         ) -> Result<Self, E> {
             let mut pmw3389 = Pmw3389 { spi, cs, delay };
 
@@ -389,7 +391,7 @@ mod pmw3389 {
         }
 
         ///
-        pub fn upload_firmware(&mut self, mut itm: stm32f4::stm32f411::ITM) -> Result<(), E> {
+        pub fn upload_firmware(&mut self, itm: &mut stm32f4::stm32f411::ITM) -> Result<(), E> {
             let stim = &mut itm.stim[0];
             // send the firmware to the chip, cf p.18 of the datasheet
             // Serial.println("Uploading firmware...");
diff --git a/memory.x b/memory.x
index b28d0cd..3f5f41f 100644
--- a/memory.x
+++ b/memory.x
@@ -3,7 +3,7 @@ MEMORY
   /* NOTE 1 K = 1 KiBi = 1024 bytes */
   /* TODO Adjust these memory regions to match your device memory layout */
   /* These values correspond to the STM32F411 */
-  FLASH : ORIGIN = 0x08000000, LENGTH = 64K
+  FLASH : ORIGIN = 0x08000000, LENGTH = 256K
   RAM : ORIGIN = 0x20000000, LENGTH = 64K
 }
 
-- 
GitLab