Unify spi_master headers (#24857)

* Move default config to .c file

* Explicitly define PAL modes for boards with custom init

* Unify spi_master headers
This commit is contained in:
Ryan 2025-01-27 08:37:37 +11:00 committed by GitHub
parent 0747f887d6
commit ee63d39058
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 183 additions and 175 deletions

View file

@ -15,8 +15,49 @@
*/
#include "spi_master.h"
#include "chibios_config.h"
#include <ch.h>
#include <hal.h>
#include "timer.h"
#ifndef SPI_DRIVER
# define SPI_DRIVER SPID2
#endif
#ifndef SPI_SCK_PIN
# define SPI_SCK_PIN B13
#endif
#ifndef SPI_SCK_PAL_MODE
# ifdef USE_GPIOV1
# define SPI_SCK_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
# else
# define SPI_SCK_PAL_MODE 5
# endif
#endif
#ifndef SPI_MOSI_PIN
# define SPI_MOSI_PIN B15
#endif
#ifndef SPI_MOSI_PAL_MODE
# ifdef USE_GPIOV1
# define SPI_MOSI_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
# else
# define SPI_MOSI_PAL_MODE 5
# endif
#endif
#ifndef SPI_MISO_PIN
# define SPI_MISO_PIN B14
#endif
#ifndef SPI_MISO_PAL_MODE
# ifdef USE_GPIOV1
# define SPI_MISO_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
# else
# define SPI_MISO_PAL_MODE 5
# endif
#endif
static bool spiStarted = false;
#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE