Go Down

Topic: I2C keypad on Due ? (Read 2160 times) previous topic - next topic

bowzee

Jul 26, 2016, 06:56 pm Last Edit: Jul 26, 2016, 07:06 pm by bowzee
I have been trying to use a keypad with an I2C PCF8574 chip hooked up to a Due, but there is some problem with the Wire.h / Wire.cpp implementation. Specifically, the constructor for TwoWire for AVR and SAM are different:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src :

 TwoWire();

C:\Users\bowzee\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\libraries\Wire\src :

 TwoWire(Twi *twi, void(*begin_cb)(void), void(*end_cb)(void));

In the Keypad_I2C library by Joe Young et al. ( https://github.com/joeyoung/arduino_keypads/tree/master/Keypad_I2C ) this is the constructor:

   class Keypad_I2C : public Keypad, public TwoWire {
        public:
        Keypad_I2C(char* userKeymap, byte* row, byte* col, byte numRows, byte numCols, byte address, byte width = 1) : Keypad(userKeymap, row, col, numRows, numCols) { i2caddr = address; i2cwidth = width;}
...


so TwoWire does not get the required three parameters for SAM / Due.

Is there an easy workaround for this?

bowzee

Hi @facchinm,

(I am re-posting here because I am not sure if you are going to read this at https://github.com/arduino/Arduino/issues/5165 )

I do not want to rewrite Joe Young's libraries. What I am trying to report is the inconsistency, there is no TwoWire::TwoWire() for SAM (Due), so an exact same program written for AVR will not work with Due (it will not get compiled). Like the examples included with these libraries.

I agree that there probably is no need for inheritance (in fact it gets confusing), but that is not my code.

zircothc

Hi. Did you solve the problem?
I can compile i2c keypad library (mcp23017) with avr, esp8266, but not in DUE

;)

bos1714

Hello there!

I haven't used that keypad and chip before so forgive me if this doesn't make sense. I have used the standard Wire library on the Due fairly extensively. Is there a way you can use wire and then just read the registers of the chip or something?
Time line? Time isn't made out of lines. It is made out of circles. That is why clocks are round.

Go Up