From 236b78434194bd22fdaec919a457847fbba790d5 Mon Sep 17 00:00:00 2001 From: Federico Mandelli <federico.mandelli@skywarder.eu> Date: Tue, 1 Aug 2023 10:01:33 +0000 Subject: [PATCH] [PressureSensor] Added analog pressure sensors HSCMRNN015PAAA5 and SSCMRNN030PAAA5 --- .../analog/pressure/honeywell/HSCMRNN015PA.h | 44 +++++++++++++++++++ .../pressure/honeywell/HSCMRNN015PAData.h | 40 +++++++++++++++++ .../analog/pressure/honeywell/SSCMRNN030PA.h | 44 +++++++++++++++++++ .../pressure/honeywell/SSCMRNN030PAData.h | 40 +++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PA.h create mode 100644 src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PAData.h create mode 100644 src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PA.h create mode 100644 src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PAData.h diff --git a/src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PA.h b/src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PA.h new file mode 100644 index 000000000..7669f3f4f --- /dev/null +++ b/src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PA.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Federico Mandelli + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "HSCMRNN015PAData.h" +#include "HoneywellPressureSensor.h" + +namespace Boardcore +{ + +/** + * @brief Absolute pressure sensor with a 0-103kPa range (0-15psi) + */ +class HSCMRNN015PA final : public HoneywellPressureSensor<HSCMRNN015PAData> +{ +public: + HSCMRNN015PA(std::function<ADCData()> getSensorVoltage, + const float supplyVoltage = 5.0) + : HoneywellPressureSensor(getSensorVoltage, supplyVoltage, 103421.3594) + { + } +}; + +} // namespace Boardcore diff --git a/src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PAData.h b/src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PAData.h new file mode 100644 index 000000000..768563391 --- /dev/null +++ b/src/shared/sensors/analog/pressure/honeywell/HSCMRNN015PAData.h @@ -0,0 +1,40 @@ +/* Copyright (c) 2020 Skyward Experimental Rocketry + * Author: Federico Mandelli + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include <sensors/SensorData.h> + +namespace Boardcore +{ + +struct HSCMRNN015PAData : public PressureData +{ + static std::string header() { return "pressureTimestamp,pressure\n"; } + + void print(std::ostream& os) const + { + os << pressureTimestamp << "," << pressure << "\n"; + } +}; + +} // namespace Boardcore diff --git a/src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PA.h b/src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PA.h new file mode 100644 index 000000000..beaac6843 --- /dev/null +++ b/src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PA.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Federico Mandelli + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "HoneywellPressureSensor.h" +#include "SSCMRNN030PAData.h" + +namespace Boardcore +{ + +/** + * @brief Absolute pressure sensor with a 0-206kPa range (0-30psi) + */ +class SSCMRNN030PA final : public HoneywellPressureSensor<SSCMRNN030PAData> +{ +public: + SSCMRNN030PA(std::function<ADCData()> getSensorVoltage, + const float supplyVoltage = 5.0) + : HoneywellPressureSensor(getSensorVoltage, supplyVoltage, 206842.7188) + { + } +}; + +} // namespace Boardcore diff --git a/src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PAData.h b/src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PAData.h new file mode 100644 index 000000000..70983cc86 --- /dev/null +++ b/src/shared/sensors/analog/pressure/honeywell/SSCMRNN030PAData.h @@ -0,0 +1,40 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Federico Mandelli + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include <sensors/SensorData.h> + +namespace Boardcore +{ + +struct SSCMRNN030PAData : public PressureData +{ + static std::string header() { return "pressureTimestamp,pressure\n"; } + + void print(std::ostream& os) const + { + os << pressureTimestamp << "," << pressure << "\n"; + } +}; + +} // namespace Boardcore -- GitLab