Skip to content

Commit b2e4d36

Browse files
committed
Merge branch 'master' of github.com:energia/Energia
2 parents 3b426f7 + 8372767 commit b2e4d36

File tree

1 file changed

+5
-0
lines changed
  • hardware/msp430/cores/msp430

1 file changed

+5
-0
lines changed

hardware/msp430/cores/msp430/twi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen
266266
#ifdef __MSP430_HAS_USCI__
267267
twi_state = TWI_MRX; // Master receive mode
268268
UCB0CTL1 |= UCTXSTT; // I2C start condition
269+
270+
if(length == 1) { // When only receiving 1 byte..
271+
while(UCB0CTL1 & UCTXSTT); // Wait for start bit to be sent
272+
UCB0CTL1 |= UCTXSTP; // Send I2C stop condition after recv
273+
}
269274
#endif
270275
#ifdef __MSP430_HAS_EUSCI_B0__
271276
twi_state = TWI_MRX; // Master receive mode

0 commit comments

Comments
 (0)