12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include <string.h>
- #include <ctype.h>
- #include <stdint.h>
- #include <arpa/inet.h>
- #include "esp_log.h"
- #include "config.h"
- #include "display.h"
- extern struct display_s SSD1306_display;
- struct display_s *display;
- static const char *TAG = "display";
- void display_init(char *welcome) {
- char *item = config_alloc_get(NVS_TYPE_STR, "display_config");
- if (item && *item) {
- char * drivername=strstr(item,"driver");
- if (!drivername || (drivername && strcasestr(drivername,"SSD1306"))) {
- display = &SSD1306_display;
- if (display->init(item, welcome)) {
- ESP_LOGI(TAG, "Display initialization successful");
- } else {
- ESP_LOGE(TAG, "Display initialization failed");
- }
- } else {
- ESP_LOGE(TAG,"Unknown display driver name in display config: %s",item);
- }
- } else {
- ESP_LOGW(TAG, "no display");
- }
-
- if (item) free(item);
- }
|