Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions examples/Basic/Displays/Displays.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
// If you use UnitRCA (for Video output), write this.
#include <M5UnitRCA.h>

// If you use AddOn Display Out For PoE-P4, write this.
#include <M5UnitPoEP4HDMI.h>

// * The display header must be included before the M5Unified library.

//----------------------------------------------------------------
Expand All @@ -64,7 +67,7 @@ void setup(void)
cfg.external_display.unit_lcd = false; // default=true. use UnitLCD
cfg.external_display.unit_rca = false; // default=true. use UnitRCA VideoOutput
cfg.external_display.module_rca = false; // default=true. use ModuleRCA VideoOutput

cfg.external_display.unit_poep4_hdmi = false; // default=true. use AddOn Display Out For PoE-P4
/*
※ Unit OLED, Unit Mini OLED, Unit GLASS2 cannot be distinguished at runtime and may be misidentified as each other.

Expand Down Expand Up @@ -163,6 +166,16 @@ void setup(void)
// cfg.unit_lcd.i2c_addr = 0x3E;
// cfg.unit_lcd.i2c_freq = 400000;
// cfg.unit_lcd.i2c_port = I2C_NUM_0;
#endif
#if defined ( __M5GFX_M5UNITPOEP4HDMI__ ) // setting for AddOn Display Out For PoE-P4.
// Supported timings only. Choose one of the following two modes:
cfg.unit_poep4_hdmi.width = 1280;
cfg.unit_poep4_hdmi.height = 720;
cfg.unit_poep4_hdmi.refresh_rate = 60;

// cfg.unit_poep4_hdmi.width = 1920;
// cfg.unit_poep4_hdmi.height = 1080;
// cfg.unit_poep4_hdmi.refresh_rate = 30;
#endif


Expand Down Expand Up @@ -194,6 +207,7 @@ void setup(void)
// m5::board_t::board_M5UnitOLED,
// m5::board_t::board_M5UnitLCD,
// m5::board_t::board_M5UnitRCA,
// m5::board_t::board_M5UnitPoEP4HDMI
} );


Expand All @@ -211,7 +225,7 @@ void setup(void)
int index_unit_mini_oled = M5.getDisplayIndex(m5::board_t::board_M5UnitMiniOLED);
int index_unit_lcd = M5.getDisplayIndex(m5::board_t::board_M5UnitLCD);
int index_unit_rca = M5.getDisplayIndex(m5::board_t::board_M5UnitRCA);

int index_unit_poep4_hdmi = M5.getDisplayIndex(m5::board_t::board_M5UnitPoEP4HDMI);
if (index_module_display >= 0) {
M5.Displays(index_module_display).print("This is Module Display\n");
}
Expand Down Expand Up @@ -239,6 +253,9 @@ void setup(void)
if (index_unit_rca >= 0) {
M5.Displays(index_unit_rca).print("This is Unit RCA\n");
}
if (index_unit_poep4_hdmi >= 0) {
M5.Displays(index_unit_poep4_hdmi).print("This is Unit PoE-P4 HDMI\n");
}
M5.delay(5000);
}

Expand Down
17 changes: 17 additions & 0 deletions examples/Basic/HowToUse/HowToUse.ino
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
// If you use UnitRCA (for Video output), write this.
#include <M5UnitRCA.h>

// If you use AddOn Display Out For PoE-P4, write this.
#include <M5UnitPoEP4HDMI.h>

// * The display header must be included before the M5Unified library.

//----------------------------------------------------------------
Expand Down Expand Up @@ -101,6 +104,7 @@ void setup(void)
cfg.external_display.unit_lcd = false; // default=true. use UnitLCD
cfg.external_display.unit_rca = false; // default=true. use UnitRCA VideoOutput
cfg.external_display.module_rca = false; // default=true. use ModuleRCA VideoOutput
cfg.external_display.unit_poep4_hdmi = false; // default=true. use AddOn Display Out For PoE-P4
/*
※ Unit OLED, Unit Mini OLED, Unit GLASS2 cannot be distinguished at runtime and may be misidentified as each other.

Expand All @@ -112,6 +116,7 @@ void setup(void)
- unit_oled
- unit_mini_oled
- unit_lcd
- unit_poep4_hdmi

※ Displays that cannot be auto-detected
- module_rca
Expand Down Expand Up @@ -180,6 +185,16 @@ void setup(void)
// cfg.unit_lcd.i2c_addr = 0x3E;
// cfg.unit_lcd.i2c_freq = 400000;
// cfg.unit_lcd.i2c_port = I2C_NUM_0;
#endif
#if defined ( __M5GFX_M5UNITPOEP4HDMI__ ) // setting for AddOn Display Out For PoE-P4.
// Supported timings only. Choose one of the following two modes:
// cfg.unit_poep4_hdmi.width = 1280;
// cfg.unit_poep4_hdmi.height = 720;
// cfg.unit_poep4_hdmi.refresh_rate = 60;

// cfg.unit_poep4_hdmi.width = 1920;
// cfg.unit_poep4_hdmi.height = 1080;
// cfg.unit_poep4_hdmi.refresh_rate = 30;
#endif

// begin M5Unified.
Expand All @@ -197,6 +212,7 @@ void setup(void)
// m5::board_t::board_M5UnitOLED,
// m5::board_t::board_M5UnitLCD,
// m5::board_t::board_M5UnitRCA,
// m5::board_t::board_M5UnitPoEP4HDMI,
} );

if (M5.Speaker.isEnabled())
Expand Down Expand Up @@ -298,6 +314,7 @@ void setup(void)
case m5::board_t::board_NanoH2: name = "NanoH2"; break;
#elif defined (CONFIG_IDF_TARGET_ESP32P4)
case m5::board_t::board_M5Tab5: name = "Tab5"; break;
case m5::board_t::board_M5UnitPoEP4: name = "UnitPoEP4"; break;
#else
case m5::board_t::board_M5Stack: name = "Stack"; break;
case m5::board_t::board_M5StackCore2: name = "StackCore2"; break;
Expand Down
20 changes: 18 additions & 2 deletions src/M5Unified.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ namespace m5
uint16_t unit_glass2 : 1;
uint16_t unit_rca : 1;
uint16_t module_rca : 1;
uint16_t reserve : 7;
uint16_t unit_poep4_hdmi : 1;
uint16_t reserve : 6;
} external_display;
uint16_t external_display_value = 0xFFFF;
};
Expand Down Expand Up @@ -209,6 +210,9 @@ namespace m5
#if defined ( __M5GFX_M5UNITLCD__ )
M5UnitLCD::config_t unit_lcd;
#endif
#if defined ( __M5GFX_M5UNITPOEP4HDMI__ )
M5UnitPoEP4HDMI::config_t unit_poep4_hdmi;
#endif
#if defined ( __M5GFX_M5UNITRCA__ )
M5UnitRCA::config_t unit_rca;
#endif
Expand Down Expand Up @@ -382,6 +386,18 @@ namespace m5
_begin(cfg);


// Unit PoEP4 has no built-in LCD; attach its LT8912B HDMI output as a board display.
#if defined ( __M5GFX_M5UNITPOEP4HDMI__ )
if (cfg.external_display.unit_poep4_hdmi && _board == board_t::board_M5UnitPoEP4 && getDisplayCount() == 0)
{
M5UnitPoEP4HDMI dsp(cfg.unit_poep4_hdmi);
dsp.setI2C(&In_I2C);
if (cfg.clear_display ? dsp.init() : dsp.init_without_reset(false)) {
addDisplay(dsp);
}
}
#endif

// Module Display / Unit OLED / Unit LCD is determined after _begin (because it must be after external power supply)
#if defined ( __M5GFX_M5MODULEDISPLAY__ )
if (cfg.external_display.module_display) {
Expand Down Expand Up @@ -663,4 +679,4 @@ namespace m5

extern m5::M5Unified M5;

#endif
#endif
Loading