ESP8266 part of the f105-motor-demo project (see f105-motor-demo_stm32)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
f105-motor-demo_esp/user/sbmp_config.h

89 lines
2.0 KiB

9 years ago
#ifndef SBMP_CONFIG_H
#define SBMP_CONFIG_H
#include <esp8266.h>
9 years ago
/* ---------- CRC32 ---------------- */
9 years ago
/**
9 years ago
* @brief Add support for CRC32
9 years ago
*
9 years ago
* Disabling CRC32 will reduce program size (for small micros).
* If CRC32 is disabled, XOR will be used as the preferred checksum
* method.
9 years ago
*
9 years ago
* 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.
9 years ago
*/
9 years ago
#define SBMP_HAS_CRC32 1
/* ---------- MALLOC --------------- */
9 years ago
/**
* @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
9 years ago
// those will be used if malloc is enabled
#define sbmp_malloc(n) os_malloc(n)
#define sbmp_free(x) os_free(x)
#define sbmp_calloc(n,l) os_zalloc((n)*(l))
/* ---------- LOGGING -------------- */
9 years ago
/**
9 years ago
* @brief Enable logging.
9 years ago
*
9 years ago
* Logging functions are WEAK stubs in sbmp_logging.
9 years ago
*
9 years ago
* Disable logging to free up memory taken by the messages.
9 years ago
*/
9 years ago
#define SBMP_LOGGING 1
9 years ago
9 years ago
/**
* @brief Enable detailed logging (only for debugging, disable for better performance).
*/
#define SBMP_DEBUG 0
9 years ago
9 years ago
// here are the actual logging functions
9 years ago
#if SBMP_DEBUG||SBMP_LOGGING
# define sbmp_error(fmt, ...) error("[SBMP] "fmt, ##__VA_ARGS__)
# define sbmp_warn(fmt, ...) warn("[SBMP] "fmt, ##__VA_ARGS__)
# define sbmp_info(fmt, ...) info("[SBMP] "fmt, ##__VA_ARGS__)
#else
# define sbmp_error(fmt, ...)
# define sbmp_warn(fmt, ...)
# define sbmp_info(fmt, ...)
#endif
#if SBMP_DEBUG
# define sbmp_dbg(fmt, ...) dbg("[SBMP] "fmt, ##__VA_ARGS__)
#else
# define sbmp_dbg(fmt, ...)
#endif
9 years ago
/* ---------- Fix formatting -------------- */
#define PRIu16 "u"
#define PRIu32 "u"
#define PRIu8 "u"
#define PRIi16 "d"
#define PRIi32 "d"
#define PRIi8 "d"
9 years ago
#endif // SBMP_CONFIG_H