getSPIerrorCode static method

SPIerrorCode getSPIerrorCode(
  1. int value
)

Converts the native error code value to GPIOerrorCode.

Implementation

static SPIerrorCode getSPIerrorCode(int value) {
  // must be negative
  if (value >= 0) {
    return SPIerrorCode.errorCodeNotMappable;
  }
  value = -value;

  // check range
  if (value > SPIerrorCode.spiErrorUnsupported.index) {
    return SPIerrorCode.errorCodeNotMappable;
  }

  return SPIerrorCode.values[value];
}