Compile EEPROM code only if enabled via Kconfig

This commit is contained in:
Martin Jäger
2021-02-05 17:41:52 +01:00
parent a9b0a278ad
commit c151213325
2 changed files with 8 additions and 12 deletions
+6 -12
View File
@@ -6,33 +6,25 @@
#include "eeprom.h"
#include <stdio.h>
#ifdef CONFIG_EEPROM
#ifndef UNIT_TEST
#include <zephyr.h>
#include <device.h>
#include <drivers/eeprom.h>
#endif
#include "mcu.h"
#include "thingset.h"
#include "data_nodes.h"
#include "helper.h"
#ifndef UNIT_TEST
K_MUTEX_DEFINE(_lock);
static uint8_t buf[512]; // Buffer used by store and restore functions
#endif
#include <stdio.h>
#define EEPROM_HEADER_SIZE 8 // bytes
#define EEPROM_UPDATE_INTERVAL (6*60*60) // update every 6 hours
K_MUTEX_DEFINE(_lock);
static uint8_t buf[512]; // Buffer used by store and restore functions
extern ThingSet ts;
#ifndef UNIT_TEST
uint32_t _calc_crc(const uint8_t *buf, size_t len)
{
#if defined(CONFIG_SOC_SERIES_STM32G4X)
@@ -159,6 +151,8 @@ void eeprom_restore_data() {;}
#endif
#include "helper.h"
void eeprom_update()
{
if (uptime() % EEPROM_UPDATE_INTERVAL == 0 && uptime() > 0) {
+2
View File
@@ -7,6 +7,8 @@
#ifndef EEPROM_H
#define EEPROM_H
#define EEPROM_UPDATE_INTERVAL (6*60*60) // update every 6 hours
/**
* @file
*