Kabuki Starship / Mbed 2 deprecated GHVentilator

Dependencies:   mbed SickBayTek

Committer:
kabukistarship
Date:
Wed Apr 08 12:36:36 2020 +0000
Revision:
5:da629056644f
Parent:
4:de69851cf725
Child:
6:b2672da545f1
Fixed compile errors.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kabukistarship 2:1578ecfa9377 1 /** Gravity Hookah Ventilator @version 0.x
kabukistarship 2:1578ecfa9377 2 @link https://github.com/KabukiStarship/SickBay.git
kabukistarship 2:1578ecfa9377 3 @file /GHVentilatorChannel.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
kabukistarship 2:1578ecfa9377 10 #pragma once
kabukistarship 2:1578ecfa9377 11 #ifndef GHVentilatorChannelDecl
kabukistarship 2:1578ecfa9377 12 #define GHVentilatorChannelDecl
kabukistarship 2:1578ecfa9377 13 #include "GHVentilatorConfig.h"
kabukistarship 2:1578ecfa9377 14 #include "BMP280.h"
kabukistarship 2:1578ecfa9377 15
kabukistarship 2:1578ecfa9377 16 namespace SickBay {
kabukistarship 2:1578ecfa9377 17
kabukistarship 2:1578ecfa9377 18 /* A Gravity Hookah Ventilator channel for one patient. */
kabukistarship 2:1578ecfa9377 19 class GHVentilatorChannel {
kabukistarship 4:de69851cf725 20 public:
kabukistarship 2:1578ecfa9377 21
kabukistarship 4:de69851cf725 22 int Ticks, //< Ticks since the beginning of the inhale.
kabukistarship 4:de69851cf725 23 TicksExhale, //< The period of the breathing.
kabukistarship 4:de69851cf725 24 TicksInhale, //< The tick count in the inhale duty cycle.
kabukistarship 4:de69851cf725 25 TicksFlowInhale; //< Flow sensor tick count on the last exhale.
kabukistarship 4:de69851cf725 26 volatile int TicksFlowLast, //< The previous saved count.
kabukistarship 4:de69851cf725 27 TicksFlow; //< Flow sensor pulse count.
kabukistarship 4:de69851cf725 28 BMP280 Atmosphere; //< The air Atmosphere going to the patient.
kabukistarship 4:de69851cf725 29 float PressureReference, //< The pressure in the mask at one atmosphere.
kabukistarship 4:de69851cf725 30 TemperatureReference; //< The refernce temperature,
kabukistarship 4:de69851cf725 31 AnalogIn PulseOximeter; //< The 7-pin pulse oximeter pin.
kabukistarship 4:de69851cf725 32 InterruptIn FlowSensor; //< The flow sensor pin.
kabukistarship 4:de69851cf725 33 DigitalOut Valve, //< The Solenoid valve.
kabukistarship 4:de69851cf725 34 Status; //< The Status LED and optional alarm.
kabukistarship 4:de69851cf725 35 PwmOut Servo; //< The Servo for reducing the pressrue.
kabukistarship 4:de69851cf725 36 int ServoClosed, //< The min servo duty cycle of no air flow.
kabukistarship 4:de69851cf725 37 ServoOpen; //< The max servo duty cycle of an open tube.
kabukistarship 2:1578ecfa9377 38
kabukistarship 4:de69851cf725 39 /* Constructs a smart waterer. */
kabukistarship 4:de69851cf725 40 GHVentilatorChannel (PinName PulseOximeterPin,
kabukistarship 5:da629056644f 41 PinName FlowSensorPin,
kabukistarship 4:de69851cf725 42 PinName SolenoidPin,
kabukistarship 4:de69851cf725 43 PinName StatusPin,
kabukistarship 4:de69851cf725 44 PinName ServoPin,
kabukistarship 5:da629056644f 45 I2C& AtmosphereAddress, char I2CAddress);
kabukistarship 2:1578ecfa9377 46
kabukistarship 4:de69851cf725 47 /* Returns a pointer to this. */
kabukistarship 4:de69851cf725 48 GHVentilatorChannel* This();
kabukistarship 2:1578ecfa9377 49
kabukistarship 4:de69851cf725 50 /* Sets the number of ticks on the inhale and exhale. */
kabukistarship 4:de69851cf725 51 void TicksInhaleExhaleSet (int NewTicksInhale, int NewTicksExhale);
kabukistarship 2:1578ecfa9377 52
kabukistarship 4:de69851cf725 53 /* BreatheStarts to the begining of the watering cycle. */
kabukistarship 4:de69851cf725 54 void BreatheStart (int Index);
kabukistarship 2:1578ecfa9377 55
kabukistarship 4:de69851cf725 56 /* Increments theflow rate sensor pulse counter. */
kabukistarship 4:de69851cf725 57 void PulseFlowSensor ();
kabukistarship 2:1578ecfa9377 58
kabukistarship 4:de69851cf725 59 /* Prints the state of object to the debug stream. */
kabukistarship 4:de69851cf725 60 void Print (int Index);
kabukistarship 2:1578ecfa9377 61
kabukistarship 4:de69851cf725 62 /* Polls the PulseOximeter and updates the target flow. */
kabukistarship 4:de69851cf725 63 void Update (int Index);
kabukistarship 2:1578ecfa9377 64
kabukistarship 4:de69851cf725 65 /* Updates the float rate. */
kabukistarship 4:de69851cf725 66 bool CheckIfDoneBreathing (int Index);
kabukistarship 2:1578ecfa9377 67
kabukistarship 4:de69851cf725 68 /* Opens the solenoid valve. */
kabukistarship 4:de69851cf725 69 void Inhale ();
kabukistarship 2:1578ecfa9377 70
kabukistarship 4:de69851cf725 71 /* Closes the solenoid valve. */
kabukistarship 4:de69851cf725 72 void Exhale ();
kabukistarship 3:d15b6579b5ae 73
kabukistarship 4:de69851cf725 74 /* Handles any errors. */
kabukistarship 4:de69851cf725 75 void HandleError ();
kabukistarship 2:1578ecfa9377 76
kabukistarship 4:de69851cf725 77 /* Samples the Atmospheric pressure and temperature. */
kabukistarship 5:da629056644f 78 void Tare (float HysteresisPatient);
kabukistarship 2:1578ecfa9377 79
kabukistarship 4:de69851cf725 80 /* Updates the channel with the DeviceTick. */
kabukistarship 4:de69851cf725 81 void Update();
kabukistarship 2:1578ecfa9377 82 };
kabukistarship 2:1578ecfa9377 83 } //< namespace SickBay
kabukistarship 4:de69851cf725 84 #endif