I'm having some programming problems.
So here's what's happening:
inIn my .ino file, iI have a "tft"tft variable which holds the connection to a lcdLCD. I want to make a class which can either automatically access that "tft"tft class contained in the .ino, or pass it into the constructor when it's created; so basically:
// assuming this is the .ino:
TFT_ILI9163C tft = TFT_ILI9163C(cs, dc, rst);
MenuClass *menu = MenuClass();
menu->init("Example", tft); // this should work and "menu" should now have access to the "tft" variable
Here's my Menu.cpp:
// Menu class
#include "Menu.h"
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <TFT_ILI9163C.h>
String menName = "Unnamed";
void MenuClass::init(const String name)
{
menName = name;
}
String MenuClass::getName() {
return menName;
}
void MenuClass::draw() {
tft.setCursor(2, 2);
tft.print(menName);
}
MenuClass Menu;