Adafruit Library
hardware.h
Go to the documentation of this file.
1 
15 #ifndef WS_DISPLAY_HARDWARE_H
16 #define WS_DISPLAY_HARDWARE_H
17 #include "Wippersnapper.h"
18 #include "drivers/dispDrvBase.h"
19 #include "drivers/dispDrvSt7789.h"
22 #include <functional>
23 #include <map>
24 
32 public:
33  DisplayHardware(const char *name);
35 
36  //
37  // API for configuring the display hardware //
38  //
39  const char *getName();
40  void setType(wippersnapper_display_v1_DisplayType type);
41  wippersnapper_display_v1_DisplayType getType();
42  bool beginEPD(wippersnapper_display_v1_DisplayDriver *driver,
43  wippersnapper_display_v1_EPDConfig *config,
44  wippersnapper_display_v1_EpdSpiConfig *spi_config);
45  bool beginTft(wippersnapper_display_v1_DisplayDriver *driver,
46  wippersnapper_display_v1_TftConfig *config,
47  wippersnapper_display_v1_TftSpiConfig *spi_config);
48 
49  void showSplash();
50  void drawStatusBar(const char *io_username);
51  void updateStatusBar(int8_t rssi, uint8_t bat, bool mqtt_connected);
52  //
53  // API for Adafruit_GFX that abstracts hardware functionality
54  // NOTE: These methods are meant to be implemented within dispDrvBase and
55  // exposed within dispDrv driver instances
56  //
57  void writeMessage(const char *message);
58 
59 private:
60  int16_t parsePin(const char *pinStr);
61  void removeSuffix(const char *suffix);
62  bool detect_ssd1680(uint8_t cs, uint8_t dc, uint8_t rst);
63  char _name[64];
64  wippersnapper_display_v1_DisplayType _type;
65  dispDrvBase *_drvDisp = nullptr;
66 };
67 #endif // WS_DISPLAY_HARDWARE_H
DisplayHardware(const char *name)
Constructs a new DisplayHardware object.
Definition: hardware.cpp:121
wippersnapper_display_v1_DisplayType getType()
Gets the hardware&#39;s display type.
Definition: hardware.cpp:150
bool beginEPD(wippersnapper_display_v1_DisplayDriver *driver, wippersnapper_display_v1_EPDConfig *config, wippersnapper_display_v1_EpdSpiConfig *spi_config)
Configures the EPD display with the provided configuration.
Definition: hardware.cpp:178
bool beginTft(wippersnapper_display_v1_DisplayDriver *driver, wippersnapper_display_v1_TftConfig *config, wippersnapper_display_v1_TftSpiConfig *spi_config)
Attempts to configure and initialize a TFT display.
Definition: hardware.cpp:327
const char * getName()
Gets the name of the display hardware instance.
Definition: hardware.cpp:378
void setType(wippersnapper_display_v1_DisplayType type)
Sets the hardware&#39;s display type.
Definition: hardware.cpp:142
void drawStatusBar(const char *io_username)
Draws a status bar at the top of the display.
Definition: hardware.cpp:282
Interface for interacting with display hardware (TFT, eInk, OLED, etc.) This class provides methods t...
Definition: hardware.h:31
void updateStatusBar(int8_t rssi, uint8_t bat, bool mqtt_connected)
Updates the status bar with the latest RSSI, battery, and MQTT connection status. ...
Definition: hardware.cpp:298
void writeMessage(const char *message)
Writes a message to the display.
Definition: hardware.cpp:385
Abstract base class for display drivers. This class provides a common interface for all display drive...
Definition: dispDrvBase.h:28
void showSplash()
Displays the splash screen on the display.
Definition: hardware.cpp:271
~DisplayHardware()
Destructor.
Definition: hardware.cpp:130