Merge pull request #315 from hanya/rpi2cirq
[RP2040] i2c: Reduce intterupt frequency
This commit is contained in:
commit
ff1c6ec90c
|
@ -118,10 +118,12 @@ static void serve_interrupt(I2CDriver *i2cp) {
|
||||||
/* Transmission phase. */
|
/* Transmission phase. */
|
||||||
if (dp->INTRSTAT & I2C_IC_INTR_STAT_R_TX_EMPTY_Msk) {
|
if (dp->INTRSTAT & I2C_IC_INTR_STAT_R_TX_EMPTY_Msk) {
|
||||||
if (i2cp->txbytes) {
|
if (i2cp->txbytes) {
|
||||||
|
while (i2cp->txbytes && (dp->TXFLR & I2C_IC_TXFLR_TXFLR_Msk) < 16) {
|
||||||
dp->DATACMD = (uint32_t)i2cp->txbuf[i2cp->txindex] |
|
dp->DATACMD = (uint32_t)i2cp->txbuf[i2cp->txindex] |
|
||||||
(i2cp->txbytes == 1 ? I2C_IC_DATA_CMD_STOP : 0);
|
(i2cp->txbytes == 1 ? I2C_IC_DATA_CMD_STOP : 0);
|
||||||
i2cp->txindex++;
|
i2cp->txindex++;
|
||||||
i2cp->txbytes--;
|
i2cp->txbytes--;
|
||||||
|
}
|
||||||
|
|
||||||
if (i2cp->txbytes == 0U) {
|
if (i2cp->txbytes == 0U) {
|
||||||
// Disable TX_EMPTY irq
|
// Disable TX_EMPTY irq
|
||||||
|
|
Loading…
Reference in New Issue