diff --git a/include/blisp.h b/include/blisp.h index ce85fb1..16cd2e2 100644 --- a/include/blisp.h +++ b/include/blisp.h @@ -3,20 +3,8 @@ #define _LIBBLISP_H #include - #include "blisp_chip.h" - -enum blisp_return { - BLISP_OK = 0, - BLISP_ERR_UNKNOWN = -1, - BLISP_ERR_NO_RESPONSE = -2, - BLISP_ERR_DEVICE_NOT_FOUND = -3, - BLISP_ERR_CANT_OPEN_DEVICE = -4, - // Can't auto-find device due it doesn't have native USB - BLISP_ERR_NO_AUTO_FIND_AVAILABLE = -5, - BLISP_ERR_PENDING = -6, - BLISP_ERR_CHIP_ERR = -7 -}; +#include "error_codes.h" struct blisp_segment_header { uint32_t dest_addr; diff --git a/include/error_codes.h b/include/error_codes.h new file mode 100644 index 0000000..b190dd8 --- /dev/null +++ b/include/error_codes.h @@ -0,0 +1,21 @@ +#ifndef BLISP_S_RC_ERROR_CODES_H_ +#define BLISP_S_RC_ERROR_CODES_H_ + +typedef enum { + BLISP_OK = 0, + // All error states must be <0. + // Generic error return; for when we are unsure what failed + BLISP_ERR_UNKNOWN = -1, + // Device did not respond, if serial link, could be that its not in bootloader + BLISP_ERR_NO_RESPONSE = -2, + // Failed to open a device, likely libusb or permissions + BLISP_ERR_DEVICE_NOT_FOUND = -3, + BLISP_ERR_CANT_OPEN_DEVICE = -4, + // Can't auto-find device due it doesn't have native USB + BLISP_ERR_NO_AUTO_FIND_AVAILABLE = -5, + BLISP_ERR_PENDING = -6, + BLISP_ERR_CHIP_ERR = -7, + BLISP_ERR_INVALID_CHIP_TYPE = -8, + +} blisp_return_t; +#endif \ No newline at end of file