diff options
| author | Ha Thach <[email protected]> | 2024-08-11 10:19:52 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-11 10:19:52 +0700 |
| commit | 9ee7d1b77e365079eab5bb641eea522a8deb551e (patch) | |
| tree | d960b83d4fb6164430be3f6068f8f1829ebb8fcd /hw | |
| parent | 18b5affce9afb26141c58f59ed89ad34385a0f8f (diff) | |
| parent | 8b88749223e969148e9d1ce4c8fd3a6756d5e38c (diff) | |
Merge pull request #2760 from hathach/update-pio-usb
change pio to fix rp2040 build
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/bsp/rp2040/board.h | 7 | ||||
| -rw-r--r-- | hw/bsp/rp2040/family.c | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/hw/bsp/rp2040/board.h b/hw/bsp/rp2040/board.h index 3849894ce..733e93797 100644 --- a/hw/bsp/rp2040/board.h +++ b/hw/bsp/rp2040/board.h @@ -78,7 +78,12 @@ // USB Host MAX3421E //-------------------------------------------------------------------- -#define MAX3421_SPI PICO_DEFAULT_SPI_INSTANCE +#ifdef PICO_DEFAULT_SPI +#define MAX3421_SPI PICO_DEFAULT_SPI // sdk v2 +#else +#define MAX3421_SPI PICO_DEFAULT_SPI_INSTANCE // sdk v1 +#endif + #define MAX3421_SCK_PIN PICO_DEFAULT_SPI_SCK_PIN #define MAX3421_MOSI_PIN PICO_DEFAULT_SPI_TX_PIN #define MAX3421_MISO_PIN PICO_DEFAULT_SPI_RX_PIN diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index 9360f7f57..250989ce9 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -275,7 +275,15 @@ static void max3421_init(void) { gpio_set_function(MAX3421_SCK_PIN, GPIO_FUNC_SPI); gpio_set_function(MAX3421_MOSI_PIN, GPIO_FUNC_SPI); gpio_set_function(MAX3421_MISO_PIN, GPIO_FUNC_SPI); + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif spi_set_format(MAX3421_SPI, 8, SPI_CPOL_0, SPI_CPHA_0, SPI_MSB_FIRST); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif } //// API to enable/disable MAX3421 INTR pin interrupt |
