Fix ESP32 TOGGLE() with I2S expander (#13743)

This commit is contained in:
Kajetan Rzepecki 2019-04-18 20:15:35 +02:00 committed by Scott Lahteine
parent e6f6ed76c8
commit d83a7924e6
3 changed files with 7 additions and 1 deletions

View File

@ -37,7 +37,7 @@
#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)
// Read a pin wrapper
#define READ(IO) digitalRead(IO)
#define READ(IO) (TEST(IO, 7) ? i2s_state(IO & 0x7F) : digitalRead(IO))
// Write to a pin wrapper
#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))

View File

@ -315,6 +315,10 @@ void i2s_write(uint8_t pin, uint8_t val) {
SET_BIT_TO(i2s_port_data, pin, val);
}
uint8_t i2s_state(uint8_t pin) {
return TEST(i2s_port_data, pin);
}
void i2s_push_sample() {
dma.current[dma.rw_pos++] = i2s_port_data;
}

View File

@ -26,6 +26,8 @@ extern uint32_t i2s_port_data;
int i2s_init();
uint8_t i2s_state(uint8_t pin);
void i2s_write(uint8_t pin, uint8_t val);
void i2s_push_sample();