cpu stm32f1 periph spi: simplify condition
This commit is contained in:
parent
6f0d05e725
commit
aa3ef774d0
@ -41,7 +41,7 @@ static void set_system_clock(void)
|
|||||||
}
|
}
|
||||||
while ((HSE_status == 0) && (startup_counter != HSE_STARTUP_TIMEOUT));
|
while ((HSE_status == 0) && (startup_counter != HSE_STARTUP_TIMEOUT));
|
||||||
|
|
||||||
if ((RCC->CR & RCC_CR_HSERDY) != RESET) {
|
if (!(RCC->CR & RCC_CR_HSERDY)) {
|
||||||
HSE_status = (uint32_t)0x01;
|
HSE_status = (uint32_t)0x01;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -207,11 +207,11 @@ int spi_transfer_byte(spi_t dev, char out, char *in)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((spi->SR & SPI_SR_TXE) == RESET);
|
while (!(spi->SR & SPI_SR_TXE));
|
||||||
spi->DR = out;
|
spi->DR = out;
|
||||||
transferred++;
|
transferred++;
|
||||||
|
|
||||||
while ((spi->SR & SPI_SR_RXNE) == RESET);
|
while (!(spi->SR & SPI_SR_RXNE));
|
||||||
if (in != NULL) {
|
if (in != NULL) {
|
||||||
*in = spi->DR;
|
*in = spi->DR;
|
||||||
transferred++;
|
transferred++;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user