mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 04:53:34 +08:00
Remove CONFIG_ARCH_BOARD #ifdef dependencies from mtd
Since mtd already checks whether CONFIG_MTD_RAMTRON is set in defconfig use this define to check whether to call ramtron_attach() or at24xxx_attach() in the main function, instead of checking CONFIG_ARCH_BOARD_PX4FMU-V1. Also instead of using #ifdef CONFIG_ARCH_BOARD_AEROCORE to determine whether to start mtd on spi 2 or 4, rather use a new board define PX4_SPI_BUS_RAMTRON in the board_config.h file.
This commit is contained in:
committed by
Lorenz Meier
parent
199f6478ee
commit
48c467f602
@@ -176,12 +176,9 @@ struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd,
|
||||
static void
|
||||
ramtron_attach(void)
|
||||
{
|
||||
/* find the right spi */
|
||||
#ifdef CONFIG_ARCH_BOARD_AEROCORE
|
||||
struct spi_dev_s *spi = up_spiinitialize(4);
|
||||
#else
|
||||
struct spi_dev_s *spi = up_spiinitialize(2);
|
||||
#endif
|
||||
/* initialize the right spi */
|
||||
struct spi_dev_s *spi = up_spiinitialize(PX4_SPI_BUS_RAMTRON);
|
||||
|
||||
/* this resets the spi bus, set correct bus speed again */
|
||||
SPI_SETFREQUENCY(spi, 10 * 1000 * 1000);
|
||||
SPI_SETBITS(spi, 8);
|
||||
@@ -269,10 +266,10 @@ mtd_start(char *partition_names[], unsigned n_partitions)
|
||||
}
|
||||
|
||||
if (!attached) {
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||
at24xxx_attach();
|
||||
#else
|
||||
#ifdef CONFIG_MTD_RAMTRON
|
||||
ramtron_attach();
|
||||
#else
|
||||
at24xxx_attach();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user