|
@@ -55,22 +55,22 @@ void MAX7219_Config(void) {
|
|
|
void MAX7219_WriteData(max7219_reg_t reg, uint8_t data)
|
|
|
{
|
|
|
/*!< Wait wait until the completion of the transfer. */
|
|
|
- while (SPI_GetFlagStatus(SPI_FLAG_BSY) == SET) {}
|
|
|
+ while ((SPI->SR & 0x80) != RESET);
|
|
|
/* Down LOAD pin */
|
|
|
SPI_LOAD_PORT->ODR &= (uint8_t)(~SPI_LOAD);
|
|
|
|
|
|
/*!< Wait until the transmit buffer is empty */
|
|
|
- while (SPI_GetFlagStatus(SPI_FLAG_TXE) == RESET) {}
|
|
|
+ while ((SPI->SR & 0x02) == RESET);
|
|
|
/* Send the register where the data will be stored */
|
|
|
SPI->DR = reg; /* Write in the DR register the data to be sent*/
|
|
|
|
|
|
/*!< Wait until the transmit buffer is empty */
|
|
|
- while (SPI_GetFlagStatus(SPI_FLAG_TXE) == RESET) {}
|
|
|
+ while ((SPI->SR & 0x02) != RESET);
|
|
|
/* Send the data to be stored */
|
|
|
SPI->DR = data; /* Write in the DR register the data to be sent*/
|
|
|
|
|
|
/*!< Wait wait until the completion of the transfer. */
|
|
|
- while (SPI_GetFlagStatus(SPI_FLAG_BSY) == SET) {}
|
|
|
+ while ((SPI->SR & 0x80) != RESET);
|
|
|
/* Up LOAD pin */
|
|
|
SPI_LOAD_PORT->ODR |= SPI_LOAD;
|
|
|
}
|