Error Handling

When using the API, errors may occur for a variety of reasons. For example, if the ETH32 device is powered off, there will be an error when trying to connect to it. As another example, if you try to read the value of a port, but specify a non-existent port number, an error will occur. All of the API functions have return values that indicate whether or not an error occurred.

The API functions return a value of zero when no error has occurred, or a negative value (one of the error codes listed below) when an error has occurred.

Note about eth32_open

The eth32_open function is different from the other functions. It returns the newly created handle to the device on success. The only invalid handle value is zero, which indicates an error if it is returned. If you need the actual error code, that can be returned through the parameter list.

Error Codes

The following error codes are defined in the header file: