New Adafruit MCP23017 library

Seems like the header file contain meaningless code:

#define MCP23XXX_ADDR 0x20 //!< Default I2C Address
#define MCP23XXX_SPIREG                                                        \
  ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

#define MCP_PORT(pin) ((pin < 8) ? 0 : 1) //!< Determine port from pin number

Causing error:

In file included from C:\Users\dahls\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp:23:0:

C:\Users\dahls\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::pinMode(uint8_t, uint8_t)':

C:\Users\dahls\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\dahls\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Or is it something I'm missing?

When you went to the GitHub location of the Adafruit Library in question and asked the same question there, after all they wrote the dang thing, what was the response?

Hi,
I just updated the Adafruit library, using the IDE library manager and the 23017 examples compiled ok.

How did you load/update your library?
I have now got Verision 2.0.2

Tom... :smiley: :+1: :coffee: :australia:

This seems to be the file: https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library/blob/master/src/Adafruit_MCP23XXX.h

Do you also have the newest BusIO library ?
Because that is where "ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE" is defined. It is inside this typedef enum: https://github.com/adafruit/Adafruit_BusIO/blob/master/Adafruit_BusIO_Register.h#L34

Which Arduino IDE version do you use and which Arduino board ?

The old version of the library (which I have reverted back to), is 1.3.0. The new one was updated by using the Tools > Manage Libraries and selecting the update able ones.

Current version of BusIO is 1.7.1.

Hi,
Can you post your code that gives these errors?
Or a smaller code that does the same thing?

What model Arduino are you using?

I got a succesfull compile of the example with Nano selected.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

I'm using a Mega2560 but I guess the error will appear with UNO or Nano.
The code is big and since I have restored the library to the old version, I need to update it again and change my own libraries to get the error. I'll try to do that later.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.