add userled driver initialization

This commit is contained in:
ThomasNS 2023-06-27 11:08:40 +02:00 committed by Alan Carvalho de Assis
parent 7864bf4870
commit f51d6b8c72
6 changed files with 30 additions and 18 deletions

View File

@ -1150,5 +1150,4 @@ int up_putc(int ch)
#endif
}
#endif /* HAVE_UART_DEVICE && USE_SERIALDRIVER */

View File

@ -221,7 +221,7 @@ static bool spi_checkreg(struct xmc4_spidev_s *spi, bool wr,
uint32_t value, uint32_t address);
#else
# define spi_checkreg(spi, wr, value, address) (false)
# define spi_checkreg(spi, wr, value, address) (false)
#endif
static inline uint32_t spi_getreg(struct xmc4_spidev_s *spi,
@ -233,7 +233,7 @@ static inline struct xmc4_spidev_s *spi_device(struct xmc4_spics_s *spics);
#ifdef CONFIG_DEBUG_SPI_INFO
static void spi_dumpregs(struct xmc4_spidev_s *spi, const char *msg);
#else
# define spi_dumpregs(spi, msg)
# define spi_dumpregs(spi, msg)
#endif
static inline void spi_flush(struct xmc4_spidev_s *spi);

View File

@ -320,10 +320,9 @@
#define BOARD_SPI_DX USIC_DXC
#define GPIO_SPI4_MOSI (GPIO_U2C0_DOUT0_2 | GPIO_PADA2_STRONGMEDIUM)
#define GPIO_SPI4_MISO (GPIO_U1C0_DX0C)
#define GPIO_SPI4_MISO (GPIO_U2C0_DX0C)
#define GPIO_SPI4_SCLK (GPIO_U2C0_SCLKOUT_1 | GPIO_PADA2_STRONGMEDIUM)
/****************************************************************************
* Public Data
****************************************************************************/

View File

@ -50,8 +50,6 @@ void xmc4_board_initialize(void)
/* Configure on-board LEDs if LED support has been selected. */
board_autoled_initialize();
#else
board_userled_initialize();
#endif
#ifdef CONFIG_XMC4_USCI_SPI

View File

@ -26,9 +26,15 @@
#include <debug.h>
#include <errno.h>
#include <nuttx/spi/spi_transfer.h>
#include <sys/types.h>
#ifdef CONFIG_XMC4_USCI_SPI
# include <nuttx/spi/spi_transfer.h>
#endif
#ifdef CONFIG_USERLED
# include <nuttx/leds/userled.h>
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -50,15 +56,25 @@ int xmc4_bringup(void)
spi = xmc4_spibus_initialize(4);
if (!spi)
{
return -ENODEV;
}
{
return -ENODEV;
}
ret = spi_register(spi, 0);
if (ret < 0)
{
snerr("ERROR: Failed to register driver: %d\n", ret);
}
{
snerr("ERROR: Failed to register driver: %d\n", ret);
}
#endif
#ifdef CONFIG_USERLED
/* Register the LED driver */
ret = userled_lower_initialize("/dev/userleds");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
}
#endif
return ret;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* boards/arm/xmc4/xmc4500-relax/src/xmc4_spi.c
* boards/arm/xmc4/xmc4700-relax/src/xmc4_spi.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
* Name: xmc4_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the FRDM-KL25Z board.
* Called to configure SPI chip select GPIO pins.
*
****************************************************************************/
@ -186,7 +186,7 @@ void xmc4_spi4select(struct spi_dev_s *dev, uint32_t devid,
* devid - Identifies the (logical) device
*
* Returned Values:
* Bit-encoded SPI status (see include/nuttx/spi/spi.h.
* Bit-encoded SPI status (see include/nuttx/spi/spi.h).
*
****************************************************************************/
@ -238,7 +238,7 @@ uint8_t xmc4_spi4status(struct spi_dev_s *dev, uint32_t devid)
* cmd - Determines where command or data should be selected.
*
* Returned Values:
* Bit-encoded SPI status (see include/nuttx/spi/spi.h.
* Bit-encoded SPI status (see include/nuttx/spi/spi.h).
*
****************************************************************************/