From 9b8608edd064b419ac81d56edd3ed54a87662fd5 Mon Sep 17 00:00:00 2001 From: Adam Shamblin Date: Sun, 26 Jun 2022 15:19:44 -0600 Subject: [PATCH] Expand GPIO docs just a bit --- doc/gpio.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/doc/gpio.md b/doc/gpio.md index f9240dd..64f1d39 100644 --- a/doc/gpio.md +++ b/doc/gpio.md @@ -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. + ``` -- 2.39.5