mirror of https://github.com/ARMmbed/mbed-os.git
Fix erroneous boolean expression conversions
Inpull/401/headfb90157c9a, 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 beforefb90157, (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.
parent
86234528c2
commit
ae4d94584b
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue