mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-16 22:19:14 +01:00
Update I2CManager_STM32.h
Fix some merge errors.
This commit is contained in:
parent
ad4cedfccf
commit
1cfe5a1e46
@ -230,7 +230,7 @@ void I2CManagerClass::I2C_sendStart() {
|
|||||||
s->CR1 |= I2C_CR1_START; // Generate START
|
s->CR1 |= I2C_CR1_START; // Generate START
|
||||||
// Send address with write flag (0) or'd in
|
// Send address with write flag (0) or'd in
|
||||||
s->DR = (deviceAddress << 1) | 0; // send the address
|
s->DR = (deviceAddress << 1) | 0; // send the address
|
||||||
while (!(s->SR1 && (1<<I2C_SR1_ADDR))); // wait for ADDR bit to set
|
while (!(s->SR1 && I2C_SR1_ADDR)); // wait for ADDR bit to set
|
||||||
temp = s->SR1 | s->SR2; // read SR1 and SR2 to clear the ADDR bit
|
temp = s->SR1 | s->SR2; // read SR1 and SR2 to clear the ADDR bit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ void I2CManagerClass::I2C_handleInterrupt() {
|
|||||||
// Bus error
|
// Bus error
|
||||||
completionStatus = I2C_STATUS_BUS_ERROR;
|
completionStatus = I2C_STATUS_BUS_ERROR;
|
||||||
state = I2C_STATE_COMPLETED;
|
state = I2C_STATE_COMPLETED;
|
||||||
} else if (s->SR1 && (1<<I2C_SR1_TXE)) {
|
} else if (s->SR1 && I2C_SR1_TXE) {
|
||||||
// Master write completed
|
// Master write completed
|
||||||
if (s->SR1 && (1<<10)) {
|
if (s->SR1 && (1<<10)) {
|
||||||
// Nacked, send stop.
|
// Nacked, send stop.
|
||||||
|
Loading…
Reference in New Issue
Block a user