pabigot / bsp430

Board Support Package for MSP430 microcontrollers
http://pabigot.github.com/bsp430
BSD 3-Clause "New" or "Revised" License
38 stars 11 forks source link

fix flush issue with I2C #59

Closed pabigot closed 11 years ago

pabigot commented 11 years ago

Like UART the current I2C mechanism returns control to the caller while the peripheral completes a transfer (for UART the actual TX; for I2C both the TX and the STP). For UART this isn't a concern as vBSP430serialFlush_ni() can be called to wait for completion; for I2C the flush mechanism does not check for pending STP, and in the case of bus errors the STP would not be transmitted.

Refactor the provided I2C single-master protocol to hold up the return until the STP has been transmitted.