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

2.0.x
Kajetan Rzepecki 6 years ago committed by Scott Lahteine
parent e6f6ed76c8
commit d83a7924e6

@ -37,7 +37,7 @@
#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT) #define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)
// Read a pin wrapper // 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 // Write to a pin wrapper
#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v)) #define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))

@ -315,6 +315,10 @@ void i2s_write(uint8_t pin, uint8_t val) {
SET_BIT_TO(i2s_port_data, pin, 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() { void i2s_push_sample() {
dma.current[dma.rw_pos++] = i2s_port_data; dma.current[dma.rw_pos++] = i2s_port_data;
} }

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

Loading…
Cancel
Save