Kabuki Starship / Mbed 2 deprecated GHVentilator

Dependencies:   mbed SickBayTek

Committer:
kabukistarship
Date:
Wed Apr 08 11:28:42 2020 +0000
Revision:
4:de69851cf725
Parent:
3:d15b6579b5ae
Child:
5:da629056644f
Misc fixes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kabukistarship 2:1578ecfa9377 1 /** Gravity Hookah Ventilator @version 0.x
kabukistarship 3:d15b6579b5ae 2 @link https://github.com/KabukiStarship/SickBay.git
kabukistarship 3:d15b6579b5ae 3 @file /GHVentilator.h
kabukistarship 2:1578ecfa9377 4 @author Cale McCollough <https://cale-mccollough.github.io>
kabukistarship 2:1578ecfa9377 5 @license Copyright 2020 (C) Kabuki Starship <kabukistarship.com>.
kabukistarship 2:1578ecfa9377 6 This Source Code Form is subject to the terms of the Mozilla Public License,
kabukistarship 2:1578ecfa9377 7 v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain
kabukistarship 2:1578ecfa9377 8 one at <https://mozilla.org/MPL/2.0/>. */
kabukistarship 2:1578ecfa9377 9 #pragma once
kabukistarship 2:1578ecfa9377 10 #ifndef GHVentilatorDecl
kabukistarship 2:1578ecfa9377 11 #define GHVentilatorDecl
kabukistarship 2:1578ecfa9377 12 #include "GHVentilatorChannel.h"
kabukistarship 2:1578ecfa9377 13 namespace SickBay {
kabukistarship 2:1578ecfa9377 14
kabukistarship 2:1578ecfa9377 15 /* A Gravity Hookah Ventilator. */
kabukistarship 2:1578ecfa9377 16 class GHVentilator {
kabukistarship 3:d15b6579b5ae 17 public:
kabukistarship 3:d15b6579b5ae 18
kabukistarship 3:d15b6579b5ae 19 enum {
kabukistarship 3:d15b6579b5ae 20 ChannelCountMax = 4,
kabukistarship 3:d15b6579b5ae 21 StateCalibratingPressureSensor = 0,
kabukistarship 3:d15b6579b5ae 22 StateRunning = 1,
kabukistarship 3:d15b6579b5ae 23 };
kabukistarship 3:d15b6579b5ae 24
kabukistarship 3:d15b6579b5ae 25 // The tick and negative calibrating positive running states.
kabukistarship 3:d15b6579b5ae 26 int Ticks,
kabukistarship 4:de69851cf725 27 TicksMax, //< The max tick count before it gets reset.
kabukistarship 4:de69851cf725 28 TicksSecond, //< The number of Ticks per Second.
kabukistarship 4:de69851cf725 29 TicksInhaleMin, //< The min inhale ticks.
kabukistarship 4:de69851cf725 30 TicksInhaleMax, //< The max breath period of 20 seconds.
kabukistarship 4:de69851cf725 31 TicksExhaleMin, //< The min ticks in an exhale.
kabukistarship 4:de69851cf725 32 TicksExhaleMax, //< The max ticks in an exhale.
kabukistarship 4:de69851cf725 33 TicksCalibration, //< The number of ticks in the calibration state.
kabukistarship 4:de69851cf725 34 ChannelsCount; //< The number of GHVentilatorChannels.
kabukistarship 4:de69851cf725 35 GHVentilatorChannel* Channels[ChannelCountMax];
kabukistarship 4:de69851cf725 36 BMP280 Atmosphere; //< Pressure sensor for the air tank.
kabukistarship 4:de69851cf725 37 float Pressure, //< The Pressure in the tank.
kabukistarship 4:de69851cf725 38 PressureMin, //< The min Pressure.
kabukistarship 4:de69851cf725 39 PressureMax, //< The max Pressure.
kabukistarship 4:de69851cf725 40 PressureHysteresis; //< The percent hystersis for the Pressure chamber.
kabukistarship 4:de69851cf725 41 DigitalOut Blower; //< A blower powered by a Solid State Relay.
kabukistarship 4:de69851cf725 42 DigitalOut Status; //< Status pin for outputing the Device status.
kabukistarship 4:de69851cf725 43 Ticker UpdateTicker; //< The x times per second update ticker.
kabukistarship 3:d15b6579b5ae 44
kabukistarship 4:de69851cf725 45 /* Constructs a GHV with 1 channel. */
kabukistarship 3:d15b6579b5ae 46 GHVentilator (int TicksPerSecond, int TicksCalibration,
kabukistarship 4:de69851cf725 47 I2C& AtmosphereBus, char AtmosphereAddress,
kabukistarship 4:de69851cf725 48 float PressureHysteresis,
kabukistarship 4:de69851cf725 49 PinName BlowerPin, PinName StatusPin,
kabukistarship 4:de69851cf725 50 GHVentilatorChannel* A);
kabukistarship 3:d15b6579b5ae 51
kabukistarship 4:de69851cf725 52 /* Constructs a GHV with 2 channels. */
kabukistarship 3:d15b6579b5ae 53 GHVentilator (int TicksPerSecond, int TicksCalibration,
kabukistarship 4:de69851cf725 54 I2C& AtmosphereBus, char AtmosphereAddress,
kabukistarship 4:de69851cf725 55 float PressureHysteresis,
kabukistarship 4:de69851cf725 56 PinName BlowerPin, PinName StatusPin,
kabukistarship 4:de69851cf725 57 GHVentilatorChannel* A,
kabukistarship 4:de69851cf725 58 GHVentilatorChannel* B);
kabukistarship 3:d15b6579b5ae 59
kabukistarship 4:de69851cf725 60 /* Constructs a GHV with 3 channels. */
kabukistarship 3:d15b6579b5ae 61 GHVentilator (int TicksPerSecond, int TicksCalibration,
kabukistarship 4:de69851cf725 62 I2C& AtmosphereBus, char AtmosphereAddress,
kabukistarship 4:de69851cf725 63 float PressureHysteresis,
kabukistarship 4:de69851cf725 64 PinName BlowerPin, PinName StatusPin,
kabukistarship 4:de69851cf725 65 GHVentilatorChannel* A,
kabukistarship 4:de69851cf725 66 GHVentilatorChannel* B,
kabukistarship 4:de69851cf725 67 GHVentilatorChannel* C);
kabukistarship 3:d15b6579b5ae 68
kabukistarship 4:de69851cf725 69 /* Constructs a GHV with 4 channels. */
kabukistarship 4:de69851cf725 70 GHVentilator (int TicksPerSecond, int TicksCalibration,
kabukistarship 4:de69851cf725 71 I2C& AtmosphereBus, char AtmosphereAddress,
kabukistarship 4:de69851cf725 72 float PressureHysteresis,
kabukistarship 4:de69851cf725 73 PinName BlowerPin, PinName StatusPin,
kabukistarship 4:de69851cf725 74 GHVentilatorChannel* A,
kabukistarship 4:de69851cf725 75 GHVentilatorChannel* B,
kabukistarship 4:de69851cf725 76 GHVentilatorChannel* C,
kabukistarship 4:de69851cf725 77 GHVentilatorChannel* D);
kabukistarship 3:d15b6579b5ae 78
kabukistarship 3:d15b6579b5ae 79 /* Gets the GHVentilatorChannel with the given Index. \
kabukistarship 3:d15b6579b5ae 80 @return Nil if the Index is out of bounds. */
kabukistarship 3:d15b6579b5ae 81 GHVentilatorChannel* Channel(int Index);
kabukistarship 4:de69851cf725 82
kabukistarship 3:d15b6579b5ae 83 /* Reads the Atmospher.Pressure() and Atmospher.Temperature () */
kabukistarship 3:d15b6579b5ae 84 void TarePressure();
kabukistarship 3:d15b6579b5ae 85
kabukistarship 4:de69851cf725 86 /* Sets the inhale and exhale ticks for the give channel Index. */
kabukistarship 4:de69851cf725 87 int TicksInhaleExhaleSet (int Index, int TicksInhale, int TicksExhale);
kabukistarship 3:d15b6579b5ae 88
kabukistarship 3:d15b6579b5ae 89 /* Starts the system. */
kabukistarship 4:de69851cf725 90 void Run ();
kabukistarship 3:d15b6579b5ae 91
kabukistarship 3:d15b6579b5ae 92 /* Updates the main device and it's channels. */
kabukistarship 3:d15b6579b5ae 93 void Update ();
kabukistarship 2:1578ecfa9377 94 };
kabukistarship 2:1578ecfa9377 95
kabukistarship 2:1578ecfa9377 96 } //< namespace SickBay
kabukistarship 2:1578ecfa9377 97 #endif
kabukistarship 4:de69851cf725 98 #undef GHVentilatorChannelsCount