Kabuki Starship / SickBayTek

Dependencies:   KabukiTek

Dependents:   GHVentilator

Files at this revision

API Documentation at this revision

Comitter:
kabukistarship
Date:
Sat Apr 11 08:48:12 2020 +0000
Parent:
0:7319afbc731c
Commit message:
Detail.Tek.Describe The SickBay Device firmware toolkit built with Kabuki Tek. #76

Changed in this revision

KabukiTek.lib Show annotated file Show diff for this revision Revisions of this file
SBVentilator.h Show annotated file Show diff for this revision Revisions of this file
SBVentilator.hpp Show annotated file Show diff for this revision Revisions of this file
SBVentilatorChannel.h Show annotated file Show diff for this revision Revisions of this file
SBVentilatorChannel.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/KabukiTek.lib	Sat Apr 11 01:15:10 2020 +0000
+++ b/KabukiTek.lib	Sat Apr 11 08:48:12 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/kabukistarship/code/KabukiTek/#88767c46ae45
+https://os.mbed.com/users/kabukistarship/code/KabukiTek/#1a1cf1ae06f3
--- a/SBVentilator.h	Sat Apr 11 01:15:10 2020 +0000
+++ b/SBVentilator.h	Sat Apr 11 08:48:12 2020 +0000
@@ -98,29 +98,30 @@
   /* Sets the inhale and exhale ticks for the give channel Index. */
   int TicksInhaleExhaleSet (int Index, int TicksInhale, int TicksExhale);
   
-  /* Starts the system. */   
-  void Run ();
-  
+  /* Calls on of the Channel1ValveSet through Channel4ValveSet functions. */
   void ChannelValveSet (SBVentilatorChannel* Channel, int Value);
   
   /* Sets the Channel 1 solenoid valve to the given Value. */
   void Channel1ValveSet (int Value);
-  #if SBVentilatorChannelCount >= 2
+  //#if SBVentilatorChannelCount >= 2
   /* Sets the Channel 2 solenoid valve to the given Value. */
   void Channel2ValveSet (int Value);
-  #endif
-  #if SBVentilatorChannelCount >= 3
+  //#endif
+  //#if SBVentilatorChannelCount >= 3
   /* Sets the Channel 3 solenoid valve to the given Value. */
   void Channel3ValveSet (int Value);
-  #endif
-  #if SBVentilatorChannelCount >= 4
+  //#endif
+  //#if SBVentilatorChannelCount >= 4
   /* Sets the Channel 4 solenoid valve to the given Value. */
   void Channel4ValveSet (int Value);
-  #endif
+  //#endif
   
   /* Updates the main device and it's channels. */
   void Update ();
   
+  /* Main program loop. */
+  void Run ();
+  
 };
 
 }   //< namespace SickBay
--- a/SBVentilator.hpp	Sat Apr 11 01:15:10 2020 +0000
+++ b/SBVentilator.hpp	Sat Apr 11 08:48:12 2020 +0000
@@ -7,8 +7,9 @@
 v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain 
 one at <https://mozilla.org/MPL/2.0/>. */
 
+#include <_KabukiTek.hpp>
 #include "SBVentilator.h"
-#include <mbedBug.h>
+#include "SBVentilatorChannel.hpp"
 
 namespace SickBay {
 
@@ -45,7 +46,6 @@
     Channels[Index].Init (this, TicksInhale, TicksExhale, 
                           static_cast<uint32_t>(Delta));
   }
-  DPrintf("\nInitalized system with %d Ticks per Second.", TicksSecond);
 }
 
 void SBVentilator::TicksPEEPSet (int NewTicksPEEP) {
@@ -167,5 +167,4 @@
     Ticks = Tick;
   }
 }
-}   //< namespace SickBay
-#include "SBVentilatorChannel.hpp"
\ No newline at end of file
+}   //< namespace SickBay
\ No newline at end of file
--- a/SBVentilatorChannel.h	Sat Apr 11 01:15:10 2020 +0000
+++ b/SBVentilatorChannel.h	Sat Apr 11 08:48:12 2020 +0000
@@ -9,10 +9,9 @@
 #pragma once
 #ifndef SBVentilatorChannelDecl
 #define SBVentilatorChannelDecl
-#include <stdint.h>
+#include <_Config.h>
 #ifndef SBVentilatorChannelCount
-#error You must define the SBVentilatorChannelCount before including \
-       "SBVentilator.hpp"
+#define SBVentilatorChannelCount 1
 #endif
 namespace SickBay {
     
--- a/SBVentilatorChannel.hpp	Sat Apr 11 01:15:10 2020 +0000
+++ b/SBVentilatorChannel.hpp	Sat Apr 11 08:48:12 2020 +0000
@@ -9,9 +9,6 @@
 
 #include "SBVentilatorChannel.h"
 
-#include <_Config.h>
-using namespace _;
-
 namespace SickBay {
 
 SBVentilatorChannel::SBVentilatorChannel () :
@@ -47,16 +44,16 @@
   }
   TicksInhale = NewTicksInhale;
   TicksExhale = NewTicksExhale;
-  if (Tick < 0) { // We're exhaling.
+  if (Tick < 0) { // StateExhaling.
     if (Ticks > NewTicksExhale) {
-        Ticks = NewTicksExhale;
-        Inhale ();
+      Ticks = NewTicksExhale;
+      Inhale ();
     }
   }
-  else if (Tick > 0) { // We're inhaling.
+  else if (Tick > 0) { // StateInhaling.
     if (Ticks > NewTicksInhale) {
-        Ticks = NewTicksInhale;
-        Exhale ();
+      Ticks = NewTicksInhale;
+      Exhale ();
     }
     return;
   }