forked from Makuna/NeoPixelBus
i2s improvements (#654)
This commit is contained in:
@@ -340,6 +340,42 @@ void i2sSetPins(uint8_t bus_num,
|
||||
}
|
||||
}
|
||||
|
||||
void i2sSetClkWsPins(uint8_t bus_num,
|
||||
int8_t outClk,
|
||||
bool invertClk,
|
||||
int8_t outWs,
|
||||
bool invertWs)
|
||||
{
|
||||
|
||||
if (bus_num >= I2S_NUM_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t i2sSignalClk = I2S0O_BCK_OUT_IDX;
|
||||
uint32_t i2sSignalWs = I2S0O_WS_OUT_IDX;
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
if (bus_num == 1)
|
||||
{
|
||||
i2sSignalClk = I2S1O_BCK_OUT_IDX;
|
||||
i2sSignalWs = I2S1O_WS_OUT_IDX;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (outClk >= 0)
|
||||
{
|
||||
pinMode(outClk, OUTPUT);
|
||||
gpio_matrix_out(outClk, i2sSignalClk, invertClk, false);
|
||||
}
|
||||
|
||||
if (outWs >= 0)
|
||||
{
|
||||
pinMode(outWs, OUTPUT);
|
||||
gpio_matrix_out(outWs, i2sSignalWs, invertWs, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool i2sWriteDone(uint8_t bus_num)
|
||||
{
|
||||
if (bus_num >= I2S_NUM_MAX)
|
||||
|
@@ -34,6 +34,11 @@ void i2sSetPins(uint8_t bus_num,
|
||||
int8_t parallel,
|
||||
int8_t busSampleSize,
|
||||
bool invert);
|
||||
void i2sSetClkWsPins(uint8_t bus_num,
|
||||
int8_t outClk,
|
||||
bool invertClk,
|
||||
int8_t outWs,
|
||||
bool invertWs);
|
||||
bool i2sWrite(uint8_t bus_num);
|
||||
bool i2sWriteDone(uint8_t bus_num);
|
||||
|
||||
|
@@ -72,8 +72,8 @@ public:
|
||||
class NeoEsp8266DmaSpeed800KbpsBase : public NeoEsp8266DmaSpeedBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sClockDivisor = 3; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 16; // 0-63
|
||||
const static uint32_t I2sClockDivisor = 5; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 10; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 10; // us it takes to send a single pixel element at 800khz speed
|
||||
};
|
||||
|
||||
@@ -110,8 +110,8 @@ public:
|
||||
class NeoEsp8266DmaSpeed400Kbps : public NeoEsp8266DmaSpeedBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sClockDivisor = 6; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 16; // 0-63
|
||||
const static uint32_t I2sClockDivisor = 10; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 10; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 20; // us it takes to send a single pixel element at 400khz speed
|
||||
const static uint32_t ResetTimeUs = 50;
|
||||
};
|
||||
@@ -120,8 +120,8 @@ class NeoEsp8266DmaSpeedApa106 : public NeoEsp8266DmaSpeedBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sClockDivisor = 4; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 16; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 17; // us it takes to send a single pixel element
|
||||
const static uint32_t I2sBaseClockDivisor = 17; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 14; // us it takes to send a single pixel element
|
||||
const static uint32_t ResetTimeUs = 50;
|
||||
};
|
||||
|
||||
@@ -130,8 +130,8 @@ public:
|
||||
class NeoEsp8266DmaInvertedSpeed800KbpsBase : public NeoEsp8266DmaInvertedSpeedBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sClockDivisor = 3; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 16; // 0-63
|
||||
const static uint32_t I2sClockDivisor = 5; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 10; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 10; // us it takes to send a single pixel element at 800khz speed
|
||||
};
|
||||
|
||||
@@ -168,8 +168,8 @@ public:
|
||||
class NeoEsp8266DmaInvertedSpeed400Kbps : public NeoEsp8266DmaInvertedSpeedBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sClockDivisor = 6; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 16; // 0-63
|
||||
const static uint32_t I2sClockDivisor = 10; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 10; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 20; // us it takes to send a single pixel element at 400khz speed
|
||||
const static uint32_t ResetTimeUs = 50;
|
||||
};
|
||||
@@ -178,8 +178,8 @@ class NeoEsp8266DmaInvertedSpeedApa106 : public NeoEsp8266DmaInvertedSpeedBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sClockDivisor = 4; // 0-63
|
||||
const static uint32_t I2sBaseClockDivisor = 16; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 17; // us it takes to send a single pixel element
|
||||
const static uint32_t I2sBaseClockDivisor = 17; // 0-63
|
||||
const static uint32_t ByteSendTimeUs = 14; // us it takes to send a single pixel element
|
||||
const static uint32_t ResetTimeUs = 50;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user