mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Add support for SPI NOR chip select
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2938 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -45,20 +45,24 @@
|
|||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "lpc313x_ioconfig.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/* EA3131L GPIOs ********************************************************************/
|
/* EA3131L GPIOs ********************************************************************/
|
||||||
|
|
||||||
/* LEDs */
|
/* LEDs -- interface through an I2C GPIO expander */
|
||||||
|
|
||||||
/* BUTTONS -- NOTE that some have EXTI interrupts configured */
|
/* BUTTONS -- NOTE that some have EXTI interrupts configured */
|
||||||
|
|
||||||
/* SPI Chip Selects */
|
/* SPI Chip Selects */
|
||||||
|
/* SPI NOR flash is the only device on SPI. SPI_CS_OUT0 is its chip select */
|
||||||
|
|
||||||
/* USB Soft Connect Pullup*/
|
#define SPINOR_CS IOCONFIG_SPI_CSOUT0
|
||||||
|
|
||||||
|
/* USB Soft Connect Pullup -- NONE */
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ void weak_function lpc313x_spiinitialize(void)
|
|||||||
* architecture.
|
* architecture.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
gpio_outputhigh(LPC313X_IOCONFIG_SPI, SPINOR_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -130,6 +131,18 @@ void weak_function lpc313x_spiinitialize(void)
|
|||||||
void lpc313x_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
void lpc313x_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
{
|
{
|
||||||
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
|
if (devid == SPIDEV_FLASH)
|
||||||
|
{
|
||||||
|
if (selected)
|
||||||
|
{
|
||||||
|
gpio_outputlow(LPC313X_IOCONFIG_SPI, SPINOR_CS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gpio_outputhigh(LPC313X_IOCONFIG_SPI, SPINOR_CS);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t lpc313x_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
uint8_t lpc313x_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
|
|||||||
Reference in New Issue
Block a user