Merge pull request #315 from hanya/rpi2cirq

[RP2040] i2c: Reduce intterupt frequency
This commit is contained in:
Fabien Poussin 2022-02-16 17:01:17 +01:00 committed by GitHub
commit ff1c6ec90c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -118,10 +118,12 @@ static void serve_interrupt(I2CDriver *i2cp) {
/* Transmission phase. */
if (dp->INTRSTAT & I2C_IC_INTR_STAT_R_TX_EMPTY_Msk) {
if (i2cp->txbytes) {
dp->DATACMD = (uint32_t)i2cp->txbuf[i2cp->txindex] |
(i2cp->txbytes == 1 ? I2C_IC_DATA_CMD_STOP : 0);
i2cp->txindex++;
i2cp->txbytes--;
while (i2cp->txbytes && (dp->TXFLR & I2C_IC_TXFLR_TXFLR_Msk) < 16) {
dp->DATACMD = (uint32_t)i2cp->txbuf[i2cp->txindex] |
(i2cp->txbytes == 1 ? I2C_IC_DATA_CMD_STOP : 0);
i2cp->txindex++;
i2cp->txbytes--;
}
if (i2cp->txbytes == 0U) {
// Disable TX_EMPTY irq