fix the code sytle

This commit is contained in:
supperthomas 2021-02-15 13:59:08 +08:00
parent 6c7ae38938
commit 3e6b866956
2 changed files with 8 additions and 12 deletions

View File

@ -27,8 +27,8 @@ static struct mcu_drv_spi_config spi_config[] =
#endif
#ifdef BSP_USING_SPI1
MCU_SPI1_CONFIG,
#endif
#endif
};
static struct mcu_drv_spi spi_bus_obj[sizeof(spi_config) / sizeof(spi_config[0])];
@ -169,7 +169,7 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
#define SPI_DEVICE_BUS "spi0"
#define SPI_DEVICE_NAME "spi01"
#define TEST_LEN 10
#define TEST_LEN 10
uint8_t rx_data[TEST_LEN];
uint8_t tx_data[TEST_LEN];
@ -177,7 +177,7 @@ static void spi_sample(int argc, char *argv[])
{
struct rt_spi_device *spi_dev;
char name[RT_NAME_MAX];
rt_kprintf("\n************** SPI Loopback Demo ****************\n");
rt_kprintf("This example configures the SPI to send data between the MISO (P0.4) and\n");
rt_kprintf("MOSI (P0.5) pins. Connect these two pins together. \n");

View File

@ -36,24 +36,20 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
#endif
#ifdef BSP_USING_SPI1
#ifdef BSP_USING_SPI1A //The SPI1A is conflit with UART1 TX RX P0.10 P0.11
#define MCU_SPI1_CONFIG \
#define MCU_SPI1_CONFIG \
{ \
.bus_name = "spi1", \
.spi_instance = SPI1A \
.spi_instance = SPI1A \
}
#else
#define MCU_SPI1_CONFIG \
#define MCU_SPI1_CONFIG \
{ \
.bus_name = "spi1", \
.spi_instance = SPI1B \
.spi_instance = SPI1B \
}
#endif
//TODO LIST SPI1A SPI1B
#endif
struct mcu_drv_spi_config
{
char *bus_name;