add some doxygen to hard_assert

This commit is contained in:
graham sanderson 2025-07-22 16:48:43 -05:00
parent 2e2651f087
commit e721a2eae1
2 changed files with 19 additions and 0 deletions

View file

@ -38,6 +38,16 @@ extern "C" {
#ifdef NDEBUG
extern void hard_assertion_failure(void);
/*! \brief Perform a runtime assertion always (i.e. not just when NDEBUG is undefined)
* \ingroup pico_base
*
* This function is intended to provide useful information in debug builds like a normal asstion, but also
* prevent execution proceeding in other builds
*
* In debug builds this is equivalent to \ref assert, however in release builds it calls \ref hard_assertion_failure
* which, by default, just calls \ref panic with the string "Hard assert"
*/
static inline void hard_assert(bool condition, ...) {
if (!condition)
hard_assertion_failure();

View file

@ -8,6 +8,15 @@
#include "pico/runtime_init.h"
/*! \brief Handle a hard_assert condition failure
* \ingroup pico_runtime
*
* This weak function provides the default implementation (call \ref panic with "Hard assert") for if a \ref hard_assert
* condition fail in non debug builds. You can provide your own strong implementation to replace the default behavior
*
* \sa hard_assert
*/
void __weak hard_assertion_failure(void) {
panic("Hard assert");
}