From 37f3088d9cc6d14c9758071ce4ed5cdc79917c75 Mon Sep 17 00:00:00 2001
From: Neil Gershenfeld <gersh@cba.mit.edu>
Date: Mon, 26 Dec 2022 20:51:30 -0500
Subject: [PATCH] wip

---
 GPIO/RP2040/ring.RP2040.ino | 19 +++++++++++++++++++
 index.html                  |  7 +++++++
 2 files changed, 26 insertions(+)

diff --git a/GPIO/RP2040/ring.RP2040.ino b/GPIO/RP2040/ring.RP2040.ino
index 63b6548..9e41534 100644
--- a/GPIO/RP2040/ring.RP2040.ino
+++ b/GPIO/RP2040/ring.RP2040.ino
@@ -12,6 +12,9 @@
 // warranty is provided, and users accept all liability.
 //
 
+#define digitalWriteFast(pin,val) gpio_put(pin, val ? 1 : 0)
+#define digitalReadFast(pin) (gpio_get(pin) ? 1 : 0)
+
 void setup() {
    //
    // nothing to do in first core
@@ -36,12 +39,27 @@ void loop1() {
    //
    uint32_t pin1 = (1 << 1);
    uint32_t pin2 = (1 << 2);
+   /**/
    while (1) {
       if (pin1 & sio_hw->gpio_in)
          sio_hw->gpio_clr = pin2;
       else
          sio_hw->gpio_set = pin2;
       }
+   /**/
+   //
+   // Arduino Fast version
+   //    8.77 MHz at 250 MHz clock
+   //    8.16 MHz at 133 MHz clock
+   //
+   /*
+   while (1) {
+      if (digitalReadFast(1))
+         digitalWriteFast(2,LOW);
+      else
+         digitalWriteFast(2,HIGH);
+      }
+   */
    //
    // Arduino version
    //    1.11 MHz at 250 MHz clock
@@ -56,3 +74,4 @@ void loop1() {
       }
    */
    }
+
diff --git a/index.html b/index.html
index d73b24d..4b9a7b4 100644
--- a/index.html
+++ b/index.html
@@ -67,6 +67,13 @@ The GPIO test measures how quickly pins can communicate with a processor core; t
 <td>December 2022</td>
 </tr>
 
+<tr>
+<td>8.77</td>
+<td>RP2040</td>
+<td><a href=GPIO/RP2040/ring.RP2040.ino>Arduino, digitalRead/WriteFast, 250 MHz</a></td>
+<td>December 2022</td>
+</tr>
+
 <tr>
 <td>4.62</td>
 <td>ATSAME54</td>
-- 
GitLab