Bioscara
DALSA's DIY SCARA Robot Arm.
Loading...
Searching...
No Matches
Namespaces | Macros | Enumerations | Functions
uErr.h File Reference

Defining common return types. More...

#include <string>

Go to the source code of this file.

Namespaces

namespace  bioscara_hardware_drivers
 

Macros

#define RETURN_ON_ERROR(x)
 Macro which executes a function and returns from the calling function with the error code if the called function fails.
 
#define RETURN_ON_FALSE(a, err_code)
 Macro which returns the calling function with specified error_code if the given condition is false.
 
#define RETURN_ON_NEGATIVE(a, err_code)
 Macro which returns the calling function with specified error_code if the given condition is negative.
 

Enumerations

enum class  bioscara_hardware_drivers::err_type_t {
  bioscara_hardware_drivers::OK = 0 , bioscara_hardware_drivers::ERROR = -1 , bioscara_hardware_drivers::NOT_HOMED = -2 , bioscara_hardware_drivers::NOT_ENABLED = -3 ,
  bioscara_hardware_drivers::STALLED = -4 , bioscara_hardware_drivers::NOT_INIT = -5 , bioscara_hardware_drivers::COMM_ERROR = -6 , bioscara_hardware_drivers::INVALID_ARGUMENT = -101 ,
  bioscara_hardware_drivers::INCORRECT_STATE = -109
}
 Enum defining common error types. More...
 

Functions

std::string bioscara_hardware_drivers::error_to_string (err_type_t err)
 Converts an error code to a string and returns it.
 

Detailed Description

Defining common return types.

Author
sbstorz
Version
0.1
Date
2025-11-05

Macro Definition Documentation

◆ RETURN_ON_ERROR

#define RETURN_ON_ERROR (   x)
Value:
do \
{ \
{ \
return err_rc_; \
} \
} while (0);
err_type_t
Enum defining common error types.
Definition uErr.h:23

Macro which executes a function and returns from the calling function with the error code if the called function fails.

Adapted from the ESP-IDF

Parameters
xfunction to call

◆ RETURN_ON_FALSE

#define RETURN_ON_FALSE (   a,
  err_code 
)
Value:
do \
{ \
if (!(a)) \
{ \
return err_code; \
} \
} while (0);

Macro which returns the calling function with specified error_code if the given condition is false.

Adapted from the ESP-IDF

Parameters
aexpression that evaluates to true or false
err_codereturn code to return on false

◆ RETURN_ON_NEGATIVE

#define RETURN_ON_NEGATIVE (   a,
  err_code 
)
Value:
do \
{ \
if ((a) < 0) \
{ \
return err_code; \
} \
} while (0);

Macro which returns the calling function with specified error_code if the given condition is negative.

Adapted from the ESP-IDF

Parameters
aexpression that evaluates to a signed number
err_codereturn code to return on false