diff --git a/esp_meas.pro b/esp_meas.pro index 999ea79..aa6ed2c 100644 --- a/esp_meas.pro +++ b/esp_meas.pro @@ -130,7 +130,8 @@ HEADERS += \ user/uptime.h \ sbmp/library/payload_parser.h \ user/sampling.h \ - user/page_home.h + user/page_home.h \ + include/sbmp_config.h DISTFILES += \ style.astylerc \ diff --git a/esp_meas.pro.user b/esp_meas.pro.user index 70e4b29..71a43ea 100644 --- a/esp_meas.pro.user +++ b/esp_meas.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/include/sbmp_config.h b/include/sbmp_config.h new file mode 100644 index 0000000..a5d405e --- /dev/null +++ b/include/sbmp_config.h @@ -0,0 +1,52 @@ +#ifndef SBMP_CONFIG_H +#define SBMP_CONFIG_H + +#include + +/* --- Configuration ------------------- */ + +/** + * @brief Enable logging. + * + * Logging functions are WEAK stubs in sbmp_logging. + * + * Disable logging to free up memory taken by the messages. + */ +#define SBMP_LOGGING 1 + +/** + * @brief Enable malloc if NULL is passed. + * + * This lets you malloc() the struct / buffer if you pass NULL + * to the init functions. + * + * Disable malloc to free up memory taken by the malloc routine. + * If disabled, init funcs will return NULL if NULL is passed + * as argument. + */ +#define SBMP_USE_MALLOC 1 + +/** + * @brief Add support for CRC32 + * + * Disabling CRC32 will reduce program size (for small micros). + * If CRC32 is disabled, XOR will be used as the preferred checksum + * method. + * + * Received CRC32'd messages will be accepted without checking. + * + * If handshake is used, the peer will detect that CRC32 is not + * supported here, and should start using XOR. + */ +#define SBMP_HAS_CRC32 1 + +/* ---------- MALLOC --------------- */ + +#define sbmp_malloc(n) os_malloc(n) +#define sbmp_free(x) os_free(x) +#define sbmp_calloc(n,l) os_zalloc((n)*(l)) + +/* ------------------------------------- */ + + +#endif // SBMP_CONFIG_H diff --git a/sbmp b/sbmp index 6df0fca..32258ec 160000 --- a/sbmp +++ b/sbmp @@ -1 +1 @@ -Subproject commit 6df0fcacd8bc23d2af86df4d5c5c2c624938eeb4 +Subproject commit 32258ec164775a543486c8e6827c500d1626fb48