39 lines
888 B
C
Raw Normal View History

#ifndef _DTC_H_
#define _DTC_H_
#include <Arduino.h>
#define MAX_DTC_STORAGE 6
typedef enum DTCNums_e
{
DTC_NO_EEPROM_FOUND,
DTC_EEPROM_CFG_BAD,
DTC_EEPROM_PDS_BAD,
2022-05-15 16:37:34 +02:00
DTC_EEPROM_VERSION_BAD,
DTC_EEPROM_WORNOUT, // this will happen if the EEPROM-cells are all overwritten 1 million times!
DTC_EEPROM_PDS_MARKER_INVALID, // This happens if the Marker of the PersistanceData was pointing to an EE-Adress bigger than the used EEPROM-IC
DTC_LAST_DTC
} DTCNums_t;
typedef enum DTCActive_e
{
DTC_ACTIVE,
DTC_PREVIOUS,
DTC_NONE
} DTCActive_t;
typedef struct DTCEntry_s
{
DTCNums_t Number;
uint32_t timestamp;
DTCActive_t active;
} DTCEntry_t;
void MaintainDTC(DTCNums_t DTC_no, boolean active);
void ClearDTC(DTCNums_t DTC_no);
void ClearAllDTC();
DTCNums_t getlastDTC(boolean only_active);
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
#endif