ArduinoMega2560_SPI 1.0
Cargando...
Buscando...
Nada coincide
Referencia de la clase DiagnosticsEEPROM

Provides diagnostic utilities for testing and managing EEPROM memory. Más...

#include <diagnosticsEEPROM.h>

Métodos públicos estáticos

static bool runTest (int address=0)
 Runs a diagnostic test on the EEPROM at the specified address. Writes a test value, reads it back, and verifies integrity.
static int getFreeMemory ()
 Estimates the amount of free RAM available on the system. Works on AVR-based boards like Arduino Mega 2560.

Métodos privados estáticos

static void clearEEPROM (int address)
 Clears the EEPROM at the specified address by writing 0xFF.

Atributos estáticos privados

static const byte testValue = 123
 Value used for EEPROM testing.

Descripción detallada

Provides diagnostic utilities for testing and managing EEPROM memory.

Definición en la línea 11 del archivo diagnosticsEEPROM.h.

Documentación de funciones miembro

◆ clearEEPROM()

void DiagnosticsEEPROM::clearEEPROM ( int address)
staticprivate

Clears the EEPROM at the specified address by writing 0xFF.

Limpia la EEPROM en la dirección indicada escribiendo 0xFF.

Parámetros
addressEEPROM address to clear.

Tras limpiar, lee nuevamente el valor para verificar la operación.

Parámetros
addressDirección de EEPROM a limpiar.

Definición en la línea 62 del archivo diagnosticsEEPROM.cpp.

62 {
63 EEPROM.write(address, 0xFF);
64 delay(10);
65
66 byte clearedValue = EEPROM.read(address);
67 Serial.print("🧹 EEPROM cleared. New value at [");
68 Serial.print(address);
69 Serial.print("]: ");
70 Serial.println(clearedValue);
71}
Gráfico de llamadas a esta función:

◆ getFreeMemory()

int DiagnosticsEEPROM::getFreeMemory ( )
static

Estimates the amount of free RAM available on the system. Works on AVR-based boards like Arduino Mega 2560.

Estima la cantidad de memoria RAM libre disponible en el sistema.

Devuelve
Number of free bytes in RAM.

Este método funciona en placas basadas en AVR como Arduino Mega 2560. Calcula la memoria libre comparando la posición actual de la pila con el heap.

Devuelve
Número de bytes libres en RAM.

Definición en la línea 82 del archivo diagnosticsEEPROM.cpp.

82 {
83 extern unsigned int __heap_start;
84 extern void *__brkval;
85 int freeMemory;
86
87 if ((int)__brkval == 0) {
88 freeMemory = ((int)&freeMemory) - ((int)&__heap_start);
89 } else {
90 freeMemory = ((int)&freeMemory) - ((int)__brkval);
91 }
92
93 return freeMemory;
94}
Gráfico de llamadas a esta función:

◆ runTest()

bool DiagnosticsEEPROM::runTest ( int address = 0)
static

Runs a diagnostic test on the EEPROM at the specified address. Writes a test value, reads it back, and verifies integrity.

Ejecuta un test de diagnóstico sobre la EEPROM en la dirección indicada.

Parámetros
addressEEPROM address to test (default is 0).
Devuelve
true if EEPROM responds correctly, false otherwise.

El procedimiento realiza:

  • Escritura de un valor de prueba en la EEPROM.
  • Lectura del valor almacenado.
  • Comparación entre valor escrito y leído.
  • Informe del estado de memoria libre y usada.
  • Limpieza de la dirección probada.
Parámetros
addressDirección de EEPROM a probar (por defecto 0).
Devuelve
true si la EEPROM responde correctamente, false en caso contrario.

Definición en la línea 16 del archivo diagnosticsEEPROM.cpp.

16 {
17 standardMessage("🧪 Starting EEPROM diagnostic", __FILE__, __FUNCTION__, __DATE__, __TIME__);
18
19 // Write test value
20 EEPROM.write(address, testValue);
21 delay(10);
22
23 // Read stored value
24 byte readValue = EEPROM.read(address);
25 Serial.print("📥 Value read from EEPROM[");
26 Serial.print(address);
27 Serial.print("]: ");
28 Serial.println(readValue);
29
30 // Show memory status
31 int freeMem = getFreeMemory();
32 Serial.print("📊 Estimated free memory: ");
33 Serial.print(freeMem);
34 Serial.println(" bytes");
35
36 Serial.print("📦 Estimated used memory: ");
37 Serial.print(RAMEND - freeMem);
38 Serial.println(" bytes");
39
40 // Check if value matches
41 if (readValue == testValue) {
42 Serial.println("✅ EEPROM is responding correctly.");
43 clearEEPROM(address);
44 standardHeaderFull("EEPROM diagnostic completed", __FILE__, __FUNCTION__, __DATE__, __TIME__);
45 return true;
46 } else {
47 Serial.println("❌ EEPROM error: value mismatch.");
48 clearEEPROM(address);
49 standardHeaderFull("EEPROM diagnostic failed", __FILE__, __FUNCTION__, __DATE__, __TIME__);
50 return false;
51 }
52}
static int getFreeMemory()
Estimates the amount of free RAM available on the system. Works on AVR-based boards like Arduino Mega...
static const byte testValue
Value used for EEPROM testing.
static void clearEEPROM(int address)
Clears the EEPROM at the specified address by writing 0xFF.
void standardMessage(const char *message, const char *file, const char *function, const char *date, const char *time)
Prints an enriched log message to the serial monitor.
Definition msg.cpp:15
void standardHeaderFull(const char *message, const char *file, const char *function, const char *date, const char *time, uint16_t width=120, char deco='-')
Prints a decorated header with centered text and padding on both sides.
Definition msg.cpp:121
Gráfico de llamadas de esta función:
Gráfico de llamadas a esta función:

Documentación de datos miembro

◆ testValue

const byte DiagnosticsEEPROM::testValue = 123
staticprivate

Value used for EEPROM testing.

Definición en la línea 34 del archivo diagnosticsEEPROM.h.


La documentación de esta clase está generada de los siguientes archivos: