// // Error: Provides a simple interface for asserting and checking errors // #include "stm32f3xx_hal.h" #include #include "config.h" #include "error.h" static volatile uint32_t err_reg; static volatile uint8_t num_errors_asserted = 0; // Moderately detailed messages corresponding to each error enum //static const char * error_message[] = //{ // "Info", // "General", //}; // Set the passed error flag void error_assert(const uint8_t errno) { // Errno invalid: exceeds bit length of error register if(errno >= 32) return; // Don't count info messages as true errors if(errno > ERR_INFO) { // Set error flag err_reg |= (1<= 32) return; // Don't count info messages as true errors if(errno > ERR_INFO) { // Set error flag err_reg |= (1< ERR_INFO) { ir_efs_send(outbuf); error_sidechannel_addmsg(outbuf); } #endif } // Check if the passed error flag has been asserted inline uint8_t error_check(const uint8_t errno) { return (err_reg & (1< 0; } // Return 1 if any error has occurred inline uint8_t error_occurred(void) { return err_reg > 0; } // Return the number of errors that have occurred inline uint8_t error_count(void) { return num_errors_asserted; }