diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-10-19 11:19:40 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-10-19 11:19:40 +0200 |
commit | 5949cef9e1f15fadca93864ddeb0fcb555b3b443 (patch) | |
tree | 0afebf5e6b7ad55419e57a0559f1670a5fc2b4d3 /src/arch/msp430fr5969lp | |
parent | 9eb1066824bd8141914334c9b13e2d4f876e9138 (diff) |
MSP430 I2C: Enable interrupts for RX mode
Diffstat (limited to 'src/arch/msp430fr5969lp')
-rw-r--r-- | src/arch/msp430fr5969lp/driver/i2c.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/arch/msp430fr5969lp/driver/i2c.cc b/src/arch/msp430fr5969lp/driver/i2c.cc index 0e0c376..5a47770 100644 --- a/src/arch/msp430fr5969lp/driver/i2c.cc +++ b/src/arch/msp430fr5969lp/driver/i2c.cc @@ -92,7 +92,13 @@ signed char I2C::xmit(unsigned char address, for (i = 0; i < rx_len; i++) { if (i == rx_len - 1) UCB0CTL1 |= UCTXSTP; - while (!(UCB0IFG & (UCRXIFG0 | UCNACKIFG | UCCLTOIFG))); + UCB0IFG = 0; + old_ifg = 0; + UCB0IE = UCRXIE | UCNACKIE | UCCLTOIE; + while (!(old_ifg & (UCRXIFG0 | UCNACKIFG | UCCLTOIFG))) { + arch.idle(); + } + UCB0IE = 0; rx_buf[i] = UCB0RXBUF; UCB0IFG &= ~UCRXIFG0; } |