Mod Library
Sun Devil Rocketry's hardware agnostic utility library
Loading...
Searching...
No Matches
error_sdr.h File Reference

: Contains error handling functions for SDR code. More...

#include <string.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  _ERROR_CALLBACK
struct  TEXT_MESSAGE

Macros

#define TEXT_MESSAGE_LENGTH   36
#define Error_Handler(a)
#define assert_fail_fast(condition, error)
 Assert that a condition is true, and fail-fast if not.
#define assert_return(condition, retval)
 Assert that a condition is true, and return the provided value if not.

Typedefs

typedef enum _ERROR_CODE ERROR_CODE
typedef struct _ERROR_CALLBACK ERROR_CALLBACK
typedef struct TEXT_MESSAGE TEXT_MESSAGE

Enumerations

enum  _ERROR_CODE {
  ERROR_UNKNOWN_FATAL_ERROR , ERROR_FLASH_INIT_ERROR , ERROR_BARO_INIT_ERROR , ERROR_IMU_INIT_ERROR ,
  ERROR_DATA_LOG_LOAD_HEADER_ERROR , ERROR_DATA_LOG_CORRECT_HEADER_ERROR , ERROR_DATA_LOG_PREP_MEM_ERROR , ERROR_CAL_GROUND_ALT_ERROR ,
  ERROR_TERMINAL_ERROR , ERROR_FSM_STATE_ERROR , ERROR_DUAL_DEPLOY_EXTRACT_ERROR , ERROR_RECORD_FLIGHT_EVENTS_ERROR ,
  ERROR_SYSCLOCK_CONFIG_ERROR , ERROR_COMMON_CLOCK_CONFIG_ERROR , ERROR_IMU_I2C_INIT_ERROR , ERROR_BARO_I2C_INIT_ERROR ,
  ERROR_FLASH_SPI_INIT_ERROR , ERROR_USB_UART_INIT_ERROR , ERROR_BUZZER_TIM_INIT_ERROR , ERROR_MICRO_TIM_INIT_ERROR ,
  ERROR_I2C_HAL_MSP_ERROR , ERROR_SPI_HAL_MSP_ERROR , ERROR_UART_HAL_MSP_ERROR , ERROR_RF_ERROR ,
  ERROR_RF_UNRECOGNIZED_PING , ERROR_USB_UART_ERROR , ERROR_XBEE_UART_CONFIG_ERROR , ERROR_RF_UART_INIT_ERROR ,
  ERROR_UNSUPPORTED_OP_ERROR , ERROR_THERMO_INIT_ERROR , ERROR_PT_ADC_INIT_ERROR , ERROR_LC_ADC_INIT_ERROR ,
  ERROR_THERMO_I2C_INIT_ERROR , ERROR_VALVE_UART_INIT_ERROR , ERROR_IGN_CMD_ERROR , ERROR_FLASH_CMD_ERROR ,
  ERROR_SENSOR_CMD_ERROR , ERROR_SERVO_CMD_ERROR , ERROR_VALVE_CMD_ERROR , ERROR_BARO_CAL_ERROR ,
  ERROR_DATA_HAZARD_ERROR , ERROR_FSM_INVALID_STATE_ERROR , ERROR_VC_OFFLINE_ERROR , ERROR_VC_INIT_ERROR ,
  ERROR_PING_TIMEOUT_ERROR , ERROR_RS485_UART_INIT_ERROR , ERROR_RS485_UART_ERROR , ERROR_SOL_CMD_ERROR ,
  ERROR_PT_ADC_CHANNEL_ERROR , ERROR_FSM_INVALID_STATE_TRANSITION_ERROR , ERROR_GPS_UART4_INITIALIZATION , ERROR_GPS_UART4_DEMSP ,
  ERROR_PWM4_ERROR , ERROR_PWM123_ERROR , ERROR_SERVO_INIT_ERROR , ERROR_SENSOR_FORMAT_ERROR ,
  ERROR_INVALID_STATE_ERROR , ERROR_CONFIG_VALIDITY_ERROR , ERROR_USB_CDC_INIT_ERROR , ERROR_IGNITION_CONTINUITY_ERROR ,
  ERROR_LORA_SPI_INIT_ERROR , ERROR_LORA_INIT_ERROR , ERROR_LORA_CMD_ERROR , ERROR_IMU_I2C_ERROR ,
  ERROR_BARO_I2C_ERROR
}

Functions

void error_fail_fast (volatile ERROR_CODE error_code)
 Handles an error using the configured error callback.

Detailed Description

: Contains error handling functions for SDR code.

Copyright (c) 2025 Sun Devil Rocketry. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is covered under the BSD-3-Clause.

https://opensource.org/license/bsd-3-clause

Macro Definition Documentation

◆ assert_fail_fast

#define assert_fail_fast ( condition,
error )
Value:
do { if ( !(condition) ) error_fail_fast( error ); } while(0)
void error_fail_fast(volatile ERROR_CODE error_code)
Dispatches an error to its registered callback or default handler.
Definition error_sdr.c:104

Assert that a condition is true, and fail-fast if not.

Parameters
conditionA predicate that triggers an error if false.
errorThe error code to report

◆ assert_return

#define assert_return ( condition,
retval )
Value:
do { if ( !(condition) ) return retval; } while(0)

Assert that a condition is true, and return the provided value if not.

Parameters
conditionA predicate that triggers an error if false.
retvalThe value to return with

◆ Error_Handler

#define Error_Handler ( a)
Value:

Function Documentation

◆ error_fail_fast()

void error_fail_fast ( volatile ERROR_CODE error_code)

Handles an error using the configured error callback.

Dispatches an error to its registered callback or default handler.

Parameters
error_codeError code to handle.

Handles an error using the configured error callback.

Parameters
error_codeError code to handle.