SPI setup will not yield the exact selected speed.

This commit is contained in:
2024-05-09 15:56:57 +02:00
parent e4b0c9ee6f
commit dbb566a2ae

View File

@@ -166,8 +166,12 @@ uint8_t mfrc522_interface_spi_init(void)
gpio_set_function(MFRC522_CFG_SPI_CLK_GPIO, GPIO_FUNC_SPI); gpio_set_function(MFRC522_CFG_SPI_CLK_GPIO, GPIO_FUNC_SPI);
gpio_set_function(MFRC522_CFG_SPI_SS_GPIO, GPIO_FUNC_SPI); gpio_set_function(MFRC522_CFG_SPI_SS_GPIO, GPIO_FUNC_SPI);
uint baudrate = MFRC522_CFG_SPI_SPEED_MHZ; /*
return (baudrate == spi_init(spi0, baudrate)) ? 0 : 1; * From the manual:
* "There is no guarantee that the baudrate requested can be achieved exactly;
* the nearest will be chosen and returned"
*/
return !spi_init(spi0, MFRC522_CFG_SPI_SPEED_MHZ);
} }
/** /**