I am attempting to create the following subclass.
Here is the .h file
//#ifndef H_MINICON_
//#define H_MINICON_
#include <Arduino.h> //needed for Serial.println
#include <string.h> //needed for memcpy
#include <Adafruit_ILI9341.h> // Hardware-specific library
#include "Arduino.h"
#include "Print.h"
#include <Adafruit_GFX.h>
#include <avr/pgmspace.h>
class MiniConsole : public Adafruit_ILI9341 {
public:
//MiniConsole();
MiniConsole(int8_t CS1);
void miniScreenConsole(char *miniConData);
private:
int _pin;
};
//#endif // H_MINICON_
and here is the .cpp file
#include <MiniConsole.h>
#include <Arduino.h>
#include <avr/pgmspace.h>
#include <TouchScreen.h>
#include <string.h>
MiniConsole::MiniConsole(int8_t cs1) : Adafruit_ILI9341(53, 77){
_pin = cs1;
}
void MiniConsole::miniScreenConsole(char *miniConData) {
Serial.println("testetst");
drawRect(80, 140, 175, 90, ILI9341_BLUE);
fillRect(80, 140, 175, 90, ILI9341_WHITE);
setCursor(0, 142);
setTextColor(ILI9341_BLUE);
setTextSize(1);
print("TEST test");
}
However ever when I call the function with the following lines, the program freezes.
MiniConsole mini = MiniConsole(1);
mini.miniScreenConsole("testData_");
I have a question with the constructor in the in .cpp file. I noticed that most of the time VM notices the contructor line and changes the color of the class. However in this instance the class "MiniConsole" is not the teal color but black. Does this mean I am doing something incorrectly? Is there anything you notice that is being done wrong. I am new the subclasses.
I would like to make the functions in the adafruit library available to other libraries in a project. I would like for other libraries to be able to write to the LCD directly. In order to do this I am attempting to subclass the Adafruit libary.