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
3 changes: 0 additions & 3 deletions idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ issues: https://github.com/m5stack/M5Unified/issues
repository: https://github.com/m5stack/M5Unified.git
url: https://github.com/m5stack/M5Unified.git
version: 0.2.17
dependencies:
m5stack/m5gfx:
version: ">=0.2.22"
10 changes: 9 additions & 1 deletion src/M5Unified.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ static constexpr const uint8_t _pin_table_i2c_ex_in[][5] = {
{ board_t::board_M5Tab5 , GPIO_NUM_32,GPIO_NUM_31 , GPIO_NUM_54,GPIO_NUM_53 }, // Tab5
{ board_t::board_M5UnitPoEP4 , GPIO_NUM_1 ,GPIO_NUM_0 , GPIO_NUM_54,GPIO_NUM_53 },
{ board_t::board_unknown , 255 ,255 , 255 ,255 },
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
{ board_t::board_unknown , 255 ,255 , 255 ,255 },
#else
{ board_t::board_M5Stack , GPIO_NUM_22,GPIO_NUM_21 , GPIO_NUM_22,GPIO_NUM_21 },
{ board_t::board_M5Paper , GPIO_NUM_22,GPIO_NUM_21 , GPIO_NUM_32,GPIO_NUM_25 },
Expand Down Expand Up @@ -144,6 +146,7 @@ static constexpr const uint8_t _pin_table_port_bc[][5] = {
#elif defined (CONFIG_IDF_TARGET_ESP32H2)
#elif defined (CONFIG_IDF_TARGET_ESP32P4)
{ board_t::board_M5Tab5 , GPIO_NUM_17,GPIO_NUM_52, GPIO_NUM_7 ,GPIO_NUM_6 }, // Tab5
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#else
{ board_t::board_M5Stack , GPIO_NUM_36,GPIO_NUM_26 , GPIO_NUM_16,GPIO_NUM_17 },
{ board_t::board_M5StackCore2 , GPIO_NUM_36,GPIO_NUM_26 , GPIO_NUM_13,GPIO_NUM_14 },
Expand All @@ -163,6 +166,7 @@ static constexpr const uint8_t _pin_table_port_de[][5] = {
#elif defined (CONFIG_IDF_TARGET_ESP32C6)
#elif defined (CONFIG_IDF_TARGET_ESP32C61)
#elif defined (CONFIG_IDF_TARGET_ESP32H2)
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#else
{ board_t::board_M5Stack , GPIO_NUM_34,GPIO_NUM_35 , GPIO_NUM_5 ,GPIO_NUM_13 },
{ board_t::board_M5StackCore2 , GPIO_NUM_34,GPIO_NUM_35 , GPIO_NUM_27,GPIO_NUM_19 },
Expand Down Expand Up @@ -190,6 +194,7 @@ static constexpr const uint8_t _pin_table_sd[][7] = {
#elif defined (CONFIG_IDF_TARGET_ESP32H2)
#elif defined (CONFIG_IDF_TARGET_ESP32P4)
{ board_t::board_M5Tab5 , GPIO_NUM_43, GPIO_NUM_44, GPIO_NUM_39, GPIO_NUM_40, GPIO_NUM_41, GPIO_NUM_42 },
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#else
{ board_t::board_M5Stack , GPIO_NUM_18, GPIO_NUM_23, GPIO_NUM_19, 255 , 255 , GPIO_NUM_4 },
{ board_t::board_M5StackCore2 , GPIO_NUM_18, GPIO_NUM_23, GPIO_NUM_38, 255 , 255 , GPIO_NUM_4 },
Expand Down Expand Up @@ -221,6 +226,7 @@ static constexpr const uint8_t _pin_table_other0[][2] = {
#elif defined (CONFIG_IDF_TARGET_ESP32C61)
#elif defined (CONFIG_IDF_TARGET_ESP32H2)
{ board_t::board_M5NanoH2 , GPIO_NUM_11 },
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#else
{ board_t::board_M5Stack , GPIO_NUM_15 },
{ board_t::board_M5StackCore2 , GPIO_NUM_25 },
Expand Down Expand Up @@ -248,6 +254,7 @@ static constexpr const uint8_t _pin_table_other1[][2] = {
#elif defined (CONFIG_IDF_TARGET_ESP32C6)
#elif defined (CONFIG_IDF_TARGET_ESP32C61)
#elif defined (CONFIG_IDF_TARGET_ESP32H2)
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#else

{ board_t::board_M5StickCPlus2 , GPIO_NUM_4 },
Expand Down Expand Up @@ -334,6 +341,7 @@ static constexpr const uint8_t _pin_table_mbus[][31] = {
#elif defined (CONFIG_IDF_TARGET_ESP32C6)
#elif defined (CONFIG_IDF_TARGET_ESP32C61)
#elif defined (CONFIG_IDF_TARGET_ESP32H2)
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#else
{ board_t::board_M5Stack ,
255 , GPIO_NUM_35,
Expand Down Expand Up @@ -1625,7 +1633,7 @@ static constexpr const uint8_t _pin_table_mbus[][31] = {
gpio_num_t ex_sda = (gpio_num_t)getPin(pin_name_t::ex_i2c_sda);

i2c_port_t ex_port = I2C_NUM_0;
#if SOC_I2C_NUM == 1 || defined (CONFIG_IDF_TARGET_ESP32C6)
#if SOC_I2C_NUM == 1 || defined (CONFIG_IDF_TARGET_ESP32C6) || defined (CONFIG_IDF_TARGET_ESP32C5)
i2c_port_t in_port = I2C_NUM_0;
#else
i2c_port_t in_port = I2C_NUM_1;
Expand Down
2 changes: 2 additions & 0 deletions src/M5Unified.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ namespace m5


static int8_t getPin(pin_name_t name) { return _get_pin_table[name]; }
static bool hasSD(void) { return getPin(pin_name_t::sd_mmc_clk) >= 0; }
static bool hasSDMMC(void) { return getPin(pin_name_t::sd_mmc_d1) >= 0; }

Button_Class& getButton(size_t index) { return _buttons[index]; }

Expand Down
8 changes: 4 additions & 4 deletions src/utility/Mic_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <esp_log.h>
#include <math.h>

#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined ( CONFIG_IDF_TARGET_ESP32C6 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined ( CONFIG_IDF_TARGET_ESP32C6 ) || defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if __has_include(<driver/i2s_std.h>)
#if __has_include(<hal/i2s_ll.h>)
#include <hal/i2s_ll.h>
Expand Down Expand Up @@ -428,7 +428,7 @@ if (_cfg.pin_bck < 0 || _cfg.pin_ws < 0) {

bool use_pdm = (self->_cfg.pin_bck < 0 && !self->_cfg.use_adc);

#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32S3 )
#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32S3 )
static constexpr uint32_t PLL_D2_CLK = 120*1000*1000; // 240 MHz/2
#elif defined ( CONFIG_IDF_TARGET_ESP32P4 )
static constexpr uint32_t PLL_D2_CLK = 20*1000*1000; // 20 MHz
Expand Down Expand Up @@ -457,7 +457,7 @@ if (_cfg.pin_bck < 0 || _cfg.pin_ws < 0) {
#endif
#endif

#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined ( CONFIG_IDF_TARGET_ESP32C6 ) || defined ( CONFIG_IDF_TARGET_ESP32C61 ) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined ( CONFIG_IDF_TARGET_ESP32C6 ) || defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined ( CONFIG_IDF_TARGET_ESP32C61 ) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )

dev->rx_conf.rx_pdm_en = use_pdm;
dev->rx_conf.rx_tdm_en = !use_pdm;
Expand All @@ -470,7 +470,7 @@ if (_cfg.pin_bck < 0 || _cfg.pin_ws < 0) {
#endif
dev->rx_conf.rx_update = 1;

#if defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
dev->rx_conf.rx_bck_div_num = div_m - 1;
#else
dev->rx_conf1.rx_bck_div_num = div_m - 1;
Expand Down
5 changes: 3 additions & 2 deletions src/utility/Power_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,7 @@ namespace m5
{
#if defined (CONFIG_IDF_TARGET_ESP32C3)
#elif defined (CONFIG_IDF_TARGET_ESP32C6)
#elif defined (CONFIG_IDF_TARGET_ESP32C5)
#elif defined (CONFIG_IDF_TARGET_ESP32P4)
#else
#if !defined (CONFIG_IDF_TARGET) || defined (CONFIG_IDF_TARGET_ESP32)
Expand Down Expand Up @@ -1227,7 +1228,7 @@ namespace m5
(void)touch_wakeup;
#else
ESP_LOGD("Power","deepSleep");
#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined (CONFIG_IDF_TARGET_ESP32C6) // || defined (CONFIG_IDF_TARGET_ESP32P4)
#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined (CONFIG_IDF_TARGET_ESP32C5) // || defined (CONFIG_IDF_TARGET_ESP32P4)

#else

Expand Down Expand Up @@ -1278,7 +1279,7 @@ namespace m5
(void)touch_wakeup;
#else
ESP_LOGD("Power","lightSleep");
#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined (CONFIG_IDF_TARGET_ESP32H2) || defined (CONFIG_IDF_TARGET_ESP32P4)
#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined (CONFIG_IDF_TARGET_ESP32C5) || defined (CONFIG_IDF_TARGET_ESP32H2) || defined (CONFIG_IDF_TARGET_ESP32P4)

#else

Expand Down
8 changes: 4 additions & 4 deletions src/utility/Speaker_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <sdkconfig.h>
#include <esp_log.h>

#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined ( CONFIG_IDF_TARGET_ESP32C6 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined ( CONFIG_IDF_TARGET_ESP32C6 ) || defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if __has_include(<driver/i2s_std.h>)
#if __has_include(<hal/i2s_ll.h>)
#include <hal/i2s_ll.h>
Expand Down Expand Up @@ -378,7 +378,7 @@ namespace m5
#else
const i2s_port_t i2s_port = self->_cfg.i2s_port;

#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32S3 )
#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32S3 )
static constexpr uint32_t PLL_D2_CLK = 120*1000*1000; // 240 MHz/2
#elif defined ( CONFIG_IDF_TARGET_ESP32P4 )
static constexpr uint32_t PLL_D2_CLK = 20*1000*1000; // 20 MHz
Expand Down Expand Up @@ -410,15 +410,15 @@ namespace m5
#endif
#endif

#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined ( CONFIG_IDF_TARGET_ESP32C61 ) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if defined ( CONFIG_IDF_TARGET_ESP32C3 ) || defined (CONFIG_IDF_TARGET_ESP32C6) || defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined ( CONFIG_IDF_TARGET_ESP32C61 ) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32S3 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
// モノラル設定時、同じデータを左右両方に送信する設定
if (!self->_cfg.stereo && !self->_cfg.use_dac && !self->_cfg.buzzer)
{
dev->tx_conf.tx_mono = 1;
dev->tx_conf.tx_chan_equal = 1;
}

#if defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
#if defined ( CONFIG_IDF_TARGET_ESP32C5 ) || defined (CONFIG_IDF_TARGET_ESP32C61) || defined ( CONFIG_IDF_TARGET_ESP32H2 ) || defined ( CONFIG_IDF_TARGET_ESP32P4 )
dev->tx_conf.tx_bck_div_num = div_m - 1;
#else
dev->tx_conf1.tx_bck_div_num = div_m - 1;
Expand Down
Loading