You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an esp32-3248s035c board to make a MCU transport control using it's touchscreen instead of physical buttons. The display is managed by thew TFT_eSPI library.
I've been able to send MCU::Timedisplay data to the display with no problem, but I'd like to fully integrate the display on the library.
If I understood correctly I need to write a class with my display settings and functions, but I'm not sure about what else should I modify in order to make it work.
I've started with the OLED display example as a starting point but I can't get it to work, here is the code:
#include <Control_Surface.h>
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
BluetoothMIDI_Interface midi;
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
// Clase personalizada para manejar la pantalla TFT_eSPI
class My_TFT_eSPI_Display : public DisplayInterface {
public:
My_TFT_eSPI_Display() : tft() {}
void begin() override {
tft.init();
tft.setRotation(1); // Ajusta la rotación según necesites
tft.fillScreen(TFT_BLACK); // Limpia la pantalla
}
void drawBackground() override {
tft.fillScreen(TFT_BLACK); // Limpia la pantalla como fondo
}
void setCursor(int x, int y) {
tft.setCursor(x, y);
}
void setTextColor(uint16_t color, uint16_t background) {
tft.setTextColor(color, background);
}
void setTextSize(uint8_t size) {
tft.setTextSize(size);
}
void print(const char* text) {
tft.print(text);
}
void fillRect(int x, int y, int w, int h, uint16_t color) {
tft.fillRect(x, y, w, h, color);
}
void drawLine(int x1, int y1, int x2, int y2, uint16_t color) {
tft.drawLine(x1, y1, x2, y2, color);
}
void drawCircle(int x, int y, int r, uint16_t color) {
tft.drawCircle(x, y, r, color);
}
// void drawBitmap(int x, int y, const uint16_t* bitmap, int w, int h) {
// tft.drawBitmap(x, y, bitmap, w, h, TFT_WHITE);
// }
private:
TFT_eSPI tft;
}display = My_TFT_eSPI_Display ; // Instancia de la pantalla
// -------------------------- MIDI Input Elements --------------------------- //
MCU::TimeDisplay timedisplay {};
NoteValue play {MCU::PLAY};
NoteValue record {MCU::RECORD};
// ---------------------------- Display Elements ---------------------------- //
MCU::TimeDisplayDisplay timedisplaydisplay {
display, timedisplay, 10, 10, TFT_WHITE, 1,
};
void setup() {
display.begin(); // Inicializa la pantalla
RelativeCCSender::setMode(MACKIE_CONTROL_RELATIVE);
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Refresh all elements
// Puedes agregar más actualizaciones de pantalla aquí si es necesario
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
I'm using an esp32-3248s035c board to make a MCU transport control using it's touchscreen instead of physical buttons. The display is managed by thew TFT_eSPI library.
I've been able to send MCU::Timedisplay data to the display with no problem, but I'd like to fully integrate the display on the library.
If I understood correctly I need to write a class with my display settings and functions, but I'm not sure about what else should I modify in order to make it work.
I've started with the OLED display example as a starting point but I can't get it to work, here is the code:
Any ideas on how to move on?
Beta Was this translation helpful? Give feedback.
All reactions