Fix erroneous boolean expression conversions

In fb90157c9a, asserts were introduced
changing the error checking style in large portions of the code base
from `if(error_condition) fail();` to `assert(!error_condition);`. In
doing so, not all boolean conditions were negated properly. This commit
restores the original semantics of the error checks as they were before
fb90157, (unless an error check has been changed upstream, in which
case it is ignored).

The practical effects of this commit is that it should restore proper
I2C and SPI functionality on the LPC15XX and nRF51822, respectively.
pull/401/head
Sigve Sebastian Farstad 2014-07-15 15:24:30 +02:00
parent 86234528c2
commit ae4d94584b
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
obj->spi = (NRF_SPI_Type*)NC;
obj->spis = (NRF_SPIS_Type*)spi;
}
MBED_ASSERT((int)obj->spi != NC && (int)obj->spis != NC);
MBED_ASSERT((int)obj->spi != NC || (int)obj->spis != NC);
// pin out the spi pins
if (ssel != NC) {//slave

View File

@ -41,7 +41,7 @@ static inline void i2c_interface_enable(i2c_t *obj) {
}
void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
MBED_ASSERT((sda == P0_23) || (scl == P0_22));
MBED_ASSERT((sda == P0_23) && (scl == P0_22));
// Enables clock for I2C0
LPC_SYSCON->SYSAHBCLKCTRL1 |= (1 << 13);