Hello everyone,
My hardware:
M0+4x4Foilkeyboar+I2C (PCF8574 on I2C) and then add the TFT ST773 on SPI.
The moment i include this library for my ST7735 the compilation fails
Can any one help me to change the "IDLE redeclaration" for both librarys to work together on my M0?
file included from K:\arduino-1.8.13\portable\sketchbook\libraries\Keypad\src/Keypad.h:36:0,
from K:\arduino-1.8.13\portable\sketchbook\libraries\Keypad_I2C/Keypad_I2C.h:43,
from K:\arduino-1.8.13\portable\sketchbook\Keypad_i2c\Keypad_i2c.ino:29:
K:\arduino-1.8.13\portable\sketchbook\libraries\Keypad\src/Key.h:41:15: error: redeclaration of 'IDLE'
typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState;
^~~~
In file included from K:\arduino-1.8.13\portable\sketchbook\Keypad_i2c\Keypad_i2c.ino:28:0:
K:\arduino-1.8.13\portable\sketchbook\libraries\TFT_ST7735-1.0p1/TFT_ST7735.h:104:38: note: previous declaration 'ST7735_modes IDLE'
enum ST7735_modes { NORMAL=0,PARTIAL,IDLE,SLEEP,INVERT,DISP_ON,DISP_OFF };//0,1,2,3,4,5,6
^~~~
exit status 1
Fehler beim Kompilieren für das Board Arduino Zero (Native USB Port).
Complete Sketch:
#include <Keypad_I2C.h>
#include <Keypad.h>
#include <Wire.h>
//Would like to use ST7735 displays and gives error:
#include <SPI.h> // include for TFT
#include <TFT_ST7735.h> // https://github.com/sumotoy/TFT_ST7735/tree/1.0p1
/****************************(Definieren der Globale Variablen)***************************/
#define I2CADDR 0x20 // I2C Adresse vom PCF8574
const byte anzZeilen = 4; //Anzahl Zeilen
const byte anzSpalten = 4; //Anzahl Spalten
//Symbole Keypad
char tastenLayout[anzZeilen][anzSpalten] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
//Hier definieren wie das Keypad mit den IO Pins vom PCF8574 verdrahtet ist.
byte zeilenPins[anzZeilen] = { 0, 1, 2, 3}; //Zeilen Pins
byte spaltenPins[anzSpalten] = { 4, 5, 6, 7}; //Spalten Pins
//Initialisierung von Keypad
Keypad_I2C i2cKeypad( makeKeymap(tastenLayout), zeilenPins, spaltenPins, anzZeilen, anzSpalten, I2CADDR);
/*******************************************(setup)****************************************/
void setup(){
Wire.begin( );
i2cKeypad.begin( );
Serial.begin(9600);
Serial.println("Setup");
}
/*************************************(Hauptprogramm)**************************************/
void loop(){
char ausgeleseneTaste = i2cKeypad.getKey();
if (ausgeleseneTaste != NO_KEY){
Serial.println(ausgeleseneTaste);
}
}
Keypad_i2c.ino (1.55 KB)
TFT_ST7735-1.0p1.zip (407 KB)