ERR_UNABLE_TO_LOAD_LIBRARY = -1
ERR_UNABLE_TO_LOAD_DRIVER = -2
ERR_UNABLE_TO_LOAD_FUNCTION = -3
ERR_INCOMPATIBLE_LIBRARY = -4
ERR_INCOMPATIBLE_DEVICE = -5
ERR_COMMUNICATION_ERROR = -6
ERR_UNABLE_TO_OPEN = -7
ERR_UNABLE_TO_CLOSE = -8
ERR_INVALID_HANDLE = -9
ERR_CONFIG_ERROR = -10
ERR_I2C_NOT_AVAILABLE = -100
ERR_I2C_NOT_ENABLED = -101
ERR_I2C_READ_ERROR = -102
ERR_I2C_WRITE_ERROR = -103
ERR_I2C_SLAVE_BAD_CONFIG = -104
ERR_I2C_SLAVE_READ_ERROR = -105
ERR_I2C_SLAVE_TIMEOUT = -106
ERR_I2C_DROPPED_EXCESS_BYTES = -107
ERR_I2C_BUS_ALREADY_FREE = -108
ERR_SPI_NOT_AVAILABLE = -200
ERR_SPI_NOT_ENABLED = -201
ERR_SPI_WRITE_ERROR = -202
ERR_SPI_SLAVE_READ_ERROR = -203
ERR_SPI_SLAVE_TIMEOUT = -204
ERR_SPI_DROPPED_EXCESS_BYTES = -205

PORT_NOT_FREE = 0x8000

CONFIG_GPIO_ONLY = 0x00
CONFIG_SPI_GPIO = 0x01
CONFIG_GPIO_I2C = 0x02
CONFIG_SPI_I2C = 0x03
CONFIG_QUERY = 0x80

I2C_NO_FLAGS = 0x00
I2C_10_BIT_ADDR = 0x01
I2C_COMBINED_FMT = 0x02
I2C_NO_STOP = 0x04
I2C_SIZED_READ = 0x10
I2C_SIZED_READ_EXTRA1 = 0x20

I2C_PULLUP_NONE = 0x00
I2C_PULLUP_BOTH = 0x03
I2C_PULLUP_QUERY = 0x80

TARGET_POWER_NONE = 0x00
TARGET_POWER_BOTH = 0x03
TARGET_POWER_QUERY = 0x80

POLL_NO_DATA = 0x00
POLL_I2C_READ = 0x01
POLL_I2C_WRITE = 0x02
POLL_SPI = 0x04
POLL_I2C_MONITOR = 0x08

SPI_POL_RISING_FALLING = 0
SPI_POL_FALLING_RISING = 1
SPI_PHASE_SAMPLE_SETUP = 0
SPI_PHASE_SETUP_SAMPLE = 1
SPI_BITORDER_MSB = 0
SPI_BITORDER_LSB = 1

SPI_MODE_0 = 0
SPI_MODE_3 = 3

SPI_SS_ACTIVE_LOW = 0
SPI_SS_ACTIVE_HIGH = 1
