mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-21 22:15:34 +08:00
fix the code sytle
This commit is contained in:
parent
6c7ae38938
commit
3e6b866956
@ -27,8 +27,8 @@ static struct mcu_drv_spi_config spi_config[] =
|
|||||||
#endif
|
#endif
|
||||||
#ifdef BSP_USING_SPI1
|
#ifdef BSP_USING_SPI1
|
||||||
MCU_SPI1_CONFIG,
|
MCU_SPI1_CONFIG,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mcu_drv_spi spi_bus_obj[sizeof(spi_config) / sizeof(spi_config[0])];
|
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_BUS "spi0"
|
||||||
#define SPI_DEVICE_NAME "spi01"
|
#define SPI_DEVICE_NAME "spi01"
|
||||||
|
|
||||||
#define TEST_LEN 10
|
#define TEST_LEN 10
|
||||||
uint8_t rx_data[TEST_LEN];
|
uint8_t rx_data[TEST_LEN];
|
||||||
uint8_t tx_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;
|
struct rt_spi_device *spi_dev;
|
||||||
char name[RT_NAME_MAX];
|
char name[RT_NAME_MAX];
|
||||||
|
|
||||||
rt_kprintf("\n************** SPI Loopback Demo ****************\n");
|
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("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");
|
rt_kprintf("MOSI (P0.5) pins. Connect these two pins together. \n");
|
||||||
|
@ -36,24 +36,20 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
|
|||||||
#endif
|
#endif
|
||||||
#ifdef BSP_USING_SPI1
|
#ifdef BSP_USING_SPI1
|
||||||
#ifdef BSP_USING_SPI1A //The SPI1A is conflit with UART1 TX RX P0.10 P0.11
|
#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", \
|
.bus_name = "spi1", \
|
||||||
.spi_instance = SPI1A \
|
.spi_instance = SPI1A \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define MCU_SPI1_CONFIG \
|
#define MCU_SPI1_CONFIG \
|
||||||
{ \
|
{ \
|
||||||
.bus_name = "spi1", \
|
.bus_name = "spi1", \
|
||||||
.spi_instance = SPI1B \
|
.spi_instance = SPI1B \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//TODO LIST SPI1A SPI1B
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mcu_drv_spi_config
|
struct mcu_drv_spi_config
|
||||||
{
|
{
|
||||||
char *bus_name;
|
char *bus_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user