Fixed bug #372.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5672 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
397bc099cd
commit
2a2598ff1b
|
@ -475,10 +475,26 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
|
||||||
*/
|
*/
|
||||||
uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
|
uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
|
||||||
|
|
||||||
spip->spi->DR = frame;
|
/*
|
||||||
while ((spip->spi->SR & SPI_SR_RXNE) == 0)
|
* Data register must be accessed with the appropriate data size.
|
||||||
;
|
* Byte size access (uint8_t *) for transactions that are <= 8-bit.
|
||||||
return spip->spi->DR;
|
* Halfword size access (uint16_t) for transactions that are <= 8-bit.
|
||||||
|
*/
|
||||||
|
if ((spip->config->cr2 & SPI_CR2_DS) <= (SPI_CR2_DS_2 |
|
||||||
|
SPI_CR2_DS_1 |
|
||||||
|
SPI_CR2_DS_0)) {
|
||||||
|
volatile uint8_t *spidr = (volatile uint8_t *)&spip->spi->DR;
|
||||||
|
*spidr = (uint8_t)frame;
|
||||||
|
while ((spip->spi->SR & SPI_SR_RXNE) == 0)
|
||||||
|
;
|
||||||
|
return (uint16_t)*spidr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
spip->spi->DR = frame;
|
||||||
|
while ((spip->spi->SR & SPI_SR_RXNE) == 0)
|
||||||
|
;
|
||||||
|
return spip->spi->DR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAL_USE_SPI */
|
#endif /* HAL_USE_SPI */
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** 2.5.2 ***
|
*** 2.5.2 ***
|
||||||
|
- FIX: Fixed STM32 SPIv2 polled exchange (bug #372).
|
||||||
- FIX: Fixed wrong macro in PWM driver (bug #407)(backported to 2.4.4).
|
- FIX: Fixed wrong macro in PWM driver (bug #407)(backported to 2.4.4).
|
||||||
- FIX: Fixed USB driver possible deadlock under certain configurations (bug
|
- FIX: Fixed USB driver possible deadlock under certain configurations (bug
|
||||||
#406)(backported to 2.4.4).
|
#406)(backported to 2.4.4).
|
||||||
|
|
Loading…
Reference in New Issue