init
This commit is contained in:
15
include/Logger.h
Normal file
15
include/Logger.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
// Wszystkie tagi logowania w jednym miejscu
|
||||
extern const char *TAG_MAIN;
|
||||
extern const char *TAG_DISP;
|
||||
extern const char *TAG_ADXL;
|
||||
extern const char *TAG_CONF;
|
||||
|
||||
// Funkcja inicjalizacji poziomów logowania
|
||||
void init_log_levels();
|
||||
|
||||
#endif
|
||||
31
include/Pinout.h
Normal file
31
include/Pinout.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(ESP32)
|
||||
// SPI3 (HSPI) - SD Card nie kolidują z PSRAM
|
||||
// #define SD_SCK 16 // 36 //18
|
||||
// #define SD_MOSI 17 // 35 //17
|
||||
// #define SD_MISO 18 // 37 //16
|
||||
// #define SD_CS 15 // 34 //15 ?? 34
|
||||
|
||||
// SPI2 (VSPI) - ADXL345
|
||||
// #define MOSI_ADSX 11 // SDA
|
||||
// #define CLK_ADSX 12 // SCL
|
||||
// #define MISO_ADSX 13 // SDO
|
||||
|
||||
//I2C C3
|
||||
#define PIN_SDA 8
|
||||
#define PIN_SCL 9
|
||||
|
||||
|
||||
// Przycisk
|
||||
// #define BTN_UP 5
|
||||
// #define BTN_OK 6
|
||||
// #define BTN_DOWN 7
|
||||
|
||||
// Przekaźnik
|
||||
// #define RELAY_OUT 4
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
14
include/Tool.h
Normal file
14
include/Tool.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef TOOL_H
|
||||
#define TOOL_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include "esp_log.h"
|
||||
#include "Watchdog.h"
|
||||
|
||||
void scanI2C();
|
||||
|
||||
/* Funkcja przyjmuje adres jako argument i zwraca true gdy urządzenie odpowiada, w przeciwnym wypadku false */
|
||||
bool isI2CDevPresent(uint8_t address);
|
||||
|
||||
#endif
|
||||
7
include/Version.h
Normal file
7
include/Version.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define VERSION "0.1"
|
||||
|
||||
|
||||
#endif
|
||||
38
include/Watchdog.h
Normal file
38
include/Watchdog.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
/**
|
||||
* Watchdog — prosty interfejs do inicjalizacji i karmienia WDT z dowolnego modułu.
|
||||
*
|
||||
* Obsługiwane środowiska:
|
||||
* - ESP32 Arduino Core / ESP-IDF (esp_task_wdt)
|
||||
* - Fallback: no-op na innych platformach
|
||||
*
|
||||
* Użycie:
|
||||
* Watchdog::init(5, true);
|
||||
* Watchdog::addThisTask();
|
||||
* ...
|
||||
* Watchdog::feed();
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Watchdog {
|
||||
|
||||
/** Inicjalizacja Task Watchdog (idempotentna). */
|
||||
bool init(int timeout_seconds = 5, bool panic_on_trigger = true);
|
||||
|
||||
/** Dodaje bieżący task (wątki FreeRTOS: wołaj w ciele tego taska). */
|
||||
bool addThisTask();
|
||||
|
||||
/** Usuwa bieżący task z nadzoru WDT. */
|
||||
bool removeThisTask();
|
||||
|
||||
/** Karmi watchdog (reset licznika). */
|
||||
void feed();
|
||||
|
||||
/** Zmienia timeout (wykonuje re-init wewnętrznie, jeśli trzeba). */
|
||||
bool setTimeout(int timeout_seconds);
|
||||
|
||||
/** Czy watchdog jest aktywny (zainicjalizowany)? */
|
||||
bool isActive();
|
||||
|
||||
} // namespace Watchdog
|
||||
Reference in New Issue
Block a user