Add initial sensor sampler and processing components
Build / Build app and tests (ubuntu-24.04) (push) Failing after 2m38s
Documentation / Build (1.14.0) (push) Failing after 26s
Documentation / Build (1.9.6) (push) Successful in 11s
Documentation / Deploy (push) Has been skipped

This commit is contained in:
2026-04-22 22:47:12 -07:00
parent cefb043b7f
commit 37fef28911
6 changed files with 82 additions and 4 deletions
+8 -1
View File
@@ -9,7 +9,14 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(app LANGUAGES C) project(app LANGUAGES C)
target_sources(app PRIVATE src/main.cpp) target_sources(app
PRIVATE
src/main.cpp
src/SensorDataProcessor.cpp
src/SensorDataProcessor.hpp
src/SensorSampler.cpp
src/SensorSampler.hpp
)
# The code below locates the git index file for this repository and adds it as a dependency for # The code below locates the git index file for this repository and adds it as a dependency for
# the application VERSION file so that if the repo has a new commit added, even if no files in # the application VERSION file so that if the repo has a new commit added, even if no files in
+9
View File
@@ -0,0 +1,9 @@
#include "SensorDataProcessor.hpp"
#include <zephyr/kernel.h>
void app::SensorDataProcessor::entryPoint(void *, void *, void *) {
while (true) {
printk("app::SensorDataProcessor::entryPoint - Running...\n");
k_sleep(K_SECONDS(5));
}
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef SENSOR_DATA_PROCESSOR_HPP
#define SENSOR_DATA_PROCESSOR_HPP
namespace app {
class SensorDataProcessor {
public:
SensorDataProcessor() = default;
~SensorDataProcessor() = default;
// Thread entry
static void entryPoint(void *, void *, void *);
private:
};
} // namespace app
#endif
+9
View File
@@ -0,0 +1,9 @@
#include "SensorSampler.hpp"
#include <zephyr/kernel.h>
void app::SensorSampler::entryPoint(void *, void *, void *) {
while (true) {
printk("app::SensorSampler::entryPoint - Running...\n");
k_sleep(K_SECONDS(5));
}
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef SENSOR_SAMPLER_HPP
#define SENSOR_SAMPLER_HPP
namespace app {
class SensorSampler {
public:
SensorSampler() = default;
~SensorSampler() = default;
// Thread entry
static void entryPoint(void *, void *, void *);
private:
};
} // namespace app
#endif
+18 -3
View File
@@ -3,19 +3,34 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include "SensorDataProcessor.hpp"
#include "SensorSampler.hpp"
#include <app_version.h>
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/logging/log.h> #include <zephyr/logging/log.h>
#include <app_version.h>
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL); LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
// Sensor Data Processor
static constexpr size_t SensorDataProcessorStackSize = 1024;
static constexpr size_t SensorDataProcessorPriority = 5;
K_THREAD_DEFINE(SensorDataProcessorThreadId, SensorDataProcessorStackSize,
app::SensorDataProcessor::entryPoint, NULL, NULL, NULL,
SensorDataProcessorPriority, 0, 0);
// Sensor Sampler
static constexpr size_t SensorSamplerStackSize = 1024;
static constexpr size_t SensorSamplerPriority = 5;
K_THREAD_DEFINE(SensorSamplerThreadId, SensorSamplerStackSize,
app::SensorSampler::entryPoint, NULL, NULL, NULL,
SensorSamplerPriority, 0, 0);
int main() { int main() {
printk("Zephyr Example Application %s\n", APP_VERSION_STRING); printk("Zephyr Example Application %s\n", APP_VERSION_STRING);
printk("Build with C++ standard: %ldL\n", __cplusplus); printk("Build with C++ standard: %ldL\n", __cplusplus);
while (true) { while (true) {
printk("Running...\n"); printk("main - Running...\n");
k_sleep(K_SECONDS(5)); k_sleep(K_SECONDS(5));
} }