Ken Van Hoeylandt 71f8369377
TactilityKernel improvements (#464)
* **New Features**
  * Thread API with lifecycle, priority, affinity and state monitoring
  * Timer subsystem: one-shot/periodic timers, reset, pending callbacks, expiry queries
  * Expanded I²C: register-level ops, bulk writes, presence checks, ESP32 integration and new config properties
  * GPIO controller: pin level and options APIs
  * Error utilities: new error code, error-to-string, timeout helper and common macros
  * Device construction helpers (construct+start)

* **Tests**
  * New unit tests for thread and timer behavior

* **Documentation**
  * Expanded coding style guide (files/folders, C conventions)
2026-01-28 23:58:11 +01:00

33 lines
748 B
C

#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <tactility/log.h>
__attribute__((noreturn)) extern void __crash(void);
#define CHECK_GET_MACRO(_1, _2, NAME, ...) NAME
#define check(...) CHECK_GET_MACRO(__VA_ARGS__, CHECK_MSG, CHECK_NO_MSG)(__VA_ARGS__)
#define CHECK_NO_MSG(condition) \
do { \
if (!(condition)) { \
LOG_E("Error", "Check failed: %s\n\tat %s:%d", #condition, __FILE__, __LINE__); \
__crash(); \
} \
} while (0)
#define CHECK_MSG(condition, message) \
do { \
if (!(condition)) { \
LOG_E("Error", "Check failed: %s\n\tat %s:%d", message, __FILE__, __LINE__); \
__crash(); \
} \
} while (0)
#ifdef __cplusplus
}
#endif