mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-30 17:49:56 +02:00
Fixed I2S_STATIC stepping
This commit is contained in:
@@ -168,7 +168,8 @@ static inline void gpio_matrix_out_check(uint8_t gpio, uint32_t signal_idx, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void i2s_out_single_data() {
|
void i2s_out_push() {
|
||||||
|
if (i2s_out_pulser_status == PASSTHROUGH) {
|
||||||
#if I2S_OUT_NUM_BITS == 16
|
#if I2S_OUT_NUM_BITS == 16
|
||||||
uint32_t port_data = atomic_load(&i2s_out_port_data);
|
uint32_t port_data = atomic_load(&i2s_out_port_data);
|
||||||
port_data <<= 16; // Shift needed. This specification is not spelled out in the manual.
|
port_data <<= 16; // Shift needed. This specification is not spelled out in the manual.
|
||||||
@@ -177,6 +178,7 @@ static inline void i2s_out_single_data() {
|
|||||||
I2S0.conf_single_data = atomic_load(&i2s_out_port_data); // Apply port data in real-time (static I2S)
|
I2S0.conf_single_data = atomic_load(&i2s_out_port_data); // Apply port data in real-time (static I2S)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void i2s_out_reset_fifo_without_lock() {
|
static inline void i2s_out_reset_fifo_without_lock() {
|
||||||
I2S0.conf.rx_fifo_reset = 1;
|
I2S0.conf.rx_fifo_reset = 1;
|
||||||
@@ -561,15 +563,6 @@ void IRAM_ATTR i2s_out_write(uint8_t pin, uint8_t val) {
|
|||||||
} else {
|
} else {
|
||||||
atomic_fetch_and(&i2s_out_port_data, ~bit);
|
atomic_fetch_and(&i2s_out_port_data, ~bit);
|
||||||
}
|
}
|
||||||
#ifdef USE_I2S_OUT_STREAM_IMPL
|
|
||||||
// It needs a lock for access, but I've given up because I need speed.
|
|
||||||
// This is not a problem as long as there is no overlap between the status change and digitalWrite().
|
|
||||||
if (i2s_out_pulser_status == PASSTHROUGH) {
|
|
||||||
i2s_out_single_data();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
i2s_out_single_data();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t IRAM_ATTR i2s_out_read(uint8_t pin) {
|
uint8_t IRAM_ATTR i2s_out_read(uint8_t pin) {
|
||||||
|
@@ -110,6 +110,8 @@ int i2s_out_init();
|
|||||||
*/
|
*/
|
||||||
uint8_t i2s_out_read(uint8_t pin);
|
uint8_t i2s_out_read(uint8_t pin);
|
||||||
|
|
||||||
|
void i2s_out_push();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set a bit in the internal pin state var. (not written electrically)
|
Set a bit in the internal pin state var. (not written electrically)
|
||||||
pin: expanded pin No. (0..31)
|
pin: expanded pin No. (0..31)
|
||||||
|
@@ -160,6 +160,7 @@ namespace Machine {
|
|||||||
a->unstep();
|
a->unstep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
config->_stepping->finishPulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some small helpers to find the axis index and axis ganged index for a given motor. This
|
// Some small helpers to find the axis index and axis ganged index for a given motor. This
|
||||||
|
@@ -60,6 +60,7 @@ namespace Pins {
|
|||||||
// Write and wait for completion. Not suitable for use from an ISR
|
// Write and wait for completion. Not suitable for use from an ISR
|
||||||
void I2SOPinDetail::synchronousWrite(int high) {
|
void I2SOPinDetail::synchronousWrite(int high) {
|
||||||
write(high);
|
write(high);
|
||||||
|
i2s_out_push();
|
||||||
i2s_out_delay();
|
i2s_out_delay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,6 +91,7 @@ namespace Machine {
|
|||||||
i2s_out_push_sample(_pulseUsecs);
|
i2s_out_push_sample(_pulseUsecs);
|
||||||
break;
|
break;
|
||||||
case I2S_STATIC:
|
case I2S_STATIC:
|
||||||
|
i2s_out_push();
|
||||||
case TIMED:
|
case TIMED:
|
||||||
spinDelay(_stepPulseStartTime, _pulseUsecs);
|
spinDelay(_stepPulseStartTime, _pulseUsecs);
|
||||||
break;
|
break;
|
||||||
@@ -135,6 +136,20 @@ namespace Machine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Stepping::finishPulse() {
|
||||||
|
switch (_engine) {
|
||||||
|
case stepper_id_t::I2S_STREAM:
|
||||||
|
break;
|
||||||
|
case stepper_id_t::I2S_STATIC:
|
||||||
|
i2s_out_push();
|
||||||
|
break;
|
||||||
|
case stepper_id_t::TIMED:
|
||||||
|
break;
|
||||||
|
case stepper_id_t::RMT:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The argument is in units of ticks of the timer that generates ISRs
|
// The argument is in units of ticks of the timer that generates ISRs
|
||||||
void IRAM_ATTR Stepping::setTimerPeriod(uint16_t timerTicks) {
|
void IRAM_ATTR Stepping::setTimerPeriod(uint16_t timerTicks) {
|
||||||
if (_engine == I2S_STREAM) {
|
if (_engine == I2S_STREAM) {
|
||||||
|
@@ -74,6 +74,7 @@ namespace Machine {
|
|||||||
void waitPulse(); // Wait for pulse length
|
void waitPulse(); // Wait for pulse length
|
||||||
void waitDirection(); // Wait for direction delay
|
void waitDirection(); // Wait for direction delay
|
||||||
void waitMotion(); // Wait for motion to complete
|
void waitMotion(); // Wait for motion to complete
|
||||||
|
void finishPulse(); // Cleanup after unstep
|
||||||
|
|
||||||
// Timers
|
// Timers
|
||||||
void setTimerPeriod(uint16_t timerTicks);
|
void setTimerPeriod(uint16_t timerTicks);
|
||||||
|
Reference in New Issue
Block a user