User Tools

Site Tools


en:pfw:switchledwithbutton

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:pfw:switchledwithbutton [2025-06-22 00:03] – [Pseudo code for togglgeLED implementation] mkaen:pfw:switchledwithbutton [2025-06-22 00:26] (current) – ↷ Links angepasst, weil Seiten im Wiki verschoben wurden mka
Line 165: Line 165:
  
 You can use it as follows: You can use it as follows:
 +<code>
 +toggleled <ret>
 +</code>
  
-   toggleled <ret> 
-    
 ==== Glossary ==== ==== Glossary ====
  
-clavis? and tasto? are different methods for querying the button.+''clavis?'' and ''tasto?'' are different methods for querying the button.
  
-Clavis? checks whether there has been a falling edge on the pin. The port pin remembers this in its interrupt flag bit, requiring no additional wiring on the MCU.+''Clavis?'' checks whether there has been a falling edge on the pin. The port pin remembers this in its interrupt flag bit, requiring no additional wiring on the MCU.
  
-Tasto?, on the other hand, monitors the logic level on the port pin several times in succession. Only when all queries have returned an H level is it assumed that the bouncing is over, i.e., the button has been released.+''Tasto?'', on the other hand, monitors the logic level on the port pin several times in succession. Only when all queries have returned an H level is it assumed that the bouncing is over, i.e., the button has been released.
  
 With these two routines, the state of the LED can be toggled back and forth. With these two routines, the state of the LED can be toggled back and forth.
-Only when the button has been safely released does clavis? fire on the next keypress.+Only when the button has been safely released does ''clavis?'' fire on the next keypress.
  
-The "smaller" Forth words in between are simply factored-out parts of the toggleLED routine. These are useful during the interactive testing phase. +The "smaller" Forth words in between are simply factored-out parts of the ''toggleLED'' routine. These are useful during the interactive testing phase. 
  
  
 ==== Background information ==== ==== Background information ====
  
-See clavis? and tasto? for more background information.+See [[en:pfw:clavis|clavis?]] and [[en:pfw:tasto|tasto?]] for more background information.
  
-Here, clavis? has been configured to immediately clear its interrupt flag after the query. This isn't really necessary, since it can only be queried again after tasto? allows it and has cleared the flag.+Here, ''clavis?'' has been configured to immediately clear its interrupt flag after the query. This isn't really necessary, since it can only be queried again after ''tasto?'' allows it and has cleared the flag.
  
 ==== Possible Pitfalls ==== ==== Possible Pitfalls ====
en/pfw/switchledwithbutton.1750543402.txt.gz · Last modified: 2025-06-22 00:03 by mka