fix I2C pin alloc, and prep for settngs decluttering
ES7243: fix I2C pin alloc (multi-pin) AR settings: prepare for de-cluttering
This commit is contained in:
@@ -1853,16 +1853,16 @@ class AudioReactive : public Usermod {
|
|||||||
oappend(SET_F("addOption(dd,'Send',1);"));
|
oappend(SET_F("addOption(dd,'Send',1);"));
|
||||||
oappend(SET_F("addOption(dd,'Receive',2);"));
|
oappend(SET_F("addOption(dd,'Receive',2);"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'<i>requires reboot!</i>');")); // 0 is field type, 1 is actual field
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'<i>requires reboot!</i>');")); // 0 is field type, 1 is actual field
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data (SD / DATA / DOUT) ');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data: SD / DOUT /DATA');"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S Left/Right Clock (WS / CLK / LRCK)');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S Left/Right Clock: WS / LRCK / CLK');"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock (SCK / BCLK)');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock: SCK / BCLK');"));
|
||||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
|
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK <br/><i>only use -1, 0, 1 or 3 for MCLK</i>');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK - I2S Master CLK<br/><i>only use -1, 0, 1 or 3 for MCLK</i>');"));
|
||||||
#else
|
#else
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'MCLK - I2S Master CLK');"));
|
||||||
#endif
|
#endif
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'I2C SDA');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'ES7243 I2C: SDA');"));
|
||||||
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'I2C SCL');"));
|
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'ES7243 I2C: SCL');"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -420,9 +420,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void initialize(int8_t sdaPin, int8_t sclPin, int8_t i2swsPin, int8_t i2ssdPin, int8_t i2sckPin, int8_t mclkPin) {
|
void initialize(int8_t sdaPin, int8_t sclPin, int8_t i2swsPin, int8_t i2ssdPin, int8_t i2sckPin, int8_t mclkPin) {
|
||||||
|
// check that pins are valid
|
||||||
|
if ((sdaPin < 0) || (sclPin < 0)) {
|
||||||
|
DEBUGSR_PRINTF("\nAR: invalid ES7243 I2C pins: SDA=%d, SCL=%d\n", sdaPin, sclPin);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Reserve SDA and SCL pins of the I2C interface
|
// Reserve SDA and SCL pins of the I2C interface
|
||||||
if (!pinManager.allocatePin(sdaPin, true, PinOwner::HW_I2C) ||
|
PinManagerPinType es7243Pins[2] = { { sdaPin, true }, { sclPin, true } };
|
||||||
!pinManager.allocatePin(sclPin, true, PinOwner::HW_I2C)) {
|
if (!pinManager.allocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C)) {
|
||||||
|
pinManager.deallocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C);
|
||||||
|
DEBUGSR_PRINTF("\nAR: Failed to allocate ES7243 I2C pins: SDA=%d, SCL=%d\n", sdaPin, sclPin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,8 +443,8 @@ public:
|
|||||||
|
|
||||||
void deinitialize() {
|
void deinitialize() {
|
||||||
// Release SDA and SCL pins of the I2C interface
|
// Release SDA and SCL pins of the I2C interface
|
||||||
pinManager.deallocatePin(pin_ES7243_SDA, PinOwner::HW_I2C);
|
PinManagerPinType es7243Pins[2] = { { pin_ES7243_SDA, true }, { pin_ES7243_SCL, true } };
|
||||||
pinManager.deallocatePin(pin_ES7243_SCL, PinOwner::HW_I2C);
|
pinManager.deallocateMultiplePins(es7243Pins, 2, PinOwner::HW_I2C);
|
||||||
I2SSource::deinitialize();
|
I2SSource::deinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2211181
|
#define VERSION 2211191
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
|||||||
Reference in New Issue
Block a user