]> Vexing Labs - forthdeck.git/commitdiff
Expand GPIO docs just a bit
authorAdam Shamblin <adam@vexingworkshop.com>
Sun, 26 Jun 2022 21:19:44 +0000 (15:19 -0600)
committerAdam Shamblin <adam@vexingworkshop.com>
Sun, 26 Jun 2022 21:19:44 +0000 (15:19 -0600)
doc/gpio.md

index f9240dd5c8f92b6f7b1f98e6f3dc47b7488d9a79..64f1d3932cda3954c773ceffe5c45d5becc210ce 100644 (file)
@@ -6,6 +6,23 @@ file: gpio.fs
 The GPIO library provides a number of constants and words for working directly
 with the GPIO pins of the rp2040.
 
+## Turn It On and Off Again
+
+As an example, we may use the functions present to turn off and on the Raspberry
+Pi Pico's onboard LED, mapped to GPIO pin 25:
+
+```forth
+25 pin SIO funcsel!
+25 output-enable
+25 high
+```
+
+Setting pin 25 to high will turn on the LED. To turn it off again:
+
+```forth
+25 low
+```
+
 ## Function Selection
 
 The Raspberry Pi Pico has 30 programmable pins. Each of these pins may be used
@@ -41,8 +58,42 @@ selected pin's function.
 
 Display a list of all GPIO pins and their currently selected function.
 
-```forth
-pins
+example:
+
+```
+pins 
+0 2 
+1 2 
+2 5 
+3 5 
+4 5 
+5 5 
+6 5 
+7 5 
+8 5 
+9 5 
+10 5 
+11 5 
+12 5 
+13 5 
+14 5 
+15 5 
+16 5 
+17 5 
+18 5 
+19 5 
+20 5 
+21 5 
+22 5 
+23 5 
+24 5 
+25 5 
+26 5 
+27 5 
+28 5 
+29 5 
+ ok.
+
 ```
 
 ## Output
@@ -71,4 +122,36 @@ Display a table of pins and their output status.
 
 ```forth
 output-enabled.
+0 Off
+1 Off
+2 Off
+3 Off
+4 Off
+5 Off
+6 Off
+7 Off
+8 Off
+9 Off
+10 Off
+11 Off
+12 Off
+13 Off
+14 Off
+15 Off
+16 Off
+17 Off
+18 Off
+19 Off
+20 Off
+21 Off
+22 Off
+23 Off
+24 Off
+25 On
+26 Off
+27 Off
+28 Off
+29 Off
+ ok.
+
 ```