SPI setup will not yield the exact selected speed.
This commit is contained in:
@@ -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_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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user