drivers: nxstyle fixes

nxstyle fixes to pass the CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea
2021-03-04 08:02:21 +01:00
committed by Xiang Xiao
parent e5b6305f4a
commit ccff570e6f
76 changed files with 3180 additions and 2463 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
****************************************************************************
****************************************************************************/
/****************************************************************************
* References:
+18 -14
View File
@@ -1,4 +1,4 @@
/***********************************************************************************
/****************************************************************************
* drivers/audio/wm8994.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
***********************************************************************************/
****************************************************************************/
/***********************************************************************************
/****************************************************************************
* Included Files
***********************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -73,9 +73,9 @@
#define WM8994_DEFAULT_INPUT_DEVICE (WM8994_INPUT_DEVICE_DIGITAL_MIC1_MIC2)
#define WM8994_STARTUP_MODE_COLD (1)
/***********************************************************************************
/****************************************************************************
* Private Function Prototypes
***********************************************************************************/
****************************************************************************/
#if !defined(CONFIG_WM8994_REGDUMP) && !defined(CONFIG_WM8994_CLKDEBUG)
static
@@ -837,7 +837,8 @@ static int wm8994_stop(FAR struct audio_lowerhalf_s *dev)
term_msg.msg_id = AUDIO_MSG_STOP;
term_msg.u.data = 0;
(void)file_mq_send(&priv->mq, (FAR const char *)&term_msg, sizeof(term_msg),
(void)file_mq_send(&priv->mq, (FAR const char *)&term_msg,
sizeof(term_msg),
CONFIG_WM8994_MSG_PRIO);
/* Join the worker thread */
@@ -939,9 +940,10 @@ static int wm8994_enqueuebuffer(FAR struct audio_lowerhalf_s *dev,
dq_addlast(&apb->dq_entry, &priv->pendq);
wm8994_givesem(&priv->pendsem);
/* Send a message to the worker thread indicating that a new buffer has been
* enqueued. If mq is NULL, then the playing has not yet started. In that
* case we are just "priming the pump" and we don't need to send any message.
/* Send a message to the worker thread indicating that a new buffer has
* been enqueued. If mq is NULL, then the playing has not yet started.
* In that case we are just "priming the pump" and we don't need to send
* any message.
*/
ret = OK;
@@ -1256,7 +1258,8 @@ static void *wm8994_workerthread(pthread_addr_t pvarg)
/* Wait for messages from our message queue */
msglen = file_mq_receive(&priv->mq, (FAR char *)&msg, sizeof(msg), &prio);
msglen = file_mq_receive(&priv->mq, (FAR char *)&msg,
sizeof(msg), &prio);
/* Handle the case when we return with no message */
@@ -1587,7 +1590,8 @@ static void wm8994_hw_reset(FAR struct wm8994_dev_s *priv)
wm8994_writereg(priv, WM8994_DAC2_RIGHT_MIXER_ROUTING, regval);
break;
case WM8994_OUTPUT_DEVICE_BOTH:
if (WM8994_DEFAULT_INPUT_DEVICE == WM8994_INPUT_DEVICE_DIGITAL_MIC1_MIC2)
if (WM8994_DEFAULT_INPUT_DEVICE ==
WM8994_INPUT_DEVICE_DIGITAL_MIC1_MIC2)
{
wm8994_writereg(priv, 0x005, 0x0303 | 0x0c0c);
wm8994_writereg(priv, 0x601, 0x0003);
@@ -1924,9 +1928,9 @@ static void wm8994_hw_reset(FAR struct wm8994_dev_s *priv)
wm8994_clock_analysis(&priv->dev, "After configuration");
}
/***********************************************************************************
/****************************************************************************
* Public Functions
***********************************************************************************/
****************************************************************************/
/* Name: wm8994_initialize
*
+19 -19
View File
@@ -1,4 +1,4 @@
/***************************************************************************************************
/****************************************************************************
* drivers/audio/wm8994.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,14 +16,14 @@
* License for the specific language governing permissions and limitations
* under the License.
*
***************************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_AUDIO_WM8994_H
#define __DRIVERS_AUDIO_WM8994_H
/***************************************************************************************************
/****************************************************************************
* Included Files
***************************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
@@ -36,9 +36,9 @@
#ifdef CONFIG_AUDIO
/***************************************************************************************************
/****************************************************************************
* Pre-processor Definitions
***************************************************************************************************/
****************************************************************************/
/* So far, I have not been able to get FLL lock interrupts. Worse, I have
* been able to get the FLL to claim that it is locked at all even when
@@ -590,7 +590,7 @@
#define WM8994_IN2L_MUTE_ENABLE (WM8994_IN2L_MUTE) /* Enabled */
#define WM8994_IN2_VU (1 << 8) /* Bit 8: Input PGA Voluem Update. Writing a 1 to this bit cause IN2L and IN2R input PGA volumes to updated simultaneously */
/* Bits 9-15: Reserved */
/* Bits 9-15: Reserved */
/* R26 (0x1A) - Right Line Input 1&2 Volume
*/
@@ -785,7 +785,7 @@
/* R57 (0x39) - AntiPOP (2)
*/
/* Bits 8-15: Reserved */
/* Bits 8-15: Reserved */
#define WM8994_MICB2_DISCH (1 << 8) /* Bit 7: Microphone Bias 2 Discharge */
#define WM8994_MICB2_DISCH_FLOAT (0) /* MICBIAS2 floating when disabled */
#define WM8994_MICB2_DISCH_DISCHARGED WM8994_MICB2_DISCH /* MICBIAS2 disharged when disabled */
@@ -1549,9 +1549,9 @@
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
/***************************************************************************************************
/****************************************************************************
* Public Types
***************************************************************************************************/
****************************************************************************/
struct wm8994_dev_s
{
@@ -1559,9 +1559,9 @@ struct wm8994_dev_s
* the WM8994 driver with respect to the board lower half driver).
*
* Terminology: Our "lower" half audio instances will be called dev for the
* publicly visible version and "priv" for the version that only this driver
* knows. From the point of view of this driver, it is the board lower
* "half" that is referred to as "lower".
* publicly visible version and "priv" for the version that only this
* driver knows. From the point of view of this driver, it is the board
* lower "half" that is referred to as "lower".
*/
struct audio_lowerhalf_s dev; /* WM8994 audio lower half (this device) */
@@ -1605,26 +1605,26 @@ struct wm8994_dev_s
uint16_t power_mgnt_reg_1;
};
/***************************************************************************************************
/****************************************************************************
* Public Data
***************************************************************************************************/
****************************************************************************/
#ifdef CONFIG_WM8994_CLKDEBUG
extern const uint8_t g_sysclk_scaleb1[WM8994_BCLK_MAXDIV + 1];
extern const uint8_t g_fllratio[WM8994_NFLLRATIO];
#endif
/***************************************************************************************************
/****************************************************************************
* Public Function Prototypes
***************************************************************************************************/
****************************************************************************/
/***************************************************************************************************
/****************************************************************************
* Name: wm8994_readreg
*
* Description:
* Read the specified 16-bit register from the WM8994 device.
*
***************************************************************************************************/
****************************************************************************/
#if defined(CONFIG_WM8994_REGDUMP) || defined(CONFIG_WM8994_CLKDEBUG)
struct wm8994_dev_s;
+26 -23
View File
@@ -1,4 +1,4 @@
/*****************************************************************************************
/****************************************************************************
* drivers/audio/wm8994_debug.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
*****************************************************************************************/
****************************************************************************/
/*****************************************************************************************
/****************************************************************************
* Included Files
*****************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -34,13 +34,13 @@
#include "wm8994.h"
/*****************************************************************************************
/****************************************************************************
* Pre-processor Definitions
*****************************************************************************************/
****************************************************************************/
/*****************************************************************************************
/****************************************************************************
* Private Types
*****************************************************************************************/
****************************************************************************/
#ifdef CONFIG_WM8994_REGDUMP
struct wb8994_regdump_s
@@ -50,13 +50,13 @@ struct wb8994_regdump_s
};
#endif
/*****************************************************************************************
/****************************************************************************
* Private Function Prototypes
*****************************************************************************************/
****************************************************************************/
/*****************************************************************************************
/****************************************************************************
* Private Data
*****************************************************************************************/
****************************************************************************/
#ifdef CONFIG_WM8994_REGDUMP
static const struct wb8994_regdump_s g_wm8994_debug[] =
@@ -291,15 +291,15 @@ static const struct wb8994_regdump_s g_wm8994_debug[] =
# define WM8994_NREGISTERS (sizeof(g_wm8994_debug)/sizeof(struct wb8994_regdump_s))
#endif /* CONFIG_WM8994_REGDUMP */
/*****************************************************************************************
/****************************************************************************
* Private Functions
*****************************************************************************************/
****************************************************************************/
/*****************************************************************************************
/****************************************************************************
* Public Functions
*****************************************************************************************/
****************************************************************************/
/*****************************************************************************************
/****************************************************************************
* Name: wm8994_dump_registers
*
* Description:
@@ -311,7 +311,7 @@ static const struct wb8994_regdump_s g_wm8994_debug[] =
* Returned Value:
* None.
*
*****************************************************************************************/
****************************************************************************/
#ifdef CONFIG_WM8994_REGDUMP
void wm8994_dump_registers(FAR struct audio_lowerhalf_s *dev,
@@ -330,7 +330,7 @@ void wm8994_dump_registers(FAR struct audio_lowerhalf_s *dev,
}
#endif /* CONFIG_WM8994_REGDUMP */
/*****************************************************************************************
/****************************************************************************
* Name: wm8994_clock_analysis
*
* Description:
@@ -342,7 +342,7 @@ void wm8994_dump_registers(FAR struct audio_lowerhalf_s *dev,
* Returned Value:
* None.
*
*****************************************************************************************/
****************************************************************************/
#ifdef CONFIG_WM8994_CLKDEBUG
void wm8994_clock_analysis(FAR struct audio_lowerhalf_s *dev,
@@ -442,8 +442,10 @@ void wm8994_clock_analysis(FAR struct audio_lowerhalf_s *dev,
regval = wm8994_readreg(priv, WM8994_FLL_CTRL2);
frndx = (regval & WM8994_FLL_FRATIO_MASK) >> WM8994_FLL_FRATIO_SHIFT;
tmp = (regval & WM8994_FLL_CTRL_RATE_MASK) >> WM8994_FLL_CTRL_RATE_SHIFT;
outdiv = ((regval & WM8994_FLL_OUTDIV_MASK) >> WM8994_FLL_OUTDIV_SHIFT) + 1;
tmp = (regval & WM8994_FLL_CTRL_RATE_MASK) >>
WM8994_FLL_CTRL_RATE_SHIFT;
outdiv = ((regval & WM8994_FLL_OUTDIV_MASK) >>
WM8994_FLL_OUTDIV_SHIFT) + 1;
syslog(LOG_INFO, " FLL_CTRL_RATE: Fvco / %u\n", tmp + 1);
@@ -501,7 +503,8 @@ void wm8994_clock_analysis(FAR struct audio_lowerhalf_s *dev,
sysclk >>= 1;
}
syslog(LOG_INFO, " SYSCLK: %lu (after divider)\n", (unsigned long)sysclk);
syslog(LOG_INFO, " SYSCLK: %lu (after divider)\n",
(unsigned long)sysclk);
regval = wm8994_readreg(priv, WM8994_CLKRATE2);
+3 -1
View File
@@ -433,7 +433,9 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
#endif
/* Otherwise, pass the IOCTL command on to the contained block driver. */
/* Otherwise, pass the IOCTL command on to the contained block
* driver.
*/
default:
{
+16 -14
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/input/ads7843e.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
********************************************************************************************/
****************************************************************************/
/* References:
* "Touch Screen Controller, ADS7843," Burr-Brown Products from Texas
@@ -32,9 +32,9 @@
#ifndef __DRIVERS_INPUT_ADS7843E_H
#define __DRIVERS_INPUT_ADS7843E_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -48,17 +48,19 @@
#include <nuttx/spi/spi.h>
#include <nuttx/input/ads7843e.h>
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* Configuration ****************************************************************************/
/* Configuration ************************************************************/
/* Reference counting is partially implemented, but not needed in the current design. */
/* Reference counting is partially implemented, but not needed in the current
* design.
*/
#undef CONFIG_ADS7843E_REFCNT
/* ADS7843E Interfaces **********************************************************************/
/* ADS7843E Interfaces ******************************************************/
/* ADS7843E command bit settings */
@@ -79,7 +81,7 @@
#define ADS7843_CMD_ENABPENIRQ \
((1 << ADS7843E_CMD_CHAN_SHIFT)| ADS7843E_CMD_START)
/* Driver support ***************************************************************************/
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/input[n] device driver path. It
* defined here so that it will be used consistently in all places.
@@ -92,9 +94,9 @@
#define ADS7843E_WDOG_DELAY MSEC2TICK(50)
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* This describes the state of one contact */
@@ -149,9 +151,9 @@ struct ads7843e_dev_s
struct pollfd *fds[CONFIG_ADS7843E_NPOLLWAITERS];
};
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
+2 -2
View File
@@ -576,7 +576,8 @@ static int ajoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
switch (cmd)
{
/* Command: AJOYIOC_SUPPORTED
* Description: Report the set of button events supported by the hardware;
* Description: Report the set of button events supported by the
* hardware;
* Argument: A pointer to writeable integer value in which to return
* the set of supported buttons.
* Return: Zero (OK) on success. Minus one will be returned on
@@ -782,7 +783,6 @@ errout_with_dusem:
int ajoy_register(FAR const char *devname,
FAR const struct ajoy_lowerhalf_s *lower)
{
FAR struct ajoy_upperhalf_s *priv;
int ret;
+12 -12
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/input/max11802.h
*
* Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
@@ -32,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
****************************************************************************/
/* References:
* "Low-Power, Ultra-Small Resistive Touch-Screen Controllers
@@ -42,9 +42,9 @@
#ifndef __DRIVERS_INPUT_MAX11802_H
#define __DRIVERS_INPUT_MAX11802_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -58,11 +58,11 @@
#include <nuttx/spi/spi.h>
#include <nuttx/input/max11802.h>
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* MAX11802 Interfaces **********************************************************************/
/* MAX11802 Interfaces ******************************************************/
/* LSB of register addresses specifies read (1) or write (0). */
@@ -86,7 +86,7 @@
#define MAX11802_DELAY 0x55
#define MAX11802_PULL 0x33
/* Driver support ***************************************************************************/
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/input[n] device driver path. It
* defined here so that it will be used consistently in all places.
@@ -99,9 +99,9 @@
#define MAX11802_WDOG_DELAY MSEC2TICK(50)
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* This describes the state of one contact */
@@ -153,9 +153,9 @@ struct max11802_dev_s
struct pollfd *fds[CONFIG_MAX11802_NPOLLWAITERS];
};
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
+1
View File
@@ -240,6 +240,7 @@
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure describes one maXTouch object */
struct mxt_object_s
+40 -33
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/input/stmpe811.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
********************************************************************************************/
****************************************************************************/
/* References:
* "STMPE811 S-Touch advanced resistive touchscreen controller with 8-bit
@@ -26,9 +26,9 @@
#ifndef __DRIVERS_INPUT_STMPE811_H
#define __DRIVERS_INPUT_STMPE811_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -40,26 +40,29 @@
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811)
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* Configuration ****************************************************************************/
/* Configuration ************************************************************/
/* Reference counting is partially implemented, but not needed in the current design. */
/* Reference counting is partially implemented, but not needed in the current
* design.
*/
#undef CONFIG_STMPE811_REFCNT
/* Driver support ***************************************************************************/
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/input[n] device driver path. It defined here
* so that it will be used consistently in all places.
/* This format is used to construct the /dev/input[n] device driver path.
* It defined here so that it will be used consistently in all places.
*/
#define DEV_FORMAT "/dev/input%d"
#define DEV_NAMELEN 16
/* STMPE811 Resources ***********************************************************************/
/* STMPE811 Resources *******************************************************/
#ifndef CONFIG_STMPE811_TSC_DISABLE
# define STMPE811_ADC_NPINS 4 /* Only pins 0-3 can be used for ADC */
# define STMPE811_GPIO_NPINS 4 /* Only pins 0-3 can be used as GPIOs */
@@ -79,9 +82,9 @@
#define STMPE811_PENUP_TICKS MSEC2TICK(100)
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* This describes the state of one contact */
@@ -127,7 +130,9 @@ struct stmpe811_dev_s
uint8_t flags; /* See STMPE811_FLAGS_* definitions */
struct work_s work; /* Supports the interrupt handling "bottom half" */
/* Fields that may be disabled to save size if touchscreen support is not used. */
/* Fields that may be disabled to save size if touchscreen support
* is not used.
*/
#ifndef CONFIG_STMPE811_TSC_DISABLE
#ifdef CONFIG_STMPE811_REFCNT
@@ -161,61 +166,63 @@ struct stmpe811_dev_s
#endif
};
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
/********************************************************************************************
/****************************************************************************
* Name: stmpe811_getreg8
*
* Description:
* Read from an 8-bit STMPE811 register
*
********************************************************************************************/
****************************************************************************/
uint8_t stmpe811_getreg8(FAR struct stmpe811_dev_s *priv, uint8_t regaddr);
/********************************************************************************************
/****************************************************************************
* Name: stmpe811_putreg8
*
* Description:
* Write a value to an 8-bit STMPE811 register
*
********************************************************************************************/
****************************************************************************/
void stmpe811_putreg8(FAR struct stmpe811_dev_s *priv, uint8_t regaddr, uint8_t regval);
void stmpe811_putreg8(FAR struct stmpe811_dev_s *priv,
uint8_t regaddr, uint8_t regval);
/********************************************************************************************
/****************************************************************************
* Name: stmpe811_getreg16
*
* Description:
* Read 16-bits of data from an STMPE-11 register
*
********************************************************************************************/
****************************************************************************/
uint16_t stmpe811_getreg16(FAR struct stmpe811_dev_s *priv, uint8_t regaddr);
/********************************************************************************************
/****************************************************************************
* Name: stmpe811_tscint
*
* Description:
* Handle touchscreen interrupt events (this function actually executes in the context of
* the worker thread).
* Handle touchscreen interrupt events (this function actually executes in
* the context of the worker thread).
*
********************************************************************************************/
****************************************************************************/
#ifndef CONFIG_STMPE811_TSC_DISABLE
void stmpe811_tscworker(FAR struct stmpe811_dev_s *priv, uint8_t intsta) weak_function;
void stmpe811_tscworker(FAR struct stmpe811_dev_s *priv,
uint8_t intsta) weak_function;
#endif
/********************************************************************************************
/****************************************************************************
* Name: stmpe811_gpioworker
*
* Description:
* Handle GPIO interrupt events (this function actually executes in the context of the
* worker thread).
* Handle GPIO interrupt events (this function actually executes in the
* context of the worker thread).
*
********************************************************************************************/
****************************************************************************/
#if !defined(CONFIG_STMPE811_GPIO_DISABLE) && !defined(CONFIG_STMPE811_GPIOINT_DISABLE)
void stmpe811_gpioworker(FAR struct stmpe811_dev_s *priv) weak_function;
+2 -1
View File
@@ -124,7 +124,7 @@ uint16_t stmpe811_tempread(STMPE811_HANDLE handle)
/* Read the temperature */
temp1 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2);
temp2 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2+1);
temp2 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2 + 1);
add_sensor_randomness((temp1 << 8) | temp2);
@@ -159,6 +159,7 @@ uint16_t stmpe811_tempread(STMPE811_HANDLE handle)
* returned to indicate the nature of the failure.
*
****************************************************************************/
/* Not implemented */
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE811 && !CONFIG_STMPE811_TEMP_DISABLE */
+18 -13
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/input/tsc2007.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,11 +16,12 @@
* License for the specific language governing permissions and limitations
* under the License.
*
********************************************************************************************/
****************************************************************************/
/* The TSC2007 is an analog interface circuit for a human interface touch screen device.
* All peripheral functions are controlled through the command byte and onboard state
* machines.
/* The TSC2007 is an analog interface circuit for a human interface touch
* screen device.
* All peripheral functions are controlled through the command byte and
* onboard state machines.
*/
/* References:
@@ -32,13 +33,13 @@
#ifndef __DRIVERS_INPUT_TSC2007_H
#define __DRIVERS_INPUT_TSC2007_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* TSC2007 Address */
@@ -52,6 +53,7 @@
/* TSC2007 Command Byte */
#define TSC2007_CMD_FUNC_SHIFT (4) /* Bits 4-7: Converter function select bits */
#define TSC2007_CMD_FUNC_MASK (15 << TSC2007_CMD_FUNC_SHIFT)
# define TSC2007_CMD_FUNC_TEMP0 (0 << TSC2007_CMD_FUNC_SHIFT) /* Measure TEMP0 */
# define TSC2007_CMD_FUNC_AUX (2 << TSC2007_CMD_FUNC_SHIFT) /* Measure AUX */
@@ -64,12 +66,14 @@
# define TSC2007_CMD_FUNC_YPOS (13 << TSC2007_CMD_FUNC_SHIFT) /* Measure Y position */
# define TSC2007_CMD_FUNC_Z1POS (14 << TSC2007_CMD_FUNC_SHIFT) /* Measure Z1 position */
# define TSC2007_CMD_FUNC_Z2POS (15 << TSC2007_CMD_FUNC_SHIFT) /* Measure Z2 position */
#define TSC2007_CMD_PWRDN_SHIFT (2) /* Bits 2-3: Power-down bits */
#define TSC2007_CMD_PWRDN_MASK (3 << TSC2007_CMD_PWRDN_SHIFT)
# define TSC2007_CMD_PWRDN_IRQEN (0 << TSC2007_CMD_PWRDN_SHIFT) /* 00: Power down between cycles; PENIRQ enabled */
# define TSC2007_CMD_ADCON_IRQDIS (1 << TSC2007_CMD_PWRDN_SHIFT) /* 01: A/D converter on; PENIRQ disabled */
# define TSC2007_CMD_ADCOFF_IRQEN (2 << TSC2007_CMD_PWRDN_SHIFT) /* 10: A/D converter off; PENIRQ enabled. */
/* 11: A/D converter on; PENIRQ disabled. */
#define TSC2007_CMD_12BIT (0) /* Bit 1: 0=12-bit */
#define TSC2007_CMD_8BIT (1 << 1) /* Bit 1: 1=8-bit */
/* Bit 0: Don't care */
@@ -77,19 +81,20 @@
/* TSC2007 Setup Command */
#define TSC2007_SETUP_CMD TSC2007_CMD_FUNC_SETUP /* Bits 4-7: Setup command */
/* Bits 2-3: Must be zero */
#define TSC2007_CMD_USEMAV (0) /* Bit 1: 0: Use the onboard MAV filter (default) */
#define TSC2007_CMD_BYPASSMAV (1 << 1) /* Bit 1: 1: Bypass the onboard MAV filter */
#define TSC2007_CMD_PU_50KOHM (0) /* Bit 0: 0: RIRQ = 50kOhm (default). */
#define TSC2007_CMD_PU_90KOHM (1 << 1) /* Bit 0: 1: 1: RIRQ = 90kOhm */
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
+12 -12
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/ioexpander/pca9555.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
@@ -35,14 +35,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_IOEXPANDER_PCA9555_H
#define __DRIVERS_IOEXPANDER_PCA9555_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -58,9 +58,9 @@
#if defined(CONFIG_IOEXPANDER) && defined(CONFIG_IOEXPANDER_PCA9555)
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* Configuration ************************************************************/
@@ -122,19 +122,19 @@
#define PCA9555_REG_POLINV 0x04
#define PCA9555_REG_CONFIG 0x06
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
#ifdef CONFIG_IOEXPANDER_INT_ENABLE
/* This type represents on registered pin interrupt callback */
struct pca9555_callback_s
{
ioe_pinset_t pinset; /* Set of pin interrupts that will generate
* the callback. */
ioe_callback_t cbfunc; /* The saved callback function pointer */
FAR void *cbarg; /* Callback argument */
ioe_pinset_t pinset; /* Set of pin interrupts that will generate
* the callback. */
ioe_callback_t cbfunc; /* The saved callback function pointer */
FAR void *cbarg; /* Callback argument */
};
#endif
+8 -8
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/ioexpander/pcf8574.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,14 +16,14 @@
* License for the specific language governing permissions and limitations
* under the License.
*
********************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_IOEXPANDER_PCF8574_H
#define __DRIVERS_IOEXPANDER_PCF8574_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -39,9 +39,9 @@
#if defined(CONFIG_IOEXPANDER) && defined(CONFIG_IOEXPANDER_PCF8574)
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* Configuration ************************************************************/
@@ -105,9 +105,9 @@
#define PCF8574_EDGE_BOTH(d,p) \
(PCF8574_LEVEL_RISING(d,p) && PCF8574_LEVEL_FALLING(d,p))
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
#ifdef CONFIG_IOEXPANDER_INT_ENABLE
/* This type represents on registered pin interrupt callback */
+11 -11
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/ioexpander/tca64.h
*
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
@@ -35,14 +35,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_IOEXPANDER_TCA64XX_H
#define __DRIVERS_IOEXPANDER_TCA64XX_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -58,11 +58,11 @@
#if defined(CONFIG_IOEXPANDER) && defined(CONFIG_IOEXPANDER_TCA64XX)
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* Configuration ****************************************************************************/
/* Configuration ************************************************************/
/* Prerequisites:
* CONFIG_I2C
@@ -103,13 +103,13 @@
# define CONFIG_TCA64XX_INT_POLLDELAY 500000
#endif
/* TCA64XX Definitions **********************************************************************/
/* TCA64XX Definitions ******************************************************/
/* I2C frequency */
#define TCA64XX_I2C_MAXFREQUENCY 400000 /* 400KHz */
/* TCA64XX Parts ****************************************************************************/
/* TCA64XX Parts ************************************************************/
#define TCA6408_INPUT_REG 0x00
#define TCA6408_OUTPUT_REG 0x01
@@ -181,9 +181,9 @@
#define TCA64_EDGE_BOTH(d,p) \
(TCA64_LEVEL_RISING(d,p) && TCA64_LEVEL_FALLING(d,p))
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* This structure represents the configuration of one part */
+27 -21
View File
@@ -1,4 +1,4 @@
/*******************************************************************************************
/****************************************************************************
* drivers/lcd/ft80x.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,38 +16,42 @@
* License for the specific language governing permissions and limitations
* under the License.
*
*******************************************************************************************/
****************************************************************************/
/* Definitions for the FTDI FT80x GUI
*
* References:
* - Document No.: FT_000792, "FT800 Embedded Video Engine", Datasheet Version 1.1,
* Clearance No.: FTDI# 334, Future Technology Devices International Ltd.
* - Document No.: FT_000986, "FT801 Embedded Video Engine Datasheet", Version 1.0,
* Clearance No.: FTDI#376, Future Technology Devices International Ltd.
* - Document No.:
* FT_000792, "FT800 Embedded Video Engine", Datasheet Version 1.1,
* Clearance No.:
* FTDI# 334, Future Technology Devices International Ltd.
* - Document No.:
* FT_000986, "FT801 Embedded Video Engine Datasheet", Version 1.0,
* Clearance No.:
* FTDI#376, Future Technology Devices International Ltd.
* - Some definitions derive from FTDI sample code.
*/
#ifndef __DRIVERS_LCD_FT80X_H
#define __DRIVERS_LCD_FT80X_H
/*******************************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/signal.h>
#include <nuttx/wqueue.h>
/*******************************************************************************************
/****************************************************************************
* Public Types
*******************************************************************************************/
****************************************************************************/
/* Host write command
*
* For a SPI write command write transaction, the host writes a zero bit followed by a one
* bit, followed by the 5-bit command, followed by two bytes of zero. All data is streamed
* with a single chip select.
* For a SPI write command write transaction, the host writes a zero bit
* followed by a one bit, followed by the 5-bit command, followed by two
* bytes of zero. All data is streamed with a single chip select.
*
* I2C data format is equivalent (with obvious differences in bus protocol)
*/
@@ -59,11 +63,12 @@ struct ft80x_hostwrite_s
uint8_t pad2; /* Zero */
};
/* For SPI memory read transaction, the host sends two zero bits, followed by the 22-bit
* address. This is followed by a dummy byte. After the dummy byte, the FT80x responds to
* each host byte with read data bytes.
/* For SPI memory read transaction, the host sends two zero bits, followed
* by the 22-bit address. This is followed by a dummy byte. After the dummy
* byte, the FT80x responds to each host byte with read data bytes.
*
* For I2C memory read transaction, bytes are packed in the I2C protocol as follow:
* For I2C memory read transaction, bytes are packed in the I2C protocol
* as follow:
*
* [start] <DEVICE ADDRESS + write bit>
* <00b+Address[21:16]>
@@ -90,10 +95,11 @@ struct ft80x_i2cread_s
uint8_t addrl; /* Address[7:0] */
};
/* For SPI memory write transaction, the host sends a '1' bit and '0' bit, followed by the
* 22-bit address. This is followed by the write data.
/* For SPI memory write transaction, the host sends a '1' bit and '0' bit,
* followed by the 22-bit address. This is followed by the write data.
*
* For I2C memory write transaction, bytes are packed in the I2C protocol as follow:
* For I2C memory write transaction, bytes are packed in the I2C protocol
* as follow:
*
* [start] <DEVICE ADDRESS + write bit>
* <10b,Address[21:16]>
@@ -183,7 +189,7 @@ struct ft80x_dev_s
};
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
/****************************************************************************
+190 -145
View File
File diff suppressed because it is too large Load Diff
+171 -125
View File
File diff suppressed because it is too large Load Diff
+132 -102
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/pcd8544.h
* Definitions for the PCD8544 LCD Display
*
@@ -32,18 +32,18 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_LCD_PCD8544_H
#define __DRIVERS_LCD_PCD8544_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
#define PCD8544_MAX_BANKS 6
#define PCD8544_MAX_COLS 84
+9 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/pcf8833.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
/* Definitions for the Phillips PCF8833 LCD controller
*
@@ -27,13 +27,14 @@
#ifndef __DRIVERS_LCD_PCF8833_H
#define __DRIVERS_LCD_PCF8833_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Pixel format codes */
#define PCF8833_FMT_8BPS (2)
@@ -104,7 +105,9 @@
#define MADCTL_MY (1 << 7) /* Bit 7: Mirror Y */
/* PCF8833 status register bit definitions */
/* CMD format: RDDST command followed by four status bytes: */
/* Byte 1: D31 d30 D29 D28 D27 D26 --- --- */
#define PCF8833_ST_RGB (1 << 2) /* Bit 2: D26 - RGB/BGR order */
+256 -184
View File
File diff suppressed because it is too large Load Diff
+7 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/ra8875.h
* Definitions for the RAiO Technologies RA8875 LCD controller
*
@@ -34,22 +34,22 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_LCD_RA8875_H
#define __DRIVERS_LCD_RA8875_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_LCD_RA8875
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* RA8875 Register Addresses (All with RS=1) */
@@ -150,6 +150,7 @@
#define RA8875_DTPV1 0xAC /* Draw Triangle Point 2 Vertical Address Register 1 */
/* Bit definitions */
/* Power and display control */
#define RA8875_PWRR_DISPLAY_OFF (0)
+6 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/s1d15g10.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
/* Definitions for the Epson S1D15G0 LCD controller
*
@@ -25,13 +25,13 @@
#ifndef __DRIVERS_LCD_S1D15G10_H
#define __DRIVERS_LCD_S1D15G10_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Epson S1D15G10 Command Set */
+105 -95
View File
@@ -33,17 +33,18 @@
****************************************************************************/
/* SD1329 Commands **********************************************************/
/* Set column Address.
*
* This triple byte command specifies column start address and end address of
* the display data RAM. This command also sets the column address pointer to
* column start address. This pointer is used to define the current read/write
* column address in graphic display data RAM. If horizontal address increment
* mode is enabled by command 0xa0, after finishing read/write one column data,
* it is incremented automatically to the next column address. Whenever the
* column address pointer finishes accessing the end column address, it is
* reset back to start column address and the row address is incremented to the
* next row.
* column start address. This pointer is used to define the current
* read/write column address in graphic display data RAM. If horizontal
* address increment mode is enabled by command 0xa0, after finishing
* read/write one column data, it is incremented automatically to the next
* column address. Whenever the column address pointer finishes accessing the
* end column address, it is reset back to start column address and the row
* address is incremented to the next row.
*
* Byte 1: 0x15
* Byte 2: A[5:0]: Start Address, range: 0x00-0x3f
@@ -54,14 +55,14 @@
/* Set Row Address.
*
* This triple byte command specifies row start address and end address of the
* display data RAM. This command also sets the row address pointer to row
* start address. This pointer is used to define the current read/write row
* address in graphic display data RAM. If vertical address increment mode is
* enabled by command 0xa0, after finishing read/write one row data, it is
* incremented automatically to the next row address. Whenever the row address
* pointer finishes accessing the end row address, it is reset back to start
* row address.
* This triple byte command specifies row start address and end address of
* the display data RAM. This command also sets the row address pointer to
* row start address. This pointer is used to define the current read/write
* row address in graphic display data RAM. If vertical address increment
* mode is enabled by command 0xa0, after finishing read/write one row data,
* it is incremented automatically to the next row address. Whenever the row
* address pointer finishes accessing the end row address, it is reset back
* to start row address.
*
* Byte 1: 0x75
* Byte 2: A[6:0]: Start Address, range: 0x00-0x7f
@@ -116,9 +117,9 @@
/* Set Icon Current Range
*
* This double byte command is used to set one fix current range for all icons
* between the range of 0uA and 127.5uA. The uniformity improves as the icon
* current range increases.
* This double byte command is used to set one fix current range for all
* icons between the range of 0uA and 127.5uA. The uniformity improves as
* the icon current range increases.
*
* Byte 1: 0x91
* Byte 2: A[7:0]: Max icon current:
@@ -132,12 +133,13 @@
/* Set Individual Icon Current
*
* This multiple byte command is used to fine tune the current for each of the
* 64 icons. Command 0x92 followed by 64 single byte data. These 64 byte data
* have to be entered in order to make this command function. Below is the
* formula for calculating the icon current.
* This multiple byte command is used to fine tune the current for each of
* the 64 icons. Command 0x92 followed by 64 single byte data. These 64 byte
* data have to be entered in order to make this command function. Below is
* the formula for calculating the icon current.
*
* Icon Current = Single byte value / 127 x Maximum icon current set with command 0x91
* Icon Current = Single byte value / 127 x Maximum icon current set with
* command 0x91
*
* Byte 1: 0x92
* Byte 2-65: An[6:0]: icon current for ICSn, range: 0x00-0x7f
@@ -148,8 +150,8 @@
/* Set Individual Icon ON / OFF Register
*
* This double byte command is used to select one of the 64 icons and choose the
* ON, OFF or blinking condition of the selected icon.
* This double byte command is used to select one of the 64 icons and choose
* the ON, OFF or blinking condition of the selected icon.
*
* Byte 1: 0x93
* Byte 2: A[5:0]: Select one of the 64 icons from ICS0 ~ ICS63
@@ -163,7 +165,8 @@
/* Set Icon ON / OFF Registers
*
* This double byte command is used to set the ON / OFF status of all 64 icons.
* This double byte command is used to set the ON / OFF status of all 64
* icons.
*
* Byte 1: 0x94
* Byte 2: A[7:6]: OFF/ON/BLINK (Same as 0x93)
@@ -198,8 +201,8 @@
/* Set Icon Duty
*
* This double byte command is used to set the icon frame frequency and icon AC
* drive duty ratio.
* This double byte command is used to set the icon frame frequency and icon
* AC drive duty ratio.
*
* Byte 1: 0x96
* Byte 2:
@@ -223,40 +226,42 @@
* described as follows:
*
* Column Address Remapping (A[0])
* This bit is made for increase the flexibility layout of segment signals in
* OLED module with segment arranged from left to right (when A[0] is set to 0)
* or from right to left (when A[0] is set to 1).
* This bit is made for increase the flexibility layout of segment signals
* in OLED module with segment arranged from left to right (when A[0] is
* set to 0) or from right to left (when A[0] is set to 1).
*
* Nibble Remapping (A[1])
* When A[1] is set to 1, the two nibbles of the data bus for RAM access are
* re-mapped, such that (D7, D6, D5, D4, D3, D2, D1, D0) acts like (D3, D2, D1,
* D0, D7, D6, D5, D4) If this feature works together with Column Address
* Re-map, it would produce an effect of flipping the outputs from SEG0-127 to
* SEG127-SEG0.
* When A[1] is set to 1, the two nibbles of the data bus for RAM access
* are re-mapped, such that (D7, D6, D5, D4, D3, D2, D1, D0) acts like
* (D3, D2, D1, D0, D7, D6, D5, D4) If this feature works together with
* Column Address Re-map, it would produce an effect of flipping the
* outputs from SEG0-127 to SEG127-SEG0.
*
* Address increment mode (A[2])
* When A[2] is set to 0, the driver is set as horizontal address incremen
* mode. After the display RAM is read/written, the column address pointer is
* increased automatically by 1. If the column address pointer reaches column
* end address, the column address pointer is reset to column start address and
* row address pointer is increased by 1.
* mode. After the display RAM is read/written, the column address pointer
* is increased automatically by 1. If the column address pointer reaches
* column end address, the column address pointer is reset to column start
* address and row address pointer is increased by 1.
*
* When A[2] is set to 1, the driver is set to vertical address increment mode.
* After the display RAM is read/written, the row address pointer is increased
* automatically by 1. If the row address pointer reaches the row end address,
* the row address pointer is reset to row start address and column address
* pointer is increased by 1.
* When A[2] is set to 1, the driver is set to vertical address increment
* mode.
* After the display RAM is read/written, the row address pointer is
* increased automatically by 1. If the row address pointer reaches the row
* end address, the row address pointer is reset to row start address and
* column address pointer is increased by 1.
*
* COM Remapping (A[4])
* This bit defines the scanning direction of the common for flexible layout
* of common signals in OLED module either from up to down (when A[4] is set to
* 0) or from bottom to up (when A[4] is set to 1).
* This bit defines the scanning direction of the common for flexible
* layout of common signals in OLED module either from up to down (when
* A[4] is set to 0) or from bottom to up (when A[4] is set to 1).
*
* Splitting of Odd / Even COM Signals (A[6])
* This bit is made to match the COM layout connection on the panel. When A[6]
* is set to 0, no splitting odd / even of the COM signal is performed. When
* A[6] is set to 1, splitting odd / even of the COM signal is performed,
* output pin assignment sequence is shown as below (for 128MUX ratio):
* This bit is made to match the COM layout connection on the panel.
* When A[6] is set to 0, no splitting odd / even of the COM signal is
* performed. When A[6] is set to 1, splitting odd / even of the COM signal
* is performed, output pin assignment sequence is shown as below
* (for 128MUX ratio):
*
* Byte 1: 0xa0
* Byte 2: A[7:0]
@@ -272,8 +277,8 @@
/* Set Display Start Line
*
* This double byte command is to set Display Start Line register for
* determining the starting address of display RAM to be displayed by selecting
* a value from 0 to 127.
* determining the starting address of display RAM to be displayed by
* selecting a value from 0 to 127.
*
* Byte 1: 0xa1
* Byte 2: A[6:0]: Vertical scroll by setting the starting address of
@@ -284,9 +289,9 @@
/* Set Display Offset
*
* This double byte command specifies the mapping of display start line (it is
* assumed that COM0 is the display start line, display start line register
* equals to 0) to one of COM0-COM127.
* This double byte command specifies the mapping of display start line
* (it is assumed that COM0 is the display start line, display start line
* register equals to 0) to one of COM0-COM127.
*
* Byte 1: 0xa2
* Byte 2: A[6:0]: Set vertical offset by COM from 0-127
@@ -296,24 +301,24 @@
/* Set Display Mode - Normal, all on, all off, inverse
*
* These are single byte commands and are used to set display status to Normal
* Display, Entire Display ON, Entire Display OFF or Inverse Display.
* These are single byte commands and are used to set display status to
* Normal Display, Entire Display ON, Entire Display OFF or Inverse Display.
*
* Normal Display (0xa4)
* Reset the Entire Display ON, Entire Display OFF or Inverse Display effects
* and turn the data to ON at the corresponding gray level.
* Reset the Entire Display ON, Entire Display OFF or Inverse Display
* effects and turn the data to ON at the corresponding gray level.
*
* Set Entire Display ON (0xa5)
* Force the entire display to be at gray scale level GS15, regardless of the
* contents of the display data RAM.
* Force the entire display to be at gray scale level GS15, regardless
* of the contents of the display data RAM.
*
* Set Entire Display OFF (0xa6)
* Force the entire display to be at gray scale level GS0, regardless of the
* contents of the display data RAM.
* Force the entire display to be at gray scale level GS0, regardless
* of the contents of the display data RAM.
*
* Inverse Display (0xa7)
* The gray scale level of display data are swapped such that GS0 <-> GS15,
* GS1 <-> GS14, etc.
* The gray scale level of display data are swapped such that
* GS0 <-> GS15, GS1 <-> GS14, etc.
*
* Byte 1: Display mode command
*/
@@ -337,10 +342,10 @@
/* Set Sleep mode ON / OFF
*
* These single byte commands are used to turn the matrix display on the OLED
* panel display either ON or OFF. When the sleep mode is set to ON (0xae), the
* display is OFF, the segment and common output are in high impedance state
* and circuits will be turned OFF. When the sleep mode is set to OFF (0xaf),
* the display is ON.
* panel display either ON or OFF. When the sleep mode is set to ON (0xae),
* the display is OFF, the segment and common output are in high impedance
* state and circuits will be turned OFF. When the sleep mode is set to OFF
* (0xaf), the display is ON.
*
* Byte 1: sleep mode command
*/
@@ -350,13 +355,14 @@
/* Set Phase Length
*
* In the second byte of this double command, lower nibble and higher nibble is
* defined separately. The lower nibble adjusts the phase length of Reset (phase
* 1). The higher nibble is used to select the phase length of first pre-charge
* phase (phase 2). The phase length is ranged from 1 to 16 DCLK's. RESET for
* A[3:0] is set to 3 which means 4 DCLKs selected for Reset phase. POR for
* A[7:4] is set to 5 which means 6 DCLKs is selected for first pre-charge
* phase. Please refer to Table 9-1 for detail breakdown levels of each step.
* In the second byte of this double command, lower nibble and higher nibble
* is defined separately. The lower nibble adjusts the phase length of Reset
* (phase 1). The higher nibble is used to select the phase length of first
* pre-charge phase (phase 2). The phase length is ranged from 1 to 16
* DCLK's. RESET for A[3:0] is set to 3 which means 4 DCLKs selected for
* Reset phase. POR for A[7:4] is set to 5 which means 6 DCLKs is selected
* for first pre-charge phase.
* Please refer to Table 9-1 for detail breakdown levels of each step.
*
* Byte 1: 0xb1
* Byte 2: A[3:0]: Phase 1 period of 1~16 DCLKs
@@ -367,9 +373,9 @@
/* Set Frame Frequency
*
* This double byte command is used to set the number of DCLKs per row between
* the range of 0x14 and 0x7f. Then the Frame frequency of the matrix display
* is equal to DCLK frequency / A[6:0].
* This double byte command is used to set the number of DCLKs per row
* between the range of 0x14 and 0x7f. Then the Frame frequency of the
* matrix display is equal to DCLK frequency / A[6:0].
*
* Byte 1: 0xb2
* Byte 2: A[6:0]:Total number of DCLKs per row. Ranging from
@@ -383,7 +389,8 @@
* This double command is used to set the frequency of the internal display
* clocks, DCLK's. It is defined by dividing the oscillator frequency by the
* divide ratio (Value from 1 to 16). Frame frequency is determined by divide
* ratio, number of display clocks per row, MUX ratio and oscillator frequency.
* ratio, number of display clocks per row, MUX ratio and oscillator
* frequency.
* The lower nibble of the second byte is used to select the oscillator
* frequency. Please refer to Table 9-1 for detail breakdown levels of each
* step.
@@ -408,7 +415,8 @@
/* Look Up Table for Gray Scale Pulse width
*
* This command is used to set each individual gray scale level for the display.
* This command is used to set each individual gray scale level for the
* display.
* Except gray scale level GS0 that has no pre-charge and current drive, each
* gray scale level is programmed in the length of current drive stage pulse
* width with unit of DCLK. The longer the length of the pulse width, the
@@ -416,9 +424,10 @@
*
* The setting of gray scale table entry can perform gamma correction on OLED
* panel display. Normally, it is desired that the brightness response of the
* panel is linearly proportional to the image data value in display data RAM.
* However, the OLED panel is somehow responded in non-linear way. Appropriate
* gray scale table setting like example below can compensate this effect.
* panel is linearly proportional to the image data value in display data
* RAM. However, the OLED panel is somehow responded in non-linear way.
* Appropriate gray scale table setting like example below can compensate
* this effect.
*
* Byte 1: 0xb8
* Bytes 2-16: An[5:0], value for GSn level Pulse width
@@ -428,9 +437,9 @@
/* Set Second Pre-charge Period
*
* This double byte command is used to set the phase 3 second pre-charge period.
* The period of phase 3 can be programmed by command 0xbb and it is ranged from
* 0 to 15 DCLK's.
* This double byte command is used to set the phase 3 second pre-charge
* period. The period of phase 3 can be programmed by command 0xbb and it
* is ranged from 0 to 15 DCLK's.
*
* Byte 1: 0xbb
* Byte 2: 0-15 DCLKs
@@ -441,8 +450,8 @@
/* Set First Precharge voltage, VP
*
* This double byte command is used to set phase 2 first pre-charge voltage
* level. It can be programmed to set the first pre-charge voltage reference to
* VCC or VCOMH.
* level. It can be programmed to set the first pre-charge voltage reference
* to VCC or VCOMH.
*
* Byte 1: 0xbc
* Byte 2: A[5] == 0, Pre-charge voltage is (0.30 + A[4:0]) * Vcc
@@ -453,8 +462,8 @@
/* Set VCOMH
*
* This double byte command sets the high voltage level of common pins, VCOMH.
* The level of VCOMH is programmed with reference to VCC.
* This double byte command sets the high voltage level of common pins,
* VCOMH. The level of VCOMH is programmed with reference to VCC.
*
* Byte 1: 0xbe
* Byte 2: (0.51 + A[5:0]) * Vcc
@@ -494,13 +503,14 @@
****************************************************************************/
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
+70 -57
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/skeleton.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -37,14 +37,16 @@
#include "up_arch.h"
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Configuration ************************************************************/
/* Configuration **********************************************************************/
/* Verify that all configuration requirements have been met */
/* Debug ******************************************************************************/
/* Debug ********************************************************************/
/* Define the following to enable register-level debug output */
#undef CONFIG_LCD_SKELDEBUG
@@ -60,7 +62,7 @@
# undef CONFIG_LCD_SKELDEBUG
#endif
/* Color Properties *******************************************************************/
/* Color Properties *********************************************************/
/* Display Resolution */
@@ -72,7 +74,7 @@
#define SKEL_BPP 16
#define SKEL_COLORFMT FB_FMT_RGB16_565
/* Debug ******************************************************************************/
/* Debug ********************************************************************/
#ifdef CONFIG_LCD_SKELDEBUG
# define skelerr(format, ...) _err(format, ##__VA_ARGS__)
@@ -84,9 +86,9 @@
# define skelinfo(x...)
#endif
/**************************************************************************************
/****************************************************************************
* Private Type Definition
**************************************************************************************/
****************************************************************************/
/* This structure describes the state of this driver */
@@ -99,23 +101,26 @@ struct skel_dev_s
/* Private LCD-specific information follows */
};
/**************************************************************************************
/****************************************************************************
* Private Function Protototypes
**************************************************************************************/
****************************************************************************/
/* LCD Data Transfer Methods */
static int skel_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels);
static int skel_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
size_t npixels);
static int skel_putrun(fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer,
size_t npixels);
static int skel_getrun(fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels);
/* LCD Configuration */
static int skel_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo);
static int skel_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo);
FAR struct fb_videoinfo_s *vinfo);
static int skel_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo);
/* LCD RGB Mapping */
@@ -134,11 +139,12 @@ static int skel_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
static int skel_getpower(struct lcd_dev_s *dev);
static int skel_setpower(struct lcd_dev_s *dev, int power);
static int skel_getcontrast(struct lcd_dev_s *dev);
static int skel_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
static int skel_setcontrast(struct lcd_dev_s *dev,
unsigned int contrast);
/**************************************************************************************
/****************************************************************************
* Private Data
**************************************************************************************/
****************************************************************************/
/* This is working memory allocated by the LCD driver for each LCD device
* and for each color plane. This memory will hold one raster line of data.
@@ -185,6 +191,7 @@ static struct skel_dev_s g_lcddev =
.getplaneinfo = skel_getplaneinfo,
/* LCD RGB Mapping -- Not supported */
/* Cursor Controls -- Not supported */
/* LCD Specific Controls */
@@ -196,11 +203,11 @@ static struct skel_dev_s g_lcddev =
},
};
/**************************************************************************************
/****************************************************************************
* Private Functions
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Name: skel_putrun
*
* Description:
@@ -212,9 +219,10 @@ static struct skel_dev_s g_lcddev =
* npixels - The number of pixels to write to the LCD
* (range: 0 < npixels <= xres-col)
*
**************************************************************************************/
****************************************************************************/
static int skel_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
static int skel_putrun(fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer,
size_t npixels)
{
/* Buffer must be provided and aligned to a 16-bit address boundary */
@@ -229,7 +237,7 @@ static int skel_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_getrun
*
* Description:
@@ -241,7 +249,7 @@ static int skel_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer
* npixels - The number of pixels to read from the LCD
* (range: 0 < npixels <= xres-col)
*
**************************************************************************************/
****************************************************************************/
static int skel_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
size_t npixels)
@@ -255,34 +263,36 @@ static int skel_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
return -ENOSYS;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_getvideoinfo
*
* Description:
* Get information about the LCD video controller configuration.
*
**************************************************************************************/
****************************************************************************/
static int skel_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo)
{
DEBUGASSERT(dev && vinfo);
ginfo("fmt: %d xres: %d yres: %d nplanes: %d\n",
g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
g_videoinfo.fmt, g_videoinfo.xres,
g_videoinfo.yres, g_videoinfo.nplanes);
memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_getplaneinfo
*
* Description:
* Get information about the configuration of each LCD color plane.
*
**************************************************************************************/
****************************************************************************/
static int skel_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo)
static int skel_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo)
{
DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
@@ -290,14 +300,15 @@ static int skel_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_getpower
*
* Description:
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
* Get the LCD panel power status
* (0: full off - CONFIG_LCD_MAXPOWER: full on).
* On backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
****************************************************************************/
static int skel_getpower(struct lcd_dev_s *dev)
{
@@ -307,14 +318,15 @@ static int skel_getpower(struct lcd_dev_s *dev)
return 0;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_setpower
*
* Description:
* Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
* Enable/disable LCD panel power
* (0: full off - CONFIG_LCD_MAXPOWER: full on).
* On backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
****************************************************************************/
static int skel_setpower(struct lcd_dev_s *dev, int power)
{
@@ -329,13 +341,13 @@ static int skel_setpower(struct lcd_dev_s *dev, int power)
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_getcontrast
*
* Description:
* Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
*
**************************************************************************************/
****************************************************************************/
static int skel_getcontrast(struct lcd_dev_s *dev)
{
@@ -344,13 +356,13 @@ static int skel_getcontrast(struct lcd_dev_s *dev)
return -ENOSYS;
}
/**************************************************************************************
/****************************************************************************
* Name: skel_setcontrast
*
* Description:
* Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
*
**************************************************************************************/
****************************************************************************/
static int skel_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
{
@@ -359,19 +371,20 @@ static int skel_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
return -ENOSYS;
}
/**************************************************************************************
/****************************************************************************
* Public Functions
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Name: up_oledinitialize
*
* Description:
* Initialize the LCD video hardware. The initial state of the LCD is fully
* initialized, display memory cleared, and the LCD ready to use, but with the power
* setting at 0 (full off).
* Initialize the LCD video hardware.
* The initial state of the LCD is fully initialized, display memory
* cleared, and the LCD ready to use, but with the power setting at 0
* (full off).
*
**************************************************************************************/
****************************************************************************/
FAR struct lcd_dev_s *up_oledinitialize(FAR struct spi_dev_s *spi)
{
+250 -178
View File
File diff suppressed because it is too large Load Diff
+8 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/ssd1289.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
/* Definitions for the Solomon Systech SSD1289 LCD controller
*
@@ -26,17 +26,17 @@
#ifndef __DRIVERS_LCD_SSD1289_H
#define __DRIVERS_LCD_SSD1289_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_LCD_SSD1289
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* SSD1289 Register Addresses (All with DC=1) */
@@ -229,9 +229,11 @@
#define SSD1289_FCYCCTRL_EQ_SHIFT (8) /* Sets the equalizing period */
#define SSD1289_FCYCCTRL_EQ_MASK (3 << SSD1289_FCYCCTRL_EQ_SHIFT)
# define SSD1289_FCYCCTRL_EQ(n) (((n)-1) << SSD1289_FCYCCTRL_EQ_SHIFT) /* n = 2-8 clocks */
#define SSD1289_FCYCCTRL_SDT_SHIFT (12) /* Set delay amount from the gate output */
#define SSD1289_FCYCCTRL_SDT_MASK (3 << SSD1289_FCYCCTRL_SDT_SHIFT)
# define SSD1289_FCYCCTRL_SDT(n) ((n) << SSD1289_FCYCCTRL_SDT_SHIFT) /* n = 1-3 clocks */
#define SSD1289_FCYCCTRL_NO_SHIFT (14) /* Sets amount of non-overlap of the gate output */
#define SSD1289_FCYCCTRL_NO_MASK (3 << SSD1289_FCYCCTRL_NO_SHIFT)
# define SSD1289_FCYCCTRL_NO(n) ((n) << SSD1289_FCYCCTRL_NO_SHIFT) /* n = 1-3 clocks */
+12 -9
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/ssd1305.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
/* Definitions for the Solomon Systech SSD1305 132x64 Dot Matrix OLED/PLED
* Segment/Common Driver with C
@@ -30,13 +30,14 @@
#ifndef __DRIVERS_LCD_SSD1305_H
#define __DRIVERS_LCD_SSD1305_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* General Definitions ******************************************************/
#define SSD1305_COLORA 0
@@ -72,6 +73,7 @@
/* Data 2: Color A: 31-63 */
/* Data 3: Color B: 31-63 */
/* Data 4: Color C: 31-63 */
#define SSD1305_SETBANKCOLOR1 0x92 /* 0x92: Set bank 1-16 color */
# define SSD1305_SETBANK1(c) (c) /* Data 1, Bits 0-1: Bank 1 color */
# define SSD1305_SETBANK2(c) (c << 2) /* Data 1, Bits 2-3: Bank 2 color */
@@ -106,6 +108,7 @@
# define SSD1305_SETBANK30(c) (c << 2) /* Data 4, Bits 2-3: Bank 30 color */
# define SSD1305_SETBANK31(c) (c << 4) /* Data 4, Bits 4-5: Bank 31 color */
# define SSD1305_SETBANK32(c) (c << 6) /* Data 4, Bits 6-7: Bank 32 color */
#define SSD1305_MAPCOL0 0xa0 /* 0xa0: Column address 0 is mapped to SEG0 */
#define SSD1305_MAPCOL131 0xa1 /* 0xa1: Column address 131 is mapped to SEG0 */
#define SSD1305_DISPRAM 0xa4 /* 0xa4: Resume to RAM content display */
@@ -152,9 +155,9 @@
# define SSD1305_COMCONFIG_NOREMAP 0x02 /* Data 1, Bit 5: 0=Disable COM Left/Right remap */
# define SSD1305_COMCONFIG_REMAP 0x22 /* Data 1, Bit 5: 1=Enable COM Left/Right remap */
#define SSD1305_SETVCOMHDESEL 0xdb /* 0xdb: Set VCOMH delselect level */
# define SSD1305_VCOMH_x4p3 0x00 /* Data 1: ~0.43 x Vcc */
# define SSD1305_VCOMH_x7p7 0x34 /* Data 1: ~0.77 x Vcc */
# define SSD1305_VCOMH_x8p3 0x3c /* Data 1: ~0.83 x Vcc */
# define SSD1305_VCOMH_X4P3 0x00 /* Data 1: ~0.43 x Vcc */
# define SSD1305_VCOMH_X7P7 0x34 /* Data 1: ~0.77 x Vcc */
# define SSD1305_VCOMH_X8P3 0x3c /* Data 1: ~0.83 x Vcc */
#define SSD1305_ENTER_RMWMODE 0xe0 /* 0xe0: Enter the Read Modify Write mode */
#define SSD1305_NOP 0xe3 /* 0xe3: NOP Command for no operation */
#define SSD1305_EXIT_RMWMODE 0xee /* 0xee: Leave the Read Modify Write mode */
+86 -76
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/st7565.c
*
* Definitions for the ST7565 128x64 Dot Matrix LCD Driver with C
@@ -45,11 +45,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -67,11 +67,11 @@
#include "st7565.h"
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Configuration **********************************************************************/
/* Configuration ************************************************************/
/* ST7565 Configuration Settings:
*
@@ -83,7 +83,8 @@
*
* Required LCD driver settings:
* CONFIG_LCD_ST7565 - Enable ST7565 support
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be
* accepted.
*
*/
@@ -128,10 +129,9 @@
# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255"
#endif
/* Color Properties *******************************************************************/
/* Color Properties *********************************************************/
/* The ST7565 display controller can handle a resolution of 128x64.
*/
/* The ST7565 display controller can handle a resolution of 128x64. */
/* Display Resolution */
@@ -155,9 +155,9 @@
/* Bytes per logical row andactual device row */
#define ST7565_XSTRIDE (ST7565_XRES >> 3) /* Pixels arrange "horizontally
* for user" */
* for 'user' */
#define ST7565_YSTRIDE (ST7565_YRES >> 3) /* But actual device
* arrangement is "vertical" */
* arrangement is 'vertical' */
/* The size of the shadow frame buffer */
@@ -168,9 +168,9 @@
#define LS_BIT (1 << 0)
#define MS_BIT (1 << 7)
/**************************************************************************************
/****************************************************************************
* Private Type Definition
**************************************************************************************/
****************************************************************************/
/* This structure describes the state of this driver */
@@ -196,9 +196,9 @@ struct st7565_dev_s
uint8_t fb[ST7565_FBSIZE];
};
/**************************************************************************************
/****************************************************************************
* Private Function Prototypes
**************************************************************************************/
****************************************************************************/
/* Drivers helpers */
@@ -218,14 +218,16 @@ static inline int st7565_backlight(FAR struct st7565_dev_s *priv, int level);
static int st7565_putrun(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels);
static int st7565_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer,
static int st7565_getrun(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer,
size_t npixels);
/* LCD Configuration */
static int st7565_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo);
static int st7565_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
static int st7565_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo);
/* LCD RGB Mapping */
@@ -245,15 +247,16 @@ static int st7565_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
static int st7565_getpower(struct lcd_dev_s *dev);
static int st7565_setpower(struct lcd_dev_s *dev, int power);
static int st7565_getcontrast(struct lcd_dev_s *dev);
static int st7565_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
static int st7565_setcontrast(struct lcd_dev_s *dev,
unsigned int contrast);
/* Initialization */
static inline void up_clear(FAR struct st7565_dev_s *priv);
/**************************************************************************************
/****************************************************************************
* Private Data
**************************************************************************************/
****************************************************************************/
/* This is working memory allocated by the LCD driver for each LCD device
* and for each color plane. This memory will hold one raster line of data.
@@ -312,11 +315,11 @@ static struct st7565_dev_s g_st7565dev =
},
};
/**************************************************************************************
/****************************************************************************
* Private Functions
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Name: st7565_reset
*
* Description:
@@ -324,7 +327,7 @@ static struct st7565_dev_s g_st7565dev =
*
* priv - A reference to the driver specific structure
*
**************************************************************************************/
****************************************************************************/
static inline void st7565_reset(FAR struct st7565_dev_s *priv, bool on)
{
@@ -334,7 +337,7 @@ static inline void st7565_reset(FAR struct st7565_dev_s *priv, bool on)
}
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_select
*
* Description:
@@ -342,14 +345,14 @@ static inline void st7565_reset(FAR struct st7565_dev_s *priv, bool on)
*
* priv - A reference to the driver specific structure
*
**************************************************************************************/
****************************************************************************/
static inline void st7565_select(FAR struct st7565_dev_s *priv)
{
priv->lcd->select(priv->lcd);
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_deselect
*
* Description:
@@ -357,14 +360,14 @@ static inline void st7565_select(FAR struct st7565_dev_s *priv)
*
* priv - A reference to the driver specific structure
*
**************************************************************************************/
****************************************************************************/
static inline void st7565_deselect(FAR struct st7565_dev_s *priv)
{
priv->lcd->deselect(priv->lcd);
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_cmddata
*
* Description:
@@ -373,14 +376,14 @@ static inline void st7565_deselect(FAR struct st7565_dev_s *priv)
* priv - A reference to the driver specific structure.
* cmd - If true command mode will be selected.
*
**************************************************************************************/
****************************************************************************/
static inline void st7565_cmddata(FAR struct st7565_dev_s *priv, bool cmd)
{
priv->lcd->cmddata(priv->lcd, cmd);
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_send_one_data
*
* Description:
@@ -389,7 +392,7 @@ static inline void st7565_cmddata(FAR struct st7565_dev_s *priv, bool cmd)
* priv - A reference to the driver specific structure.
* data - Byte to send as data to LCD driver.
*
**************************************************************************************/
****************************************************************************/
static inline int st7565_send_one_data(FAR struct st7565_dev_s *priv,
uint8_t data)
@@ -397,7 +400,7 @@ static inline int st7565_send_one_data(FAR struct st7565_dev_s *priv,
return priv->lcd->senddata(priv->lcd, &data, 1);
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_send_data_buf
*
* Description:
@@ -407,7 +410,7 @@ static inline int st7565_send_one_data(FAR struct st7565_dev_s *priv,
* buf - Buffer sent as data to LCD driver.
* size - Size of buffer in bytes.
*
**************************************************************************************/
****************************************************************************/
static inline int st7565_send_data_buf(FAR struct st7565_dev_s *priv,
FAR const uint8_t * buf, int size)
@@ -415,7 +418,7 @@ static inline int st7565_send_data_buf(FAR struct st7565_dev_s *priv,
return priv->lcd->senddata(priv->lcd, buf, size);
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_backlight
*
* Description:
@@ -424,14 +427,14 @@ static inline int st7565_send_data_buf(FAR struct st7565_dev_s *priv,
* priv - A reference to the driver specific structure.
* level - Set backlight pwm from 0 CONFIG_LCD_MAXPOWER-1.
*
**************************************************************************************/
****************************************************************************/
static inline int st7565_backlight(FAR struct st7565_dev_s *priv, int level)
{
return priv->lcd->backlight(priv->lcd, level);
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_putrun
*
* Description:
@@ -443,7 +446,7 @@ static inline int st7565_backlight(FAR struct st7565_dev_s *priv, int level)
* npixels - The number of pixels to write to the LCD
* (range: 0 < npixels <= xres-col)
*
**************************************************************************************/
****************************************************************************/
static int st7565_putrun(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels)
@@ -479,14 +482,15 @@ static int st7565_putrun(fb_coord_t row, fb_coord_t col,
return OK;
}
/* Get the page number. The range of 64 lines is divided up into eight pages
* of 8 lines each.
/* Get the page number.
* The range of 64 lines is divided up into eight pages of 8 lines each.
*/
page = row >> 3;
/* Update the shadow frame buffer memory. First determine the pixel position
* in the frame buffer memory. Pixels are organized like this:
/* Update the shadow frame buffer memory.
* First determine the pixel position in the frame buffer memory.
* Pixels are organized like this:
*
* --------+---+---+---+---+-...-+-----+
* Segment | 0 | 1 | 2 | 3 | ... | 131 |
@@ -582,7 +586,7 @@ static int st7565_putrun(fb_coord_t row, fb_coord_t col,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_getrun
*
* TODO implement read function that possible in 8080bus
@@ -596,9 +600,10 @@ static int st7565_putrun(fb_coord_t row, fb_coord_t col,
* npixels - The number of pixels to read from the LCD
* (range: 0 < npixels <= xres-col)
*
**************************************************************************************/
****************************************************************************/
static int st7565_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer,
static int st7565_getrun(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer,
size_t npixels)
{
/* Because of this line of code, we will only be able to support a single
@@ -633,14 +638,15 @@ static int st7565_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer,
/* Then transfer the display data from the shadow frame buffer memory */
/* Get the page number. The range of 64 lines is divided up into eight pages
* of 8 lines each.
/* Get the page number.
* The range of 64 lines is divided up into eight pages of 8 lines each.
*/
page = row >> 3;
/* Update the shadow frame buffer memory. First determine the pixel position
* in the frame buffer memory. Pixels are organized like this:
/* Update the shadow frame buffer memory.
* First determine the pixel position in the frame buffer memory.
* Pixels are organized like this:
*
* --------+---+---+---+---+-...-+-----+
* Segment | 0 | 1 | 2 | 3 | ... | 131 |
@@ -679,8 +685,9 @@ static int st7565_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer,
*buffer |= usrmask;
}
/* Inc/Decrement to the next destination pixel. Hmmmm. It looks like this
* logic could write past the end of the user buffer. Revisit this!
/* Inc/Decrement to the next destination pixel.
* Hmmmm. It looks like this logic could write past the end of the
* user buffer. Revisit this!
*/
#ifdef CONFIG_LCD_PACKEDMSFIRST
@@ -711,13 +718,13 @@ static int st7565_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_getvideoinfo
*
* Description:
* Get information about the LCD video controller configuration.
*
**************************************************************************************/
****************************************************************************/
static int st7565_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo)
@@ -730,15 +737,16 @@ static int st7565_getvideoinfo(FAR struct lcd_dev_s *dev,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_getplaneinfo
*
* Description:
* Get information about the configuration of each LCD color plane.
*
**************************************************************************************/
****************************************************************************/
static int st7565_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
static int st7565_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo)
{
DEBUGASSERT(dev && pinfo && planeno == 0);
@@ -747,14 +755,15 @@ static int st7565_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_getpower
*
* Description:
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
* Get the LCD panel power status
* (0: full off - CONFIG_LCD_MAXPOWER: full on).
* On backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
****************************************************************************/
static int st7565_getpower(struct lcd_dev_s *dev)
{
@@ -764,14 +773,15 @@ static int st7565_getpower(struct lcd_dev_s *dev)
return priv->power_level;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_setpower
*
* Description:
* Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlight LCDs, this setting may correspond to the backlight setting.
* Enable/disable LCD panel power
* (0: full off - CONFIG_LCD_MAXPOWER: full on).
* On backlight LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
****************************************************************************/
static int st7565_setpower(struct lcd_dev_s *dev, int power)
{
@@ -819,13 +829,13 @@ static int st7565_setpower(struct lcd_dev_s *dev, int power)
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_getcontrast
*
* Description:
* Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
*
**************************************************************************************/
****************************************************************************/
static int st7565_getcontrast(struct lcd_dev_s *dev)
{
@@ -834,13 +844,13 @@ static int st7565_getcontrast(struct lcd_dev_s *dev)
return (int)priv->contrast;
}
/**************************************************************************************
/****************************************************************************
* Name: st7565_setcontrast
*
* Description:
* Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
*
**************************************************************************************/
****************************************************************************/
static int st7565_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
{
@@ -878,13 +888,13 @@ static int st7565_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: up_clear
*
* Description:
* Clear the display.
*
**************************************************************************************/
****************************************************************************/
static inline void up_clear(FAR struct st7565_dev_s *priv)
{
@@ -928,11 +938,11 @@ static inline void up_clear(FAR struct st7565_dev_s *priv)
st7565_deselect(priv);
}
/**************************************************************************************
/****************************************************************************
* Public Functions
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Name: st7565_initialize
*
* Description:
@@ -952,7 +962,7 @@ static inline void up_clear(FAR struct st7565_dev_s *priv)
* for the specified
* OLED. NULL is returned on any failure.
*
**************************************************************************************/
****************************************************************************/
FAR struct lcd_dev_s *st7565_initialize(FAR struct st7565_lcd_s *lcd,
unsigned int devno)
+18 -16
View File
@@ -1,9 +1,6 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/st7565.h
*
* Definitions for the ST7565 128x64 Dot Matrix LCD
* Driver with C
*
* Copyright (C) 2014 Pierre-noel Bouteville. All rights reserved.
* Author: Pierre-noel Boutevlle <pnb990@gmail.com>
*
@@ -16,10 +13,6 @@
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: SSD1305.pdf, "Solomon Systech SSD1305 136x64 Dot Matrix OLED/PLED
* Segment/Common Driver with Controller," Solomon Systech Limited,
* http://www.solomon-systech.com, May, 2008.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -47,20 +40,29 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
****************************************************************************/
/* Definitions for the ST7565 128x64 Dot Matrix LCD
* Driver with C
*
* References:
* SSD1305.pdf, "Solomon Systech SSD1305 136x64 Dot Matrix OLED/PLED
* Segment/Common Driver with Controller," Solomon Systech Limited,
* http://www.solomon-systech.com, May, 2008.
*/
#ifndef __DRIVERS_LCD_ST7565_H
#define __DRIVERS_LCD_ST7565_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Fundamental Commands ***************************************************************/
/* Fundamental Commands *****************************************************/
#define ST7565_DISPOFF 0xae /* 0xae: Display OFF (sleep mode) */
#define ST7565_DISPON 0xaf /* 0xaf: Display ON in normal mode */
@@ -139,8 +141,8 @@
#define ST7565_NOP 0xe3 /* 0xe3: NOP Command for no operation */
/**************************************************************************************
/****************************************************************************
* Public Data
**************************************************************************************/
****************************************************************************/
#endif /* __DRIVERS_LCD_ST7565_H */
+86 -72
View File
@@ -1,9 +1,6 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/st7567.c
*
* Driver for the TM12864J1CCWGWA Display with the ST7567 LCD
* controller.
*
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
* Author: Manikandan <code@zilogic.com>
*
@@ -12,9 +9,6 @@
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Reference: "Product Specification, OEL Display Module, ST7567", Univision
* Technology Inc., SAS1-6020-B, January 3, 2008.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -42,11 +36,19 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/* Driver for the TM12864J1CCWGWA Display with the ST7567 LCD
* controller.
*
* Reference:
* "Product Specification, OEL Display Module, ST7567", Univision
* Technology Inc., SAS1-6020-B, January 3, 2008.
*/
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -64,11 +66,11 @@
#include "st7567.h"
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Configuration **********************************************************************/
/* Configuration ************************************************************/
/* ST7567 Configuration Settings:
*
@@ -85,7 +87,8 @@
*
* Required LCD driver settings:
* CONFIG_LCD_ST7567 - Enable ST7567 support
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be
* accepted.
* CONFIG_LCD_MAXPOWER should be 2: 0=off, 1=dim, 2=normal
*
* Required SPI driver settings:
@@ -94,8 +97,8 @@
/* Verify that all configuration requirements have been met */
/* The ST7567 spec says that is supports SPI mode 0,0 only. However, sometimes
* you need to tinker with these things.
/* The ST7567 spec says that is supports SPI mode 0,0 only.
* However, sometimes you need to tinker with these things.
*/
#ifndef CONFIG_ST7567_SPIMODE
@@ -165,7 +168,7 @@
# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration"
#endif
/* Color Properties *******************************************************************/
/* Color Properties *********************************************************/
/* The ST7567 display controller can handle a resolution of 128x64.
*/
@@ -203,9 +206,9 @@
#define LS_BIT (1 << 0)
#define MS_BIT (1 << 7)
/**************************************************************************************
/****************************************************************************
* Private Type Definition
**************************************************************************************/
****************************************************************************/
/* This structure describes the state of this driver */
@@ -229,9 +232,9 @@ struct st7567_dev_s
uint8_t fb[ST7567_FBSIZE];
};
/**************************************************************************************
/****************************************************************************
* Private Function Protototypes
**************************************************************************************/
****************************************************************************/
/* SPI helpers */
@@ -240,17 +243,20 @@ static void st7567_deselect(FAR struct spi_dev_s *spi);
/* LCD Data Transfer Methods */
static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels);
static int st7567_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
size_t npixels);
static int st7567_putrun(fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer,
size_t npixels);
static int st7567_getrun(fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels);
/* LCD Configuration */
static int st7567_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo);
static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo);
FAR struct fb_videoinfo_s *vinfo);
static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo);
/* LCD RGB Mapping */
@@ -269,15 +275,16 @@ static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
static int st7567_getpower(struct lcd_dev_s *dev);
static int st7567_setpower(struct lcd_dev_s *dev, int power);
static int st7567_getcontrast(struct lcd_dev_s *dev);
static int st7567_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
static int st7567_setcontrast(struct lcd_dev_s *dev,
unsigned int contrast);
/* Initialization */
static inline void up_clear(FAR struct st7567_dev_s *priv);
/**************************************************************************************
/****************************************************************************
* Private Data
**************************************************************************************/
****************************************************************************/
/* This is working memory allocated by the LCD driver for each LCD device
* and for each color plane. This memory will hold one raster line of data.
@@ -336,11 +343,11 @@ static struct st7567_dev_s g_st7567dev =
},
};
/**************************************************************************************
/****************************************************************************
* Private Functions
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Name: st7567_select
*
* Description:
@@ -354,7 +361,7 @@ static struct st7567_dev_s g_st7567dev =
*
* Assumptions:
*
**************************************************************************************/
****************************************************************************/
static void st7567_select(FAR struct spi_dev_s *spi)
{
@@ -377,7 +384,7 @@ static void st7567_select(FAR struct spi_dev_s *spi)
#endif
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_deselect
*
* Description:
@@ -391,7 +398,7 @@ static void st7567_select(FAR struct spi_dev_s *spi)
*
* Assumptions:
*
**************************************************************************************/
****************************************************************************/
static void st7567_deselect(FAR struct spi_dev_s *spi)
{
@@ -401,7 +408,7 @@ static void st7567_deselect(FAR struct spi_dev_s *spi)
SPI_LOCK(spi, false);
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_putrun
*
* Description:
@@ -413,10 +420,11 @@ static void st7567_deselect(FAR struct spi_dev_s *spi)
* npixels - The number of pixels to write to the LCD
* (range: 0 < npixels <= xres-col)
*
**************************************************************************************/
****************************************************************************/
static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels)
static int st7567_putrun(fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer,
size_t npixels)
{
/* Because of this line of code, we will only be able to support a single
* ST7567 device
@@ -552,7 +560,7 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buff
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_getrun
*
* Description:
@@ -564,7 +572,7 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buff
* npixels - The number of pixels to read from the LCD
* (range: 0 < npixels <= xres-col)
*
**************************************************************************************/
****************************************************************************/
static int st7567_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
size_t npixels)
@@ -681,34 +689,36 @@ static int st7567_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_getvideoinfo
*
* Description:
* Get information about the LCD video controller configuration.
*
**************************************************************************************/
****************************************************************************/
static int st7567_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo)
{
DEBUGASSERT(dev && vinfo);
ginfo("fmt: %d xres: %d yres: %d nplanes: %d\n",
g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
g_videoinfo.fmt, g_videoinfo.xres,
g_videoinfo.yres, g_videoinfo.nplanes);
memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_getplaneinfo
*
* Description:
* Get information about the configuration of each LCD color plane.
*
**************************************************************************************/
****************************************************************************/
static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo)
static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo)
{
DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
@@ -716,14 +726,15 @@ static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_getpower
*
* Description:
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
* Get the LCD panel power status
* (0: full off - CONFIG_LCD_MAXPOWER: full on).
* On backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
****************************************************************************/
static int st7567_getpower(struct lcd_dev_s *dev)
{
@@ -733,14 +744,15 @@ static int st7567_getpower(struct lcd_dev_s *dev)
return priv->powered;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_setpower
*
* Description:
* Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
* Enable/disable LCD panel power
* (0: full off - CONFIG_LCD_MAXPOWER: full on).
* On backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
****************************************************************************/
static int st7567_setpower(struct lcd_dev_s *dev, int power)
{
@@ -772,13 +784,13 @@ static int st7567_setpower(struct lcd_dev_s *dev, int power)
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_getcontrast
*
* Description:
* Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
*
**************************************************************************************/
****************************************************************************/
static int st7567_getcontrast(struct lcd_dev_s *dev)
{
@@ -787,13 +799,13 @@ static int st7567_getcontrast(struct lcd_dev_s *dev)
return (int)priv->contrast;
}
/**************************************************************************************
/****************************************************************************
* Name: st7567_setcontrast
*
* Description:
* Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
*
**************************************************************************************/
****************************************************************************/
static int st7567_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
{
@@ -827,13 +839,13 @@ static int st7567_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
return OK;
}
/**************************************************************************************
/****************************************************************************
* Name: up_clear
*
* Description:
* Clear the display.
*
**************************************************************************************/
****************************************************************************/
static inline void up_clear(FAR struct st7567_dev_s *priv)
{
@@ -877,11 +889,11 @@ static inline void up_clear(FAR struct st7567_dev_s *priv)
st7567_deselect(spi);
}
/**************************************************************************************
/****************************************************************************
* Public Functions
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Name: st7567_initialize
*
* Description:
@@ -892,17 +904,19 @@ static inline void up_clear(FAR struct st7567_dev_s *priv)
* Input Parameters:
*
* spi - A reference to the SPI driver instance.
* devno - A value in the range of 0 throst7567h CONFIG_ST7567_NINTERFACES-1.
* devno - A value in the range of 0 throst7567h
* CONFIG_ST7567_NINTERFACES-1.
* This allows support for multiple OLED devices.
*
* Returned Value:
*
* On success, this function returns a reference to the LCD object for the specified
* OLED. NULL is returned on any failure.
* On success, this function returns a reference to the LCD object for the
* specified OLED. NULL is returned on any failure.
*
**************************************************************************************/
****************************************************************************/
FAR struct lcd_dev_s *st7567_initialize(FAR struct spi_dev_s *spi, unsigned int devno)
FAR struct lcd_dev_s *st7567_initialize(FAR struct spi_dev_s *spi,
unsigned int devno)
{
/* Configure and enable LCD */
+15 -13
View File
@@ -1,9 +1,6 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/st7567.h
*
* Definitions for the ST7567 128x64 Dot Matrix LCD
* Driver with C
*
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
* Author: Manikandan <code@zilogic.com>
*
@@ -12,10 +9,6 @@
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: SSD1305.pdf, "Solomon Systech SSD1305 136x64 Dot Matrix OLED/PLED
* Segment/Common Driver with Controller," Solomon Systech Limited,
* http://www.solomon-systech.com, May, 2008.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -43,18 +36,27 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
****************************************************************************/
/* Definitions for the ST7567 128x64 Dot Matrix LCD
* Driver with C
*
* References:
* SSD1305.pdf, "Solomon Systech SSD1305 136x64 Dot Matrix OLED/PLED
* Segment/Common Driver with Controller," Solomon Systech Limited,
* http://www.solomon-systech.com, May, 2008.
*/
#ifndef __DRIVERS_LCD_ST7567_H
#define __DRIVERS_LCD_ST7567_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
/* Fundamental Commands *****************************************************/
+6 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/st7735.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,18 +16,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_LCD_ST7735_H
#define __DRIVERS_LCD_ST7735_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
#define ST7735_NOP 0x00 /* No Operation */
#define ST7735_SWRESET 0x01 /* Software Reset */
+6 -6
View File
@@ -1,4 +1,4 @@
/**************************************************************************************
/****************************************************************************
* drivers/lcd/st7789.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,18 +16,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*
**************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_LCD_ST7789_H
#define __DRIVERS_LCD_ST7789_H
/**************************************************************************************
/****************************************************************************
* Included Files
**************************************************************************************/
****************************************************************************/
/**************************************************************************************
/****************************************************************************
* Pre-processor Definitions
**************************************************************************************/
****************************************************************************/
#define ST7789_NOP 0x00 /* No Operation */
#define ST7789_SWRESET 0x01 /* Software Reset */
+22 -17
View File
@@ -1,4 +1,4 @@
/******************************************************************************************************
/****************************************************************************
* drivers/lcd/tda19988.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,24 +16,26 @@
* License for the specific language governing permissions and limitations
* under the License.
*
******************************************************************************************************/
****************************************************************************/
/* Definitions for the TDA19988. The TDA19988 is a very low power and very small
* size High-Definition Multimedia Interface (HDMI) 1.4a transmitter
*
/* Definitions for the TDA19988.
* The TDA19988 is a very low power and very small size
* High-Definition Multimedia Interface (HDMI) 1.4a transmitter
*/
#ifndef __DRIVERS_LCD_TDA19988_H
#define __DRIVERS_LCD_TDA19988_H
/******************************************************************************************************
/****************************************************************************
* Included Files
******************************************************************************************************/
****************************************************************************/
/******************************************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************************************/
****************************************************************************/
/* CEC Registers ************************************************************/
/* CEC Registers **************************************************************************************/
/* The device has two I2C interfaces CEC (0x34) and HDMI (0x70). */
#define CEC_FRO_IM_CLK_CTRL_REG 0xfb
@@ -48,10 +50,11 @@
# define CEC_ENAMODS_RXSENS (1 << 2)
# define CEC_ENABLE_ALL 0x87
/* HDMI Memory Pages **********************************************************************************/
/* HDMI Memory is accessed via page and address. The page must first be selected, then
* only the address is sent in order accessing memory locations within the selected
* page.
/* HDMI Memory Pages ********************************************************/
/* HDMI Memory is accessed via page and address.
* The page must first be selected, then only the address is sent in order
* accessing memory locations within the selected page.
*/
#define HDMI_CTRL_PAGE 0x00 /* General control page */
@@ -62,8 +65,8 @@
#define HDMI_HDCPOTP_PAGE 0x12 /* HDCP (TDA19988AHN and TDA19988AET only) and OTP */
#define HDMI_GAMUT_PAGE 0x13 /* Gamut-related metadata packets page */
/* The page select register does not lie within the above pages. The value of 0xff is
* used for this access.
/* The page select register does not lie within the above pages.
* The value of 0xff is used for this access.
*/
#define HDMI_NO_PAGE 0xff
@@ -262,7 +265,9 @@
#define HDMI_INFO_AUD MKREG(HDMI_INFO_PAGE, 0x80)
#define HDMI_INFO_MPS MKREG(HDMI_INFO_PAGE, 0xa0)
/* Audio settings and content info packets page Registers and Bit Definitions */
/* Audio settings and content info packets page Registers and Bit
* Definitions
*/
#define HDMI_AUDIO_ENC_CTRL_REG MKREG(HDMI_AUDIO_PAGE, 0x0d)
# define HDMI_AUDIO_ENC_CNTRL_DVI_MODE (0 << 2)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -60,7 +60,7 @@
****************************************************************************/
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
#undef EXTERN
+7 -6
View File
@@ -76,7 +76,7 @@
#define MMCSD_CSD_CCC(csd) ((csd[2] >> 4) & 0x0fff)
/* READ_BL_LEN 80-83 = Max. read data block length */
/* READ_BL_LEN 80-83 = Max. read data block length */
#define MMCSD_CSD_READBLLEN(csd) (csd[2] & 0x0f)
@@ -132,7 +132,7 @@
#define MMC_CSD_SECTORSIZE(csd) ((csd[5] >> 10) & 0x1f)
/* ER_GRP_SIZE 37-41 = Erase group size (MMC)*/
/* ER_GRP_SIZE 37-41 = Erase group size (MMC) */
#define MMC_CSD_ERGRPSIZE(csd) ((csd[5] >> 5) & 0x1f)
@@ -240,7 +240,7 @@
#define MMCSD_CSD_CCC(csd) (((uint16_t)csd[4] << 4) | ((uint16_t)csd[5] >> 4))
#define SD20_CSD_CCC(csd) MMCSD_CSD_CCC(csd)
/* READ_BL_LEN 80-83 = Max. read data block length */
/* READ_BL_LEN 80-83 = Max. read data block length */
#define MMCSD_CSD_READBLLEN(csd) (csd[5] & 0x0f)
#define SD20_CSD_READBLLEN(csd) (9)
@@ -309,7 +309,7 @@
#define MMC_CSD_SECTORSIZE(csd) ((csd[10] >> 2) & 0x1f)
/* ER_GRP_SIZE 37-41 = Erase group size (MMC)*/
/* ER_GRP_SIZE 37-41 = Erase group size (MMC) */
#define MMC_CSD_ERGRPSIZE(csd) (((csd[10] & 3) << 3) | (csd[11] > 5))
@@ -391,13 +391,14 @@
****************************************************************************/
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
+12 -5
View File
@@ -91,9 +91,11 @@ void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype)
sd2 ? SD20_CSD_NSAC(csd) : MMCSD_CSD_NSAC(csd));
finfo(" TRAN_SPEED:\n");
finfo(" TIME_VALUE: 0x%02x\n",
sd2 ? SD20_CSD_TRANSPEED_TIMEVALUE(csd) : MMCSD_CSD_TRANSPEED_TIMEVALUE(csd));
sd2 ? SD20_CSD_TRANSPEED_TIMEVALUE(csd) :
MMCSD_CSD_TRANSPEED_TIMEVALUE(csd));
finfo(" RATE_UNIT: 0x%02x\n",
sd2 ? SD20_CSD_TRANSPEED_TRANSFERRATEUNIT(csd) : MMCSD_CSD_TRANSPEED_TRANSFERRATEUNIT(csd));
sd2 ? SD20_CSD_TRANSPEED_TRANSFERRATEUNIT(csd) :
MMCSD_CSD_TRANSPEED_TRANSFERRATEUNIT(csd));
finfo(" CCC: 0x%03x\n",
sd2 ? SD20_CSD_CCC(csd) : MMCSD_CSD_CCC(csd));
finfo(" READ_BL_LEN: %d\n",
@@ -101,9 +103,11 @@ void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype)
finfo(" READ_BL_PARTIAL: %d\n",
sd2 ? SD20_CSD_READBLPARTIAL(csd) : MMCSD_CSD_READBLPARTIAL(csd));
finfo(" WRITE_BLK_MISALIGN: %d\n",
sd2 ? SD20_CSD_WRITEBLKMISALIGN(csd) : MMCSD_CSD_WRITEBLKMISALIGN(csd));
sd2 ? SD20_CSD_WRITEBLKMISALIGN(csd) :
MMCSD_CSD_WRITEBLKMISALIGN(csd));
finfo(" READ_BLK_MISALIGN: %d\n",
sd2 ? SD20_CSD_READBLKMISALIGN(csd) : MMCSD_CSD_READBLKMISALIGN(csd));
sd2 ? SD20_CSD_READBLKMISALIGN(csd) :
MMCSD_CSD_READBLKMISALIGN(csd));
finfo(" DSR_IMP: %d\n",
sd2 ? SD20_CSD_DSRIMP(csd) : MMCSD_CSD_DSRIMP(csd));
finfo(" C_SIZE: %d\n",
@@ -134,6 +138,7 @@ void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype)
finfo(" SD WP_GRP_SIZE: %d\n",
sd2 ? SD_CSD_WPGRPSIZE(csd) : SD_CSD_WPGRPSIZE(csd));
}
finfo(" WP_GRP_EN: %d\n",
sd2 ? SD20_WPGRPEN(csd) : MMCSD_WPGRPEN(csd));
finfo(" R2W_FACTOR: %d\n",
@@ -147,7 +152,8 @@ void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype)
finfo(" COPY: %d\n",
sd2 ? SD20_CSD_COPY(csd) : MMCSD_CSD_COPY(csd));
finfo(" PERM_WRITE_PROTECT: %d\n",
sd2 ? SD20_CSD_PERMWRITEPROTECT(csd) : MMCSD_CSD_PERMWRITEPROTECT(csd));
sd2 ? SD20_CSD_PERMWRITEPROTECT(csd) :
MMCSD_CSD_PERMWRITEPROTECT(csd));
finfo(" TMP_WRITE_PROTECT: %d\n",
sd2 ?SD20_CSD_TMPWRITEPROTECT(csd) : MMCSD_CSD_TMPWRITEPROTECT(csd));
finfo(" FILE_FORMAT: %d\n",
@@ -157,6 +163,7 @@ void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype)
finfo(" MMC ECC: %d\n",
sd2 ? MMC_CSD_ECC(csd) : MMC_CSD_ECC(csd));
}
finfo(" CRC: %02x\n",
sd2 ? SD20_CSD_CRC(csd) : MMCSD_CSD_CRC(csd));
}
+31 -18
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/mmcsd/mmcsd_sdio.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,21 +16,21 @@
* License for the specific language governing permissions and limitations
* under the License.
*
********************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_MMCSD_MMCSD_SDIO_H
#define __DRIVERS_MMCSD_MMCSD_SDIO_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* CMD8 Argument:
* [31:12]: Reserved (shall be set to '0')
@@ -42,6 +42,7 @@
#define MMCSD_CMD8VOLTAGE_SHIFT (8) /* Bits 8-11: Supply voltage */
#define MMCSD_CMD8VOLTAGE_MASK ((uint32_t)0x0f << MMCSD_CMD8VOLTAGE_SHIFT)
# define MMCSD_CMD8VOLTAGE_27 ((uint32_t)0x01 << MMCSD_CMD8VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_CMD8ECHO_SHIFT (0) /* Bits 0-7: Check pattern */
#define MMCSD_CMD8ECHO_MASK ((uint32_t)0xff << MMCSD_CMD8ECHO_SHIFT)
# define MMCSD_CMD8CHECKPATTERN ((uint32_t)0xaa << MMCSD_CMD8ECHO_SHIFT)
@@ -87,17 +88,22 @@
#define MMCSD_R1_ERASERESET ((uint32_t)1 << 13) /* Reset sequence cleared */
#define MMCSD_R1_STATE_SHIFT (9) /* Current card state */
#define MMCSD_R1_STATE_MASK ((uint32_t)15 << MMCSD_R1_STATE_SHIFT)
/* Card identification mode states */
/* Card identification mode states */
# define MMCSD_R1_STATE_IDLE ((uint32_t)0 << MMCSD_R1_STATE_SHIFT) /* 0=Idle state */
# define MMCSD_R1_STATE_READY ((uint32_t)1 << MMCSD_R1_STATE_SHIFT) /* 1=Ready state */
# define MMCSD_R1_STATE_IDENT ((uint32_t)2 << MMCSD_R1_STATE_SHIFT) /* 2=Identification state */
/* Data transfer states */
/* Data transfer states */
# define MMCSD_R1_STATE_STBY ((uint32_t)3 << MMCSD_R1_STATE_SHIFT) /* 3=Standby state */
# define MMCSD_R1_STATE_TRAN ((uint32_t)4 << MMCSD_R1_STATE_SHIFT) /* 4=Transfer state */
# define MMCSD_R1_STATE_DATA ((uint32_t)5 << MMCSD_R1_STATE_SHIFT) /* 5=Sending data state */
# define MMCSD_R1_STATE_RCV ((uint32_t)6 << MMCSD_R1_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R1_STATE_PRG ((uint32_t)7 << MMCSD_R1_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R1_STATE_DIS ((uint32_t)8 << MMCSD_R1_STATE_SHIFT) /* 8=Disconnect state */
#define MMCSD_R1_READYFORDATA ((uint32_t)1 << 8) /* Buffer empty */
#define MMCSD_R1_APPCMD ((uint32_t)1 << 5) /* Next CMD is ACMD */
#define MMCSD_R1_AKESEQERROR ((uint32_t)1 << 3) /* Authentication error */
@@ -146,17 +152,22 @@
#define MMCSD_R6_ERROR ((uint32_t)1 << 13) /* General error */
#define MMCSD_R6_STATE_SHIFT (9) /* Current card state */
#define MMCSD_R6_STATE_MASK ((uint32_t)15 << MMCSD_R6_STATE_SHIFT)
/* Card identification mode states */
/* Card identification mode states */
# define MMCSD_R6_STATE_IDLE ((uint32_t)0 << MMCSD_R6_STATE_SHIFT) /* 0=Idle state */
# define MMCSD_R6_STATE_READY ((uint32_t)1 << MMCSD_R6_STATE_SHIFT) /* 1=Ready state */
# define MMCSD_R6_STATE_IDENT ((uint32_t)2 << MMCSD_R6_STATE_SHIFT) /* 2=Identification state */
/* Data transfer states */
/* Data transfer states */
# define MMCSD_R6_STATE_STBY ((uint32_t)3 << MMCSD_R6_STATE_SHIFT) /* 3=Standby state */
# define MMCSD_R6_STATE_TRAN ((uint32_t)4 << MMCSD_R6_STATE_SHIFT) /* 4=Transfer state */
# define MMCSD_R6_STATE_DATA (5(uint32_t) << MMCSD_R6_STATE_SHIFT) /* 5=Sending data state */
# define MMCSD_R6_STATE_RCV ((uint32_t)6 << MMCSD_R6_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R6_STATE_PRG ((uint32_t)7 << MMCSD_R6_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R6_STATE_DIS ((uint32_t) << MMCSD_R6_STATE_SHIFT) /* 8=Disconnect state */
# define MMCSD_R6_STATE_DIS ((uint32_t) << MMCSD_R6_STATE_SHIFT) /* 8=Disconnect state */
#define MMCSD_R6_ERRORMASK ((uint32_t)0x0000e000) /* Error mask */
/* SD Configuration Register (SCR) encoding */
@@ -173,13 +184,14 @@
#define MMCSD_R7VOLTAGE_SHIFT (8) /* Bits 8-11: Voltage accepted */
#define MMCSD_R7VOLTAGE_MASK ((uint32_t)0x0f << MMCSD_R7VOLTAGE_SHIFT)
# define MMCSD_R7VOLTAGE_27 ((uint32_t)0x01 << MMCSD_R7VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_R7ECHO_SHIFT (0) /* Bits 0-7: Echoed check pattern */
#define MMCSD_R7ECHO_MASK ((uint32_t)0xff << MMCSD_R7ECHO_SHIFT)
# define MMCSD_R7CHECKPATTERN ((uint32_t)0xaa << MMCSD_R7ECHO_SHIFT)
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* Decoded Card Identification (CID) register */
@@ -269,6 +281,7 @@ struct mmcsd_csd_s
struct
{
/* 73:70 (reserved) */
uint32_t csize; /* 69:48 Device size */
/* 47:47 (reserved) */
uint8_t sderblen; /* 46:46 Erase single block enable (SD) */
@@ -303,9 +316,9 @@ struct mmcsd_scr_s
uint32_t mfgdata; /* 31:0 Reserved for manufacturing data */
};
/********************************************************************************************
/****************************************************************************
* Public Data
********************************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -316,9 +329,9 @@ extern "C"
#define EXTERN extern
#endif
/********************************************************************************************
* Public Functions
********************************************************************************************/
/****************************************************************************
* Public Functions Definitions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
+6 -3
View File
@@ -31,7 +31,7 @@
* Pre-processor Definitions
****************************************************************************/
/* SPI *******************************************************************/
/* SPI **********************************************************************/
/* SPI Command Set */
@@ -110,7 +110,9 @@
#define MMCSD_SPIR7_VERSION_MASK ((uint32_t)0x0f << MMCSD_SPIR7_VERSION_SHIFT)
#define MMCSD_SPIR7_VOLTAGE_SHIFT (8) /* Bits 8-11: Voltage accepted */
#define MMCSD_SPIR7_VOLTAGE_MASK ((uint32_t)0x0f << MMCSD_SPIR7_VOLTAGE_SHIFT)
#define MMCSD_SPIR7_VOLTAGE_27 ((uint32_t)0x01 << MMCSD_SPIR7_VOLTAGE_SHIFT) /* 2.7-3.6V */
#define MMCSD_SPIR7_ECHO_SHIFT (0) /* Bits 0-7: Echoed check pattern */
#define MMCSD_SPIR7_ECHO_MASK ((uint32_t)0xff << MMCSD_SPIR7_ECHO_SHIFT)
@@ -154,13 +156,14 @@
****************************************************************************/
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
+5
View File
@@ -123,6 +123,7 @@
# define ECON1_BSEL_BANK1 (1 << ECON1_BSEL_SHIFT) /* Bank 1 */
# define ECON1_BSEL_BANK2 (2 << ECON1_BSEL_SHIFT) /* Bank 2 */
# define ECON1_BSEL_BANK3 (3 << ECON1_BSEL_SHIFT) /* Bank 3 */
#define ECON1_RXEN (1 << 2) /* Bit 2: Receive Enable */
#define ECON1_TXRTS (1 << 3) /* Bit 3: Transmit Request to Send */
#define ECON1_CSUMEN (1 << 4) /* Bit 4: DMA Checksum Enable */
@@ -131,7 +132,9 @@
#define ECON1_TXRST (1 << 7) /* Bit 7: Transmit Logic Reset */
/* Ethernet Control 2 Register */
/* Bits 0-2: Reserved */
#define ECON2_VRPS (1 << 3) /* Bit 3: Voltage Regulator Power Save Enable */
/* Bit 4: Reserved */
#define ECON2_PWRSV (1 << 5) /* Bit 5: Power Save Enable */
@@ -190,6 +193,7 @@
#define ENC_EDMACSH REGADDR(0x17, 0, 0) /* DMA Checksum High Byte (EDMACS<15:8>) */
/* 0x18-0x1a: Reserved */
/* 0x1b-0x1f: EIE, EIR, ESTAT, ECON2, ECON1 */
/* Bank 1 Control Register Addresses */
#define ENC_EHT0 REGADDR(0x00, 1, 0) /* Hash Table Byte 0 (EHT<7:0>) */
@@ -388,6 +392,7 @@
#define PHIR_PLNKIF (1 << 4) /* Bit 4: PHY Link Change Interrupt */
/* PHLCON Register Bit Definitions */
/* Bit 0: Reserved */
#define PHLCON_STRCH (1 << 1) /* Bit 1: LED Pulse Stretching Enable */
#define PHLCON_LFRQ0 (1 << 2) /* Bit 2: LED Pulse Stretch Time Configuration */
+2 -3
View File
@@ -92,7 +92,6 @@
#define PIPE_UNLINK(f) do { (f) |= PIPE_FLAG_UNLINKED; } while (0)
#define PIPE_IS_UNLINKED(f) (((f) & PIPE_FLAG_UNLINKED) != 0)
/****************************************************************************
* Public Types
****************************************************************************/
@@ -108,8 +107,8 @@ typedef uint8_t pipe_ndx_t; /* 8-bit index */
#endif
/* This structure represents the state of one pipe. A reference to this
* structure is retained in the i_private field of the inode whenthe pipe/fifo
* device is registered.
* structure is retained in the i_private field of the inode whenthe
* pipe/fifo device is registered.
*/
struct pipe_dev_s
+13 -8
View File
@@ -57,12 +57,14 @@
static int bat_gauge_open(FAR struct file *filep);
static int bat_gauge_close(FAR struct file *filep);
static ssize_t bat_gauge_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
static ssize_t bat_gauge_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
static ssize_t bat_gauge_read(FAR struct file *filep,
FAR char *buffer,
size_t buflen);
static ssize_t bat_gauge_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen);
static int bat_gauge_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
unsigned long arg);
/****************************************************************************
* Private Data
@@ -125,8 +127,9 @@ static ssize_t bat_gauge_read(FAR struct file *filep, FAR char *buffer,
* Name: bat_gauge_write
****************************************************************************/
static ssize_t bat_gauge_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
static ssize_t bat_gauge_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen)
{
/* Return nothing written */
@@ -137,7 +140,9 @@ static ssize_t bat_gauge_write(FAR struct file *filep, FAR const char *buffer,
* Name: bat_gauge_ioctl
****************************************************************************/
static int bat_gauge_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
static int bat_gauge_ioctl(FAR struct file *filep,
int cmd,
unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
FAR struct battery_gauge_dev_s *dev = inode->i_private;
+29 -25
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/sensors/adxl345.h
*
* Copyright (C) 2014 Alan Carvalho de Assis
@@ -33,14 +33,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_SENSORS_ADXL345_H
#define __DRIVERS_SENSORS_ADXL345_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -52,17 +52,18 @@
#if defined(CONFIG_SENSORS_ADXL345)
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
#ifdef CONFIG_ADXL345_I2C
# error "Only the ADXL345 SPI interface is supported by this driver"
#endif
/* Driver support ***************************************************************************/
/* This format is used to construct the /dev/accel[n] device driver path. It defined here
* so that it will be used consistently in all places.
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/accel[n] device driver path.
* It defined here so that it will be used consistently in all places.
*/
#define DEV_FORMAT "/dev/accel%d"
@@ -72,9 +73,10 @@
#define ADXL345_STAT_INITIALIZED 1 /* Device has been initialized */
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* This defines type of events */
enum adxl345_event
@@ -139,50 +141,52 @@ struct adxl345_dev_s
struct adxl345_sample_s sample; /* Last sampled accelerometer data */
};
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
/********************************************************************************************
/****************************************************************************
* Name: adxl345_getreg8
*
* Description:
* Read from an 8-bit ADXL345 register
*
********************************************************************************************/
****************************************************************************/
uint8_t adxl345_getreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr);
/********************************************************************************************
/****************************************************************************
* Name: adxl345_putreg8
*
* Description:
* Write a value to an 8-bit ADXL345 register
*
********************************************************************************************/
****************************************************************************/
void adxl345_putreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr, uint8_t regval);
void adxl345_putreg8(FAR struct adxl345_dev_s *priv,
uint8_t regaddr, uint8_t regval);
/********************************************************************************************
/****************************************************************************
* Name: adxl345_getreg16
*
* Description:
* Read 16-bits of data from an ADXL345 register
*
********************************************************************************************/
****************************************************************************/
uint16_t adxl345_getreg16(FAR struct adxl345_dev_s *priv, uint8_t regaddr);
/********************************************************************************************
/****************************************************************************
* Name: adxl345_accworker
*
* Description:
* Handle accelerometer interrupt events (this function actually executes in the context of
* the worker thread).
* Handle accelerometer interrupt events
* (this function actually executes in the context of the worker thread).
*
********************************************************************************************/
****************************************************************************/
void adxl345_accworker(FAR struct adxl345_dev_s *priv, uint8_t intsta) weak_function;
void adxl345_accworker(FAR struct adxl345_dev_s *priv,
uint8_t intsta) weak_function;
#endif /* CONFIG_SENSORS_ADXL345 */
#endif /* __DRIVERS_SENSORS_ADXL345_H */
+26 -16
View File
@@ -110,13 +110,13 @@ static const struct file_operations g_qeops =
* Private Functions
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: qe_open
*
* Description:
* This function is called whenever the QEncoder device is opened.
*
************************************************************************************/
****************************************************************************/
static int qe_open(FAR struct file *filep)
{
@@ -179,13 +179,13 @@ errout:
return ret;
}
/************************************************************************************
/****************************************************************************
* Name: qe_close
*
* Description:
* This function is called when the QEncoder device is closed.
*
************************************************************************************/
****************************************************************************/
static int qe_close(FAR struct file *filep)
{
@@ -234,43 +234,48 @@ errout:
return ret;
}
/************************************************************************************
/****************************************************************************
* Name: qe_read
*
* Description:
* A dummy read method. This is provided only to satisfy the VFS layer.
*
************************************************************************************/
****************************************************************************/
static ssize_t qe_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
static ssize_t qe_read(FAR struct file *filep,
FAR char *buffer,
size_t buflen)
{
/* Return zero -- usually meaning end-of-file */
return 0;
}
/************************************************************************************
/****************************************************************************
* Name: qe_write
*
* Description:
* A dummy write method. This is provided only to satisfy the VFS layer.
*
************************************************************************************/
****************************************************************************/
static ssize_t qe_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
static ssize_t qe_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen)
{
/* Return a failure */
return -EPERM;
}
/************************************************************************************
/****************************************************************************
* Name: qe_ioctl
*
* Description:
* The standard ioctl method. This is where ALL of the QEncoder work is done.
* The standard ioctl method.
* This is where ALL of the QEncoder work is done.
*
************************************************************************************/
****************************************************************************/
static int qe_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
@@ -320,7 +325,9 @@ static int qe_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
break;
/* Any unrecognized IOCTL commands might be platform-specific ioctl commands */
/* Any unrecognized IOCTL commands might be platform-specific ioctl
* commands
*/
default:
{
@@ -366,14 +373,17 @@ int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower)
/* Allocate the upper-half data structure */
upper = (FAR struct qe_upperhalf_s *)kmm_zalloc(sizeof(struct qe_upperhalf_s));
upper = (FAR struct qe_upperhalf_s *)
kmm_zalloc(sizeof(struct qe_upperhalf_s));
if (!upper)
{
snerr("ERROR: Allocation failed\n");
return -ENOMEM;
}
/* Initialize the QEncoder device structure (it was already zeroed by kmm_zalloc()) */
/* Initialize the QEncoder device structure
* (it was already zeroed by kmm_zalloc())
*/
nxsem_init(&upper->exclsem, 0, 1);
upper->lower = lower;
+18 -17
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* drivers/sensors/xen1210.h
*
* Copyright (C) 2014 Alan Carvalho de Assis
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
****************************************************************************/
#ifndef __DRIVERS_SENSORS_XEN1210_H
#define __DRIVERS_SENSORS_XEN1210_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -50,13 +50,14 @@
#if defined(CONFIG_SENSORS_XEN1210)
/********************************************************************************************
/****************************************************************************
* Pre-processor Definitions
********************************************************************************************/
****************************************************************************/
/* Driver support ***************************************************************************/
/* This format is used to construct the /dev/mag[n] device driver path. It is defined here
* so that it will be used consistently in all places.
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/mag[n] device driver path.
* It is defined here so that it will be used consistently in all places.
*/
#define DEV_FORMAT "/dev/mag%d"
@@ -66,9 +67,9 @@
#define XEN1210_STAT_INITIALIZED 1 /* Device has been initialized */
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* This structure describes the results of one XEN1210 sample */
@@ -100,27 +101,27 @@ struct xen1210_dev_s
struct xen1210_sample_s sample; /* Last sampled accelerometer data */
};
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
/********************************************************************************************
/****************************************************************************
* Name: xen1210_getdata
*
* Description:
* Read 24-bit from XEN1210 buffer, read three times (3 sensors)
*
********************************************************************************************/
****************************************************************************/
void xen1210_getdata(FAR struct xen1210_dev_s *priv);
/********************************************************************************************
/****************************************************************************
* Name: xen1210_putdata
*
* Description:
* Write 24-bit to XEN1210 buffer, write three times (3 sensors)
*
********************************************************************************************/
****************************************************************************/
void xen1210_putdata(FAR struct xen1210_dev_s *priv, uint32_t regval);
+139 -115
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More