Browse Source

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

pull/1/head
Kajetan Rzepecki 6 years ago
committed by Scott Lahteine
parent
commit
d83a7924e6
  1. 2
      Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h
  2. 4
      Marlin/src/HAL/HAL_ESP32/i2s.cpp
  3. 2
      Marlin/src/HAL/HAL_ESP32/i2s.h

2
Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h

@ -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))

4
Marlin/src/HAL/HAL_ESP32/i2s.cpp

@ -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;
}

2
Marlin/src/HAL/HAL_ESP32/i2s.h

@ -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();

Loading…
Cancel
Save