mirror of
https://github.com/apache/nuttx.git
synced 2026-09-28 03:09:13 +08:00
Remove CONFIG_SPI_OWNBUS: Now it is not just a good idea, it is the law
This commit is contained in:
+6
-69
@@ -150,14 +150,8 @@ struct memlcd_dev_s
|
||||
|
||||
/* Low-level spi helpers */
|
||||
|
||||
static inline void memlcd_configspi(FAR struct spi_dev_s *spi);
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void memlcd_select(FAR struct spi_dev_s *spi);
|
||||
static inline void memlcd_deselect(FAR struct spi_dev_s *spi);
|
||||
#else
|
||||
static void memlcd_select(FAR struct spi_dev_s *spi);
|
||||
static void memlcd_deselect(FAR struct spi_dev_s *spi);
|
||||
#endif
|
||||
|
||||
/* lcd data transfer methods */
|
||||
|
||||
@@ -266,48 +260,6 @@ static inline int __test_bit(int nr, const volatile uint8_t * addr)
|
||||
return 1 & (addr[BIT_BYTE(nr)] >> (nr & (BITS_PER_BYTE - 1)));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memlcd_configspi
|
||||
*
|
||||
* Description:
|
||||
* Configure the SPI for use with the Sharp Memory LCD
|
||||
*
|
||||
* Input Parameters:
|
||||
* spi - Reference to the SPI driver structure
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void memlcd_configspi(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
#ifdef CONFIG_MEMLCD_SPI_FREQUENCY
|
||||
lcddbg("Mode: %d Bits: %d Frequency: %d\n",
|
||||
MEMLCD_SPI_MODE, MEMLCD_SPI_BITS, CONFIG_MEMLCD_SPI_FREQUENCY);
|
||||
#else
|
||||
lcddbg("Mode: %d Bits: %d Frequency: %d\n",
|
||||
MEMLCD_SPI_MODE, MEMLCD_SPI_BITS, MEMLCD_SPI_FREQUENCY);
|
||||
#endif
|
||||
|
||||
/* Configure SPI for the Memory LCD. But only if we own the SPI bus.
|
||||
* Otherwise, don't bother because it might change.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
SPI_SETMODE(spi, MEMLCD_SPI_MODE);
|
||||
SPI_SETBITS(spi, MEMLCD_SPI_BITS);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
# ifdef CONFIG_MEMLCD_SPI_FREQUENCY
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_MEMLCD_SPI_FREQUENCY);
|
||||
# else
|
||||
(void)SPI_SETFREQUENCY(spi, MEMLCD_SPI_FREQUENCY);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memlcd_select
|
||||
*
|
||||
@@ -324,25 +276,19 @@ static inline void memlcd_configspi(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void memlcd_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* we own the spi bus, so just select the chip */
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
}
|
||||
|
||||
#else
|
||||
static void memlcd_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* Select memlcd (locking the SPI bus in case there are multiple
|
||||
* devices competing for the SPI bus
|
||||
*/
|
||||
|
||||
SPI_LOCK(spi, true);
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
|
||||
/* Now make sure that the SPI bus is configured for the memlcd (it
|
||||
* might have gotten configured for a different device while unlocked)
|
||||
*/
|
||||
|
||||
SPI_SETMODE(spi, MEMLCD_SPI_MODE);
|
||||
SPI_SETBITS(spi, MEMLCD_SPI_BITS);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
@@ -352,7 +298,6 @@ static void memlcd_select(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_SETFREQUENCY(spi, MEMLCD_SPI_FREQUENCY);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memlcd_deselect
|
||||
@@ -370,20 +315,13 @@ static void memlcd_select(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void memlcd_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* we own the spi bus, so just de-select the chip */
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
}
|
||||
#else
|
||||
static void memlcd_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* de-select memlcd and relinquish the spi bus. */
|
||||
/* De-select memlcd and relinquish the spi bus. */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
SPI_LOCK(spi, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memlcd_clear
|
||||
@@ -765,11 +703,10 @@ FAR struct lcd_dev_s *memlcd_initialize(FAR struct spi_dev_s *spi,
|
||||
|
||||
DEBUGASSERT(spi && priv && devno == 0);
|
||||
|
||||
/* register board specific functions */
|
||||
mlcd->priv = priv;
|
||||
/* Register board specific functions */
|
||||
|
||||
mlcd->priv = priv;
|
||||
mlcd->spi = spi;
|
||||
memlcd_configspi(spi);
|
||||
|
||||
mlcd->priv->attachirq(memlcd_extcominisr);
|
||||
|
||||
|
||||
+2
-61
@@ -338,14 +338,8 @@ struct nokia_dev_s
|
||||
|
||||
/* SPI support */
|
||||
|
||||
static inline void nokia_configspi(FAR struct spi_dev_s *spi);
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void nokia_select(FAR struct spi_dev_s *spi);
|
||||
static inline void nokia_deselect(FAR struct spi_dev_s *spi);
|
||||
#else
|
||||
static void nokia_select(FAR struct spi_dev_s *spi);
|
||||
static void nokia_deselect(FAR struct spi_dev_s *spi);
|
||||
#endif
|
||||
static void nokia_sndcmd(FAR struct spi_dev_s *spi, const uint8_t cmd);
|
||||
static void nokia_cmdarray(FAR struct spi_dev_s *spi, int len, const uint8_t *cmddata);
|
||||
static void nokia_clrram(FAR struct spi_dev_s *spi);
|
||||
@@ -650,39 +644,6 @@ static const uint8_t g_setcon[] =
|
||||
* Private Functions
|
||||
**************************************************************************************/
|
||||
|
||||
/**************************************************************************************
|
||||
* Function: nokia_configspi
|
||||
*
|
||||
* Description:
|
||||
* Configure the SPI for use with the Nokia 6100
|
||||
*
|
||||
* Parameters:
|
||||
* spi - Reference to the SPI driver structure
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
static inline void nokia_configspi(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
lcddbg("Mode: %d Bits: %d Frequency: %d\n",
|
||||
CONFIG_NOKIA6100_SPIMODE, CONFIG_NOKIA6100_WORDWIDTH, CONFIG_NOKIA6100_FREQUENCY);
|
||||
|
||||
/* Configure SPI for the Nokia 6100. But only if we own the SPI bus. Otherwise, don't
|
||||
* bother because it might change.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
SPI_SETMODE(spi, CONFIG_NOKIA6100_SPIMODE);
|
||||
SPI_SETBITS(spi, CONFIG_NOKIA6100_WORDWIDTH);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_NOKIA6100_FREQUENCY)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
* Function: nokia_select
|
||||
*
|
||||
@@ -699,15 +660,6 @@ static inline void nokia_configspi(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void nokia_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just select the chip */
|
||||
|
||||
lcddbg("SELECTED\n");
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
}
|
||||
#else
|
||||
static void nokia_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* Select Nokia 6100 chip (locking the SPI bus in case there are multiple
|
||||
@@ -727,7 +679,6 @@ static void nokia_select(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_NOKIA6100_FREQUENCY);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Function: nokia_deselect
|
||||
@@ -745,15 +696,6 @@ static void nokia_select(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void nokia_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just de-select the chip */
|
||||
|
||||
lcddbg("DE-SELECTED\n");
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
}
|
||||
#else
|
||||
static void nokia_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* De-select Nokia 6100 chip and relinquish the SPI bus. */
|
||||
@@ -762,7 +704,6 @@ static void nokia_deselect(FAR struct spi_dev_s *spi)
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
SPI_LOCK(spi, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: nokia_sndcmd
|
||||
@@ -1218,9 +1159,8 @@ FAR struct lcd_dev_s *nokia_lcdinitialize(FAR struct spi_dev_s *spi, unsigned in
|
||||
priv->spi = spi; /* Save the SPI instance */
|
||||
priv->contrast = NOKIA_DEFAULT_CONTRAST; /* Initial contrast setting */
|
||||
|
||||
/* Configure and enable the LCD controller */
|
||||
/* Enable the LCD controller */
|
||||
|
||||
nokia_configspi(spi);
|
||||
if (nokia_initialize(priv) == OK)
|
||||
{
|
||||
/* Turn on the backlight */
|
||||
@@ -1228,5 +1168,6 @@ FAR struct lcd_dev_s *nokia_lcdinitialize(FAR struct spi_dev_s *spi, unsigned in
|
||||
nokia_backlight(CONFIG_NOKIA6100_BLINIT);
|
||||
return &priv->dev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -206,13 +206,8 @@ struct rit_dev_s
|
||||
/* Low-level SPI helpers */
|
||||
|
||||
static inline void rit_configspi(FAR struct spi_dev_s *spi);
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void rit_select(FAR struct spi_dev_s *spi);
|
||||
static inline void rit_deselect(FAR struct spi_dev_s *spi);
|
||||
#else
|
||||
static void rit_select(FAR struct spi_dev_s *spi);
|
||||
static void rit_deselect(FAR struct spi_dev_s *spi);
|
||||
#endif
|
||||
static void rit_sndbytes(FAR struct rit_dev_s *priv, FAR const uint8_t *buffer,
|
||||
size_t buflen, bool cmd);
|
||||
static void rit_sndcmds(FAR struct rit_dev_s *priv, FAR const uint8_t *table);
|
||||
@@ -457,14 +452,12 @@ static inline void rit_configspi(FAR struct spi_dev_s *spi)
|
||||
* bother because it might change.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
SPI_SETMODE(spi, CONFIG_P14201_SPIMODE);
|
||||
SPI_SETBITS(spi, 8);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
#ifdef CONFIG_P14201_FREQUENCY
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
@@ -483,14 +476,6 @@ static inline void rit_configspi(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void rit_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just select the chip */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
}
|
||||
#else
|
||||
static void rit_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* Select P14201 chip (locking the SPI bus in case there are multiple
|
||||
@@ -511,7 +496,6 @@ static void rit_select(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: rit_deselect
|
||||
@@ -529,14 +513,6 @@ static void rit_select(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void rit_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just de-select the chip */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
}
|
||||
#else
|
||||
static void rit_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* De-select P14201 chip and relinquish the SPI bus. */
|
||||
@@ -544,7 +520,6 @@ static void rit_deselect(FAR struct spi_dev_s *spi)
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
SPI_LOCK(spi, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: rit_sndbytes
|
||||
|
||||
@@ -258,10 +258,7 @@ void ssd1306_sendblk(FAR struct ssd1306_dev_s *priv, uint8_t *data, uint8_t len)
|
||||
#ifdef CONFIG_LCD_SSD1306_SPI
|
||||
void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs);
|
||||
void ssd1306_cmddata(FAR struct ssd1306_dev_s *priv, bool cmd);
|
||||
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
static inline void ssd1306_configspi(FAR struct spi_dev_s *spi)
|
||||
#endif
|
||||
|
||||
#else
|
||||
# define ssd1306_select(priv, cs)
|
||||
|
||||
@@ -818,23 +818,9 @@ FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_dev_s *dev, unsigned int
|
||||
#ifdef CONFIG_LCD_SSD1306_SPI
|
||||
priv->spi = dev;
|
||||
|
||||
/* If this SPI bus is not shared, then we can config it now.
|
||||
* If it is shared, then other device could change our config,
|
||||
* then just configure before sending data.
|
||||
*/
|
||||
|
||||
# ifdef CONFIG_SPI_OWNBUS
|
||||
/* Configure SPI */
|
||||
|
||||
SPI_SETMODE(priv->spi, CONFIG_SSD1306_SPIMODE);
|
||||
SPI_SETBITS(priv->spi, 8);
|
||||
(void)SPI_HWFEATURES(priv->spi, 0);
|
||||
(void)SPI_SETFREQUENCY(priv->spi, CONFIG_SSD1306_FREQUENCY);
|
||||
# else
|
||||
/* Configure the SPI */
|
||||
|
||||
ssd1306_configspi(priv->spi);
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* Remember the I2C configuration */
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
static inline void ssd1306_configspi(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
lcdvdbg("Mode: %d Bits: 8 Frequency: %d\n",
|
||||
@@ -74,7 +73,6 @@ static inline void ssd1306_configspi(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_SSD1306_FREQUENCY);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -124,7 +122,6 @@ void ssd1306_sendblk(FAR struct ssd1306_dev_s *priv, uint8_t *data, uint8_t len)
|
||||
|
||||
void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs)
|
||||
{
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
/* If we are selecting the device */
|
||||
|
||||
if (cs == true)
|
||||
@@ -134,13 +131,11 @@ void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs)
|
||||
(void)SPI_LOCK(priv->spi, true);
|
||||
ssd1306_configspi(priv->spi);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Select/deselect SPI device */
|
||||
|
||||
SPI_SELECT(priv->spi, SPIDEV_DISPLAY, cs);
|
||||
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
/* If we are deselecting the device */
|
||||
|
||||
if (cs == false)
|
||||
@@ -149,7 +144,6 @@ void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs)
|
||||
|
||||
(void)SPI_LOCK(priv->spi, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -507,12 +507,10 @@ static void ssd1351_select(FAR struct ssd1351_dev_s *priv)
|
||||
* have gotten configured for a different device while unlocked)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
SPI_SETMODE(spi, CONFIG_SSD1351_SPIMODE);
|
||||
SPI_SETBITS(spi, SSD1351_SPIBITS);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_SSD1351_SPIFREQ);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1189,19 +1187,6 @@ FAR struct lcd_dev_s *ssd1351_initialize(FAR struct spi_dev_s *spi,
|
||||
#endif
|
||||
priv->power = LCD_FULL_OFF;
|
||||
|
||||
/* Configure the SPI bus if we own it. Otherwise, don't bother because
|
||||
* it might change.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SSD1351_SPI3WIRE) || defined(CONFIG_SSD1351_SPI4WIRE)
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
SPI_SETMODE(spi, CONFIG_SSD1351_SPIMODE);
|
||||
SPI_SETBITS(spi, SSD1351_SPIBITS);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_SSD1351_SPIFREQ);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Configure the device */
|
||||
|
||||
ssd1351_hwinitialize(priv);
|
||||
|
||||
@@ -246,13 +246,8 @@ struct st7567_dev_s
|
||||
|
||||
/* SPI helpers */
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void st7567_select(FAR struct spi_dev_s *spi);
|
||||
static inline void st7567_deselect(FAR struct spi_dev_s *spi);
|
||||
#else
|
||||
static void st7567_select(FAR struct spi_dev_s *spi);
|
||||
static void st7567_deselect(FAR struct spi_dev_s *spi);
|
||||
#endif
|
||||
|
||||
/* LCD Data Transfer Methods */
|
||||
|
||||
@@ -371,14 +366,6 @@ static struct st7567_dev_s g_st7567dev =
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void st7567_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just select the chip */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
}
|
||||
#else
|
||||
static void st7567_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* Select ST7567 chip (locking the SPI bus in case there are multiple
|
||||
@@ -399,7 +386,6 @@ static void st7567_select(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_ST7567_FREQUENCY);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Function: st7567_deselect
|
||||
@@ -417,14 +403,6 @@ static void st7567_select(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void st7567_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just de-select the chip */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
}
|
||||
#else
|
||||
static void st7567_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* De-select ST7567 chip and relinquish the SPI bus. */
|
||||
@@ -432,7 +410,6 @@ static void st7567_deselect(FAR struct spi_dev_s *spi)
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
SPI_LOCK(spi, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: st7567_putrun
|
||||
|
||||
@@ -301,15 +301,8 @@ struct ug2864ambag01_dev_s
|
||||
|
||||
/* Low-level SPI helpers */
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void ug2864ambag01_configspi(FAR struct spi_dev_s *spi);
|
||||
# define ug2864ambag01_lock(spi)
|
||||
# define ug2864ambag01_unlock(spi)
|
||||
#else
|
||||
# define ug2864ambag01_configspi(spi)
|
||||
static void ug2864ambag01_lock(FAR struct spi_dev_s *spi);
|
||||
static void ug2864ambag01_unlock(FAR struct spi_dev_s *spi);
|
||||
#endif
|
||||
|
||||
/* LCD Data Transfer Methods */
|
||||
|
||||
@@ -408,39 +401,6 @@ static struct ug2864ambag01_dev_s g_oleddev =
|
||||
* Private Functions
|
||||
**************************************************************************************/
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug2864ambag01_configspi
|
||||
*
|
||||
* Description:
|
||||
* Configure the SPI for use with the UG-2864AMBAG01
|
||||
*
|
||||
* Input Parameters:
|
||||
* spi - Reference to the SPI driver structure
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void ug2864ambag01_configspi(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
lcdvdbg("Mode: %d Bits: 8 Frequency: %d\n",
|
||||
CONFIG_UG2864AMBAG01_SPIMODE, CONFIG_UG2864AMBAG01_FREQUENCY);
|
||||
|
||||
/* Configure SPI for the UG-2864AMBAG01. But only if we own the SPI bus. Otherwise,
|
||||
* don't bother because it might change.
|
||||
*/
|
||||
|
||||
SPI_SETMODE(spi, CONFIG_UG2864AMBAG01_SPIMODE);
|
||||
SPI_SETBITS(spi, 8);
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_UG2864AMBAG01_FREQUENCY);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug2864ambag01_lock
|
||||
*
|
||||
@@ -457,7 +417,6 @@ static inline void ug2864ambag01_configspi(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
static inline void ug2864ambag01_lock(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* Lock the SPI bus if there are multiple devices competing for the SPI bus. */
|
||||
@@ -473,7 +432,6 @@ static inline void ug2864ambag01_lock(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_HWFEATURES(spi, 0);
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_UG2864AMBAG01_FREQUENCY);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug2864ambag01_unlock
|
||||
@@ -491,14 +449,12 @@ static inline void ug2864ambag01_lock(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SPI_OWNBUS
|
||||
static inline void ug2864ambag01_unlock(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* De-select UG-2864AMBAG01 chip and relinquish the SPI bus. */
|
||||
|
||||
SPI_LOCK(spi, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug2864ambag01_putrun
|
||||
@@ -1080,10 +1036,6 @@ FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, unsign
|
||||
|
||||
priv->spi = spi;
|
||||
|
||||
/* Configure the SPI */
|
||||
|
||||
ug2864ambag01_configspi(spi);
|
||||
|
||||
/* Lock and select device */
|
||||
|
||||
ug2864ambag01_lock(priv->spi);
|
||||
|
||||
@@ -261,13 +261,8 @@ struct ug_dev_s
|
||||
|
||||
/* SPI helpers */
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void ug_select(FAR struct spi_dev_s *spi);
|
||||
static inline void ug_deselect(FAR struct spi_dev_s *spi);
|
||||
#else
|
||||
static void ug_select(FAR struct spi_dev_s *spi);
|
||||
static void ug_deselect(FAR struct spi_dev_s *spi);
|
||||
#endif
|
||||
|
||||
/* LCD Data Transfer Methods */
|
||||
|
||||
@@ -415,14 +410,6 @@ static inline FAR const char *ug_powerstring(uint8_t power)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void ug_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just select the chip */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
}
|
||||
#else
|
||||
static void ug_select(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* Select UG-9664HSWAG01 chip (locking the SPI bus in case there are multiple
|
||||
@@ -443,7 +430,6 @@ static void ug_select(FAR struct spi_dev_s *spi)
|
||||
(void)SPI_SETFREQUENCY(spi, CONFIG_UG9664HSWAG01_FREQUENCY);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Function: ug_deselect
|
||||
@@ -461,14 +447,6 @@ static void ug_select(FAR struct spi_dev_s *spi)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
static inline void ug_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* We own the SPI bus, so just de-select the chip */
|
||||
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
}
|
||||
#else
|
||||
static void ug_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* De-select UG-9664HSWAG01 chip and relinquish the SPI bus. */
|
||||
@@ -476,7 +454,6 @@ static void ug_deselect(FAR struct spi_dev_s *spi)
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
SPI_LOCK(spi, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug_putrun
|
||||
|
||||
Reference in New Issue
Block a user