Add Doxygen

This commit is contained in:
brentru 2025-08-26 15:32:57 -04:00
parent 7be4cadfd0
commit c8961599bf
5 changed files with 78 additions and 41 deletions

View file

@ -1,26 +0,0 @@
# 1 "/var/folders/ff/dmzflvf52tq9kzvt6g8jglxw0000gn/T/tmpr2yz0h9_"
#include <Arduino.h>
# 1 "/Users/brentrubell/Documents/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo.ino"
# 16 "/Users/brentrubell/Documents/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo.ino"
#include "Wippersnapper_Networking.h"
Wippersnapper_WiFi wipper;
#define WS_DEBUG
void setup();
void loop();
#line 22 "/Users/brentrubell/Documents/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo.ino"
void setup() {
wipper.provision();
Serial.begin(115200);
wipper.connect();
}
void loop() {
wipper.run();
}

View file

@ -94,10 +94,34 @@ public:
*/
virtual void writeMessage(const char *message) = 0;
/*!
@brief Sets the width of the display.
@param w
The width of the display in pixels.
*/
void setWidth(int16_t w) { _width = w; }
/*!
@brief Sets the height of the display.
@param h
The height of the display in pixels.
*/
void setHeight(int16_t h) { _height = h; }
/*!
@brief Sets the rotation of the display.
@param r
The rotation of the display (0-3).
*/
void setRotation(uint8_t r) { _rotation = r; }
/*!
@brief Sets the text size for the display.
@param s
The text size to set.
@note This method can be overridden by derived classes to provide
specific functionality.
*/
virtual void setTextSize(uint8_t s) { _text_sz = s; }
protected:

View file

@ -18,7 +18,7 @@
#include "dispDrvBase.h"
#include <Adafruit_ST7789.h>
#define ST7789_TEXT_SZ_DEFAULT 2
#define ST7789_TEXT_SZ_DEFAULT 2 ///< Default text size for ST7789 displays
/*!
@brief Driver for ST7789-based TFT displays.
@ -70,19 +70,27 @@ public:
#endif
_display = new Adafruit_ST7789(_pin_cs, _pin_dc, _pin_rst);
if (!_display)
return false;
_display->init(_width, _height);
_display->setRotation(_rotation);
setTextSize(ST7789_TEXT_SZ_DEFAULT);
_display->fillScreen(ST77XX_BLACK);
_display->setTextColor(ST77XX_WHITE);
_display->setTextSize(ST7789_TEXT_SZ_DEFAULT);
return true;
}
/*!
@brief Sets the text size for the display.
@param s
The text size to set.
@note This method overrides the base class method to provide specific
functionality for the ST7789 driver.
*/
void setTextSize(uint8_t s) override {
if (!_display)
return;
_text_sz = s;
_display->setTextSize(s);
}
@ -92,7 +100,7 @@ public:
@param message
The message to write to the display.
@note This method overrides the base class method to provide specific
functionality for the Think Ink Grayscale 4 EAAMGFGN driver.
functionality for the ST7789 driver.
*/
virtual void writeMessage(const char *message) override {
if (_display == nullptr)

View file

@ -50,11 +50,6 @@ static const std::map<std::string, FnCreateDispDrvTft> FactoryDrvDispTft = {
return new dispDrvSt7789(cs, dc, mosi, sck, rst, miso);
}},
{"st7789",
[](int16_t cs, int16_t dc, int16_t mosi, int16_t sck, int16_t rst,
int16_t miso) -> dispDrvBase * {
return new dispDrvSt7789(cs, dc, mosi, sck, rst, miso);
}},
{"st7789-large",
[](int16_t cs, int16_t dc, int16_t mosi, int16_t sck, int16_t rst,
int16_t miso) -> dispDrvBase * {
return new dispDrvSt7789(cs, dc, mosi, sck, rst, miso);
@ -93,6 +88,20 @@ dispDrvBase *CreateDrvDispEpd(const char *driver_name, int16_t dc, int16_t rst,
name.
@param driver_name
The name of the SPI TFT display driver to create.
@param cs
Chip Select pin number.
@param dc
Data/Command pin number.
@param mosi
MOSI pin number.
@param sck
SCK pin number.
@param rst
Optional Reset pin number (default: -1).
@param miso
Optional MISO pin number (default: -1).
@return Pointer to the created display driver instance, or nullptr if the
driver name is not recognized.
*/
dispDrvBase *CreateDrvDispTft(const char *driver_name, int16_t cs, int16_t dc,
int16_t mosi, int16_t sck, int16_t rst = -1,
@ -244,6 +253,18 @@ bool DisplayHardware::beginEPD(
return true;
}
/*!
@brief Removes a suffix from the hardware instance name, if it exists.
@param suffix
The suffix to remove (e.g., "-lg", "-md", "-sm").
*/
void DisplayHardware::removeSuffix(const char *suffix) {
char *suffix_pos = strstr(_name, suffix);
if (suffix_pos) {
*suffix_pos = '\0'; // Truncate string at suffix position
}
}
/*!
@brief Attempts to configure and initialize a TFT display
@param config
@ -282,6 +303,20 @@ bool DisplayHardware::beginTft(
miso = parsePin(spi_config->pin_miso);
}
// Configure text size based on suffix in driver name
uint8_t text_sz; // Default text size
if (strstr(_name, "-lg") != nullptr) {
// Larger text size for displays with -lg suffix
text_sz = 4;
removeSuffix("-lg");
} else if (strstr(_name, "-md") != nullptr) {
// Larger text size for displays with -md suffix
text_sz = 3;
removeSuffix("-md");
} else {
text_sz = 1;
}
// Create display driver object using the factory function
_drvDisp = CreateDrvDispTft(_name, cs, dc, mosi, sck, rst, miso);
if (!_drvDisp) {
@ -289,17 +324,12 @@ bool DisplayHardware::beginTft(
return false;
}
// Check if name has -large suffix, and if so, set a larger default text size
if (strstr(_name, "-large") != nullptr) {
_drvDisp->setTextSize(3); // Large text size for -large displays
}
_drvDisp->setWidth(config->width);
_drvDisp->setHeight(config->height);
_drvDisp->setRotation(config->rotation);
_drvDisp->begin();
_drvDisp->setTextSize(text_sz);
WS_DEBUG_PRINTLN("[display] TFT display initialized successfully!");
return true;
}

View file

@ -53,6 +53,7 @@ public:
private:
int16_t parsePin(const char *pinStr);
void removeSuffix(const char *suffix);
bool detect_ssd1680(uint8_t cs, uint8_t dc, uint8_t rst);
char _name[64]; ///< Identifies the hardware instance
wippersnapper_display_v1_DisplayType _type; ///< Display type