feat(nodes) : setting folder construction

This commit is contained in:
adrien balleyguier
2026-04-16 11:14:35 +02:00
parent f71db42f47
commit f0bc4ee373
15 changed files with 115 additions and 38 deletions

View File

@@ -2,6 +2,6 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky)
project(plein_de_eeeeeeeeeeee)
target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/main.c src/window_status.c src/window_status.h src/thermometer.c src/thermometer.h src/hygrometer.c src/hygrometer.h src/co2_level.c src/co2_level.h src/supervisor.c src/supervisor.h src/ble_advertiser.c src/ble_advertiser.h)

View File

View File

@@ -0,0 +1,4 @@
#ifndef BLE_ADVERTISER_H
#define BLE_ADVERTISER_H
#endif //BLE_ADVERTISER_H

9
nodes/src/co2_level.c Normal file
View File

@@ -0,0 +1,9 @@
#include "co2_level.h"
enum error_code co2_lvl_init(){
return success;
}
int co2_lvl_get_value(){
return 0;
}

9
nodes/src/co2_level.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef CO2_LEVEL_H
#define CO2_LEVEL_H
#include "error_code.h"
enum error_code co2_lvl_init();
int co2_lvl_get_value();
#endif //CO2_LEVEL_H

9
nodes/src/error_code.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef ERROR_CODE_H
#define ERROR_CODE_H
enum error_code{
success = 0,
error_code_last, // iteration purpose
};
#endif //ERROR_CODE_H

9
nodes/src/hygrometer.c Normal file
View File

@@ -0,0 +1,9 @@
#include "hygrometer.h"
enum error_code hygro_init(){
return success;
}
int hygro_get_value(){
return 0;
}

9
nodes/src/hygrometer.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef HYGROMETER_H
#define HYGROMETER_H
#include "error_code.h"
enum error_code hygro_init();
int hygro_get_value();
#endif //HYGROMETER_H

View File

@@ -8,41 +8,9 @@
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 10000
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
/*
* A build error on this line means your board is unsupported.
* See the sample documentation for information on how to fix this.
*/
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
int main(void)
{
int ret;
bool led_state = true;
if (!gpio_is_ready_dt(&led)) {
return 0;
}
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
if (ret < 0) {
return 0;
}
while (1) {
ret = gpio_pin_toggle_dt(&led);
if (ret < 0) {
return 0;
}
led_state = !led_state;
printf("LED state: %s\n", led_state ? "ON" : "OFF");
k_msleep(SLEEP_TIME_MS);
}
int main(void){
supervisor_init();
supervisor_run();
// should never come here
return 0;
}

10
nodes/src/supervisor.c Normal file
View File

@@ -0,0 +1,10 @@
#include "supervisor.h"
enum error_code supervisor_init(){
return success;
}
enum error_code supervisor_run(){
while(1);
return success;
}

14
nodes/src/supervisor.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef SUPERVISOR_H
#define SUPERVISOR_H
#include "error_code.h"
#include "window_status.h"
#include "thermometer.h"
#include "hygrometer.h"
#include "co2_level.h"
enum error_code supervisor_init();
enum error_code supervisor_run();
#endif //SUPERVISOR_H

9
nodes/src/thermometer.c Normal file
View File

@@ -0,0 +1,9 @@
#include "thermometer.h"
enum error_code thermo_init(){
return success;
}
int thermo_get_value(){
return 0;
}

9
nodes/src/thermometer.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef THERMOMETER_H
#define THERMOMETER_H
#include "error_code.h"
enum error_code thermo_init();
int thermo_get_value();
#endif //THERMOMETER_H

View File

@@ -0,0 +1,9 @@
#include "window_status.h"
enum error_code window_init(){
return success;
}
int window_get_value(){
return 0;
}

View File

@@ -0,0 +1,9 @@
#ifndef WINDOW_STATUS_H
#define WINDOW_STATUS_H
#include "error_code.h"
enum error_code window_init();
int window_get_value();
#endif //WINDOW_STATUS_