From 21e4d4a4e254638653afa0c756d8b3d62c85e4d4 Mon Sep 17 00:00:00 2001 From: Theodor Teslia Date: Wed, 22 Feb 2023 00:05:58 +0100 Subject: [PATCH] Init commit --- .gitmodules | 3 +++ .vscode/c_cpp_properties.json | 20 ++++++++++++++++++++ README.md | 5 +++++ include/sta/MS5607.hpp | 34 ++++++++++++++++++++++++++++++++++ src/MS5607.cpp | 0 sta-core | 1 + 6 files changed, 63 insertions(+) create mode 100644 .gitmodules create mode 100644 .vscode/c_cpp_properties.json create mode 100644 README.md create mode 100644 include/sta/MS5607.hpp create mode 100644 src/MS5607.cpp create mode 160000 sta-core diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4c70b34 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "sta-core"] + path = sta-core + url = https://gitlab.com/sta-git/alpaka/sta-core diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ef15e9b --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,20 @@ +{ + "configurations": [ + { + "name": "Mac", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/sta-core/include" + ], + "defines": [], + "macFrameworkPath": [ + "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" + ], + "compilerPath": "/usr/bin/clang", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "macos-clang-arm64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..54fa59e --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Driver for the MS5607 pressure sensor + +## TODO +1. Understand the Datasheet (RIP) +2. Write the fucking driver \ No newline at end of file diff --git a/include/sta/MS5607.hpp b/include/sta/MS5607.hpp new file mode 100644 index 0000000..0dbb189 --- /dev/null +++ b/include/sta/MS5607.hpp @@ -0,0 +1,34 @@ +#ifndef STA_SENSORS_MS5607_HPP +#define STA_SENSORS_MS5607_HPP + +#include + +namespace sta { + class MS5607 { + public: + enum OsrLevel { + _256 = 0, + _512 = 1, + _1024 = 2, + _2048 = 3, + _4096 = 4 + }; + + private: + SpiDevice* device_; + + uint16_t sens, off, tcs, tco, t_ref, tempsens; + + enum Operations { + RESET = 0x1E, + READ_PROM = 0xA0, + D1_CONVERSION = 0x40, + D2_CONVERSION = 0x50, + ADC_RESULT = 0x00 + }; + + }; + +} + +#endif // ifndef STA_SENSORS_MS5607_HPP \ No newline at end of file diff --git a/src/MS5607.cpp b/src/MS5607.cpp new file mode 100644 index 0000000..e69de29 diff --git a/sta-core b/sta-core new file mode 160000 index 0000000..4204c02 --- /dev/null +++ b/sta-core @@ -0,0 +1 @@ +Subproject commit 4204c028a234d138a52f23c1851022e724a0fb13