From 6673f036400cd2efdc9438641882610b45acef96 Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 2 Jun 2025 15:22:57 +0300 Subject: [PATCH] Init --- DeviceStorage.c | 24 ++++++++++++++++++++++++ DeviceStorage.h | 18 ++++++++++++++++++ modular.json | 10 ++++++++++ 3 files changed, 52 insertions(+) create mode 100644 DeviceStorage.c create mode 100644 DeviceStorage.h create mode 100644 modular.json diff --git a/DeviceStorage.c b/DeviceStorage.c new file mode 100644 index 0000000..9640949 --- /dev/null +++ b/DeviceStorage.c @@ -0,0 +1,24 @@ +// +// Created by cfif on 07.10.22. +// + +#include "DeviceStorage.h" +#include "StorageOnFlashArtery.h" +#include "InternalFlashPage.h" + + +bool DeviceStorage_Init(tDeviceStorage *env, tStorageInterface *storageInterface) { + + tStorageOnFlashArtery *store = (tStorageOnFlashArtery *) storageInterface->env; + sInternalFlashPage_Read(store->mainFlashPageAddress, 0x0, (uint8_t *) &env->nvm, sizeof(env->nvm)); +/* + if ((env->nvm.SettingsServerConnection.EGTS_SERVER_ADDRESS.length > 32) || + (env->nvm.SettingsServerConnection.EGTS_ALT_SERVER_ADDRESS.length > 32) || + (env->nvm.SettingsServerConnection.EGTS_GPRS_APN.length > 32)) { + DeviceDataNonVolatile_InitDefaults(&env->nvm); + + return false; + } +*/ + return true; +} diff --git a/DeviceStorage.h b/DeviceStorage.h new file mode 100644 index 0000000..4032032 --- /dev/null +++ b/DeviceStorage.h @@ -0,0 +1,18 @@ +// +// Created by zemon on 20.02.24. +// + +#ifndef HEAVY_TERMINAL_DEVICESTORAGE_H +#define HEAVY_TERMINAL_DEVICESTORAGE_H + +#include "DataNonVolatile.h" +#include "StorageIO.h" +#include "stdbool.h" + +typedef struct { + tDeviceDataNonVolatile nvm; +} tDeviceStorage; + +bool DeviceStorage_Init(tDeviceStorage *env, tStorageInterface *storageInterface); + +#endif //HEAVY_TERMINAL_DEVICESTORAGE_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..0dd1901 --- /dev/null +++ b/modular.json @@ -0,0 +1,10 @@ +{ + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "./**.c" + ] + } +} \ No newline at end of file