aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--two_hosts_auto_powerswitch/readme.rst41
-rw-r--r--two_hosts_auto_powerswitch/readme_flowchart.asciiobin0 -> 26794 bytes
2 files changed, 41 insertions, 0 deletions
diff --git a/two_hosts_auto_powerswitch/readme.rst b/two_hosts_auto_powerswitch/readme.rst
index 7eac7fe..2a4617d 100644
--- a/two_hosts_auto_powerswitch/readme.rst
+++ b/two_hosts_auto_powerswitch/readme.rst
@@ -122,3 +122,44 @@ in another location, one does not need the associated devices to be on).
In my case, the wake-on-lan was an exception to the normal usage of my
computer, so I made the skip choice to be in the workflow.
+
+State machines
+==============
+
+- debouncing buttons state tables::
+
+ #0 button released [pin change interrupt] -> debounce start [timeout]
+ -> timeout [button pressed] -> #1 + event button_down
+ -> timeout [button released] -> #0
+
+ #1 button pressed [timeout] -> first up [timeout] -> debounce [timeout]
+ -> timeout [button pressed] -> #1
+ -> timeout [button released] -> #0 + event button_up
+
+Ex of a transition table:
+State Event Next state Transition function
+stopped play_event playing do_play
+playing stop_event stopped do_stop
+playing pause_event paused do_pause
+paused play_event playing do_resume
+paused stop_event stopped do_stop
+
+ex of fsm implem for another language:
+https://github.com/hyperandroid/Automata
+
+ex of fsm implem in c:
+https://github.com/gitrealname/ofsm
+
+formal description in yaml ?
+
+fsm0:
+ initialstate: state0
+ state0:
+ enter: action_enter
+ exit: action_exit
+ events:
+ - event: ok
+ nextstate: state1
+ - event: ...
+ state1:
+ ...
diff --git a/two_hosts_auto_powerswitch/readme_flowchart.asciio b/two_hosts_auto_powerswitch/readme_flowchart.asciio
new file mode 100644
index 0000000..91aa2cc
--- /dev/null
+++ b/two_hosts_auto_powerswitch/readme_flowchart.asciio
Binary files differ