X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=heater.git;a=blobdiff_plain;f=firmware%2Flogging.h;fp=firmware%2Flogging.h;h=962a83044a683660c888627a8ee60b3cf5518892;hp=0000000000000000000000000000000000000000;hb=c6b2f2baf7597e0a000602bc7c7997a02451e5b1;hpb=2755b4c6000c4de64d83921bdb109077f4b38597 diff --git a/firmware/logging.h b/firmware/logging.h new file mode 100644 index 0000000..962a830 --- /dev/null +++ b/firmware/logging.h @@ -0,0 +1,28 @@ +#ifndef LOGGING_H__ +#define LOGGING_H__ 1 + +#define USE_LOGGING 1 // comment out to disable logging + +#define LOG_EE_BUF_SIZE 64 // log buffer size in EEPROM +#define LOG_RAM_BUF_SIZE 16 // log double buffer size + +#define LOG_RATELIMIT_BOOTCOUNT 5 // limit logging to first five boots + // if commented out, logs after each boot (beware the EEPROM wear!) + +#ifdef USE_LOGGING + +void log_init(); +void log_byte(unsigned char byte); +void log_word(uint16_t word); +void log_flush(); + +#else /* !USE_LOGGING */ + +#define init_log(dummy) do { } while(0) +#define log_byte(dummy) do { } while(0) +#define log_word(dummy) do { } while(0) +#define log_flush() do { } while(0) + +#endif /* USE_LOGGING */ + +#endif /* !LOGGING_H__ */