.. include:: Firmware: Initial Version (Driven By Interrupts) ================================================ .. toctree:: :hidden: main fsm sensor-switch .. topic:: Components * :doc:`main` * :doc:`fsm` * :doc:`sensor-switch` Observations ------------ * Interrupts are nested * 7 beats 42 and timer * All logic is in ISRs * Reading GPIO state is fine * SPI flash write is not (adds more interrupts) * Network/CAN IO is not (adds even more interrupts) Demo: ``tmux`` Layout, Initialization, Startup ---------------------------------------------- For your orientation: an explanation of the terminal screen layout that is used throughout the course. .. image:: tmux.jpg * Left: application .. code-block:: console $ export PATH=$HOME/My-Builds/jfasch-home-x86_64/trainings/material/soup/linux/why/why-os/shell:$PATH $ why-shell ./why-temperature-controller-bare-metal-initial # or whatever program * Right 1: "Plant Management" .. code-block:: console :caption: Set all to "off" $ cd /tmp/plant $ echo 10 > temperature $ echo 0 > cooling $ echo 0 > soft-alarm $ echo 0 > hard-alarm * Right 2: Later (CAN-Bus) * Right 3: Cooling switch .. code-block:: console $ cd /tmp/plant $ watch cat cooling * Right 4: Soft alarm .. code-block:: console $ cd /tmp/plant $ watch cat soft-alarm * Right 5: Hard alarm .. code-block:: console $ cd /tmp/plant $ watch cat hard-alarm Demo: Switch On Cooling ----------------------- * Right 1: Set temperature above "thermostat high" .. code-block:: console $ echo 500001 > temperature * |longrightarrow| cooling on Demo: Enter Soft Alarm ---------------------- * Right 1: Set temperature above "soft critical" .. code-block:: console $ echo 1000001 > temperature * |longrightarrow| soft alarm on (cooling remains on) Demo: Operator Intervention --------------------------- * Left: inject "operator button" IRQ .. code-block:: console > irq 42 * |longrightarrow| soft alarm off (cooling remains on) Demo: Sensor Burning -------------------- * Left: inject "sensor burning" IRQ .. code-block:: console > irq 7 * |longrightarrow| hard alarm on, cooling off