Added experimental SSD1351 driver
authorKevin Townsend <kevin@ktownsend.com>
Fri, 13 Jan 2012 00:06:21 +0000 (01:06 +0100)
committerKevin Townsend <kevin@ktownsend.com>
Fri, 13 Jan 2012 00:06:21 +0000 (01:06 +0100)
drivers/lcd/tft/hw/readme.txt
drivers/lcd/tft/hw/ssd1351.c [new file with mode: 0644]
drivers/lcd/tft/hw/ssd1351.h [new file with mode: 0644]

index dd0ec4c..0e4fd17 100644 (file)
@@ -4,7 +4,8 @@ HW-Specific LCD Drivers
 ILI9325   - 240x320 16-bit display  (8-bit interface)
 ILI9328   - 240x320 16-bit display  (8-bit interface)
 st7735    - 128x160 16-bit display  (Bit-banged SPI interface)
-st7783    - 240x320 16-bit displays (8-bit interface)
+st7783    - 240x320 16-bit display  (8-bit interface)
+SSD1351   - 128x128 16-bit OLED display (Bit-banged SPI interface)
 
 NOTE: Only the ILI9325 and ILI9328 drivers have been fully tested.
 The others are incomplete or have only been partially tested. (The
diff --git a/drivers/lcd/tft/hw/ssd1351.c b/drivers/lcd/tft/hw/ssd1351.c
new file mode 100644 (file)
index 0000000..0644e2f
--- /dev/null
@@ -0,0 +1,472 @@
+/**************************************************************************/
+/*! 
+    @file     SSD1351.c
+    @author   K. Townsend (microBuilder.eu)
+
+    @section  DESCRIPTION
+
+    Driver for SSD1351 128x128 pixel RGB OLED displays.
+    
+    This driver uses a 3 or 4-pin SPI interface and 16-bit RGB565 colours.
+
+    @section  LICENSE
+
+    Software License Agreement (BSD License)
+
+    Copyright (c) 2010, microBuilder SARL
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are met:
+    1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+    3. Neither the name of the copyright holders nor the
+    names of its contributors may be used to endorse or promote products
+    derived from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/**************************************************************************/
+#include "ssd1351.h"
+#include "core/systick/systick.h"
+
+static volatile lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
+static lcdProperties_t ssd1351Properties = { 128, 128, false, false, false };
+
+/*************************************************/
+/* Private Methods                               */
+/*************************************************/
+
+#define CMD(c)        do { SET_CS; CLR_CS; CLR_DC; ssd1351SendByte( c, 1 ); SET_CS; } while (0)
+#define DATA(c)       do { SET_CS; CLR_CS; SET_DC; ssd1351SendByte( c, 0 ); SET_CS; } while (0);
+#define DELAY(mS)     do { systickDelay( mS / CFG_SYSTICK_DELAY_IN_MS ); } while(0);
+
+/**************************************************************************/
+/*! 
+    @brief Simulates an SPI write using GPIO.  
+    
+    @param[in]  byte
+                The byte to send
+    @param[in]  command
+                1 if this is a command, 0 if it is data
+*/
+/**************************************************************************/
+void ssd1351SendByte(uint8_t byte, uint8_t command)
+{
+  int8_t i;
+
+  // Make sure clock pin starts high
+  SET_SCK;
+
+#if defined SSD1351_BUS_SPI3
+  // Prepend D/C bit (cmd = 0, data = 1)
+  CLR_SCK;
+  if (command)
+  {
+    CLR_SID;
+  }
+  else
+  {
+    SET_SID;
+  }
+  SET_SCK;
+#endif
+
+  // Write from MSB to LSB
+  for (i=7; i>=0; i--) 
+  {
+    // Set clock pin low
+    CLR_SCK;
+    // Set data pin high or low depending on the value of the current bit
+    if (byte & (1 << i))
+    {
+      SET_SID;
+    }
+    else
+    {
+      CLR_SID;
+    }
+    // Set clock pin high
+    SET_SCK;
+  }
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Returns the 16-bit (4-hexdigit) controller code
+*/
+/**************************************************************************/
+uint16_t ssd1351Type(void)
+{
+  return 0x1351;
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Sets the cursor to the specified X/Y position
+*/
+/**************************************************************************/
+void ssd1351SetCursor(uint8_t x, uint8_t y)
+{
+  if ((x >= ssd1351Properties.width) || (y >= ssd1351Properties.height))
+    return;
+
+  CMD(SSD1351_CMD_SETCOLUMNADDRESS);
+  DATA(x);                            // Start Address
+  DATA(ssd1351Properties.width-1);    // End Address (0x7F)
+
+  CMD(SSD1351_CMD_SETROWADDRESS);
+  DATA(y);                            // Start Address
+  DATA(ssd1351Properties.height-1);   // End Address (0x7F)
+}
+
+/*************************************************/
+/* Public Methods                                */
+/*************************************************/
+
+/**************************************************************************/
+/*! 
+    @brief  Configures any pins or HW and initialises the LCD controller
+*/
+/**************************************************************************/
+void lcdInit(void)
+{
+  // Set all pins to output
+  gpioSetDir(SSD1351_SCK_PORT, SSD1351_SCK_PIN, gpioDirection_Output);
+  gpioSetDir(SSD1351_SID_PORT, SSD1351_SID_PIN, gpioDirection_Output);
+  gpioSetDir(SSD1351_RST_PORT, SSD1351_RST_PIN, gpioDirection_Output);
+  gpioSetDir(SSD1351_CS_PORT, SSD1351_CS_PIN, gpioDirection_Output);
+
+#if !defined SSD1351_BUS_SPI3
+  gpioSetDir(SSD1351_DC_PORT, SSD1351_DC_PIN, gpioDirection_Output);
+#endif
+
+  // Reset the LCD
+  SET_RST;
+  DELAY(20);
+  CLR_RST;
+  DELAY(200);
+  SET_RST;
+  DELAY(20);
+
+  // Disable pullups
+  SSD1351_DISABLEPULLUPS();
+
+  CMD(SSD1351_CMD_SETCOMMANDLOCK);
+  DATA(0x12);                               // Unlocked to enter commands
+  CMD(SSD1351_CMD_SETCOMMANDLOCK);
+  DATA(0xB1);                               // Make all commands accessible 
+  CMD(SSD1351_CMD_SLEEPMODE_DISPLAYOFF);
+  CMD(SSD1351_CMD_SETFRONTCLOCKDIV);
+  DATA(0xF1);
+  CMD(SSD1351_CMD_SETMUXRRATIO);
+  DATA(0x7F);
+  CMD(SSD1351_CMD_COLORDEPTH);
+  DATA(0x74);                               // 65,536 Colors
+  CMD(SSD1351_CMD_SETCOLUMNADDRESS);
+  DATA(0x00);
+  DATA(0x7F);
+  CMD(SSD1351_CMD_SETROWADDRESS);
+  DATA(0x00);
+  DATA(0x7F);
+  CMD(SSD1351_CMD_SETDISPLAYSTARTLINE);
+  DATA(0x00);
+  CMD(SSD1351_CMD_SETDISPLAYOFFSET);
+  DATA(0x00);
+  CMD(SSD1351_CMD_SETGPIO);
+  DATA(0x00);                               // Disable GPIO pins
+  CMD(SSD1351_CMD_FUNCTIONSELECTION);
+  DATA(0x00);                               // External VDD
+  CMD(SSD1351_CMD_SETPHASELENGTH);
+  DATA(0x32);
+  CMD(SSD1351_CMD_SETSEGMENTLOWVOLTAGE);
+  DATA(0xA0);                               // Enable External VSL
+  DATA(0xB5);
+  DATA(0x55);
+  CMD(SSD1351_CMD_SETPRECHARGEVOLTAGE);
+  DATA(0x17);
+  CMD(SSD1351_CMD_SETVCOMHVOLTAGE);
+  DATA(0x05);
+  CMD(SSD1351_CMD_SETCONTRAST);
+  DATA(0xC8);
+  DATA(0x80);
+  DATA(0xC8);
+  CMD(SSD1351_CMD_MASTERCONTRAST);
+  DATA(0x0F);                               // Maximum contrast
+  CMD(SSD1351_CMD_SETSECONDPRECHARGEPERIOD);
+  DATA(0x01);
+  CMD(SSD1351_CMD_SETDISPLAYMODE_RESET);
+
+  // Use default grayscale for now to save flash space, but here are
+  // the values if someone wants to change them ...
+  //  CMD(SSD1351_CMD_GRAYSCALELOOKUP);
+  //  DATA(0x02);
+  //  DATA(0x03);
+  //  DATA(0x04);
+  //  DATA(0x05);
+  //  DATA(0x06);
+  //  DATA(0x07);
+  //  DATA(0x08);
+  //  DATA(0x09);
+  //  DATA(0x0A);
+  //  DATA(0x0B);
+  //  DATA(0x0C);
+  //  DATA(0x0D);
+  //  DATA(0x0E);
+  //  DATA(0x0F);
+  //  DATA(0x10);
+  //  DATA(0x11);
+  //  DATA(0x12);
+  //  DATA(0x13);
+  //  DATA(0x15);
+  //  DATA(0x17);
+  //  DATA(0x19);
+  //  DATA(0x1B);
+  //  DATA(0x1D);
+  //  DATA(0x1F);
+  //  DATA(0x21);
+  //  DATA(0x23);
+  //  DATA(0x25);
+  //  DATA(0x27);
+  //  DATA(0x2A);
+  //  DATA(0x2D);
+  //  DATA(0x30);
+  //  DATA(0x33);
+  //  DATA(0x36);
+  //  DATA(0x39);
+  //  DATA(0x3C);
+  //  DATA(0x3F);
+  //  DATA(0x42);
+  //  DATA(0x45);
+  //  DATA(0x48);
+  //  DATA(0x4C);
+  //  DATA(0x50);
+  //  DATA(0x54);
+  //  DATA(0x58);
+  //  DATA(0x5C);
+  //  DATA(0x60);
+  //  DATA(0x64);
+  //  DATA(0x68);
+  //  DATA(0x6C);
+  //  DATA(0x70);
+  //  DATA(0x74);
+  //  DATA(0x78);
+  //  DATA(0x7D);
+  //  DATA(0x82);
+  //  DATA(0x87);
+  //  DATA(0x8C);
+  //  DATA(0x91);
+  //  DATA(0x96);
+  //  DATA(0x9B);
+  //  DATA(0xA0);
+  //  DATA(0xA5);
+  //  DATA(0xAA);
+  //  DATA(0xAF);
+  //  DATA(0xBF);
+
+  // Clear screen
+  lcdFillRGB(COLOR_RED);
+
+  // Turn the display on
+  CMD(SSD1351_CMD_SLEEPMODE_DISPLAYON);  
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Enables or disables the LCD backlight
+*/
+/**************************************************************************/
+void lcdBacklight(bool state)
+{
+  // No backlight ... do nothing
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Renders a simple test pattern on the LCD
+*/
+/**************************************************************************/
+void lcdTest(void)
+{
+  uint32_t i,j;
+  CMD(SSD1351_CMD_WRITERAM);
+  ssd1351SetCursor(0, 0);
+  CMD(SSD1351_CMD_WRITERAM);
+  
+  for(i=0;i<128;i++)
+  {
+    for(j=0;j<128;j++)
+    {
+      if(i>111){DATA(COLOR_WHITE>>8);DATA((uint8_t)COLOR_WHITE);}
+      else if(i>95){DATA(COLOR_BLUE>>8);DATA((uint8_t)COLOR_BLUE);}
+      else if(i>79){DATA(COLOR_GREEN>>8);DATA((uint8_t)COLOR_GREEN);}
+      else if(i>63){DATA(COLOR_CYAN>>8);DATA((uint8_t)COLOR_CYAN);}
+      else if(i>47){DATA(COLOR_RED>>8);DATA((uint8_t)COLOR_RED);}
+      else if(i>31){DATA(COLOR_MAGENTA>>8);DATA((uint8_t)COLOR_MAGENTA);}
+      else if(i>15){DATA(COLOR_YELLOW>>8);DATA((uint8_t)COLOR_YELLOW);}
+      else {DATA(COLOR_BLACK>>8);DATA((uint8_t)COLOR_BLACK);}
+    }
+  }
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Fills the LCD with the specified 16-bit color
+*/
+/**************************************************************************/
+void lcdFillRGB(uint16_t data)
+{
+  uint16_t i;
+  ssd1351SetCursor(0, 0);
+  CMD(SSD1351_CMD_WRITERAM);
+  for (i=1; i<=((ssd1351Properties.width)*(ssd1351Properties.height)) * 2;i++)
+  {
+    DATA(data);
+    DATA((data >> 8));
+  }
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Draws a single pixel at the specified X/Y location
+*/
+/**************************************************************************/
+void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
+{
+  if ((x >= ssd1351Properties.width) || (y >= ssd1351Properties.height))
+    return;
+
+  ssd1351SetCursor((uint8_t)x, (uint8_t)y);
+  DATA(color >> 8);
+  DATA(color);
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Draws an array of consecutive RGB565 pixels (much
+            faster than addressing each pixel individually)
+*/
+/**************************************************************************/
+void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len)
+{
+  // ToDo
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Optimised routine to draw a horizontal line faster than
+            setting individual pixels
+*/
+/**************************************************************************/
+void lcdDrawHLine(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color)
+{
+  // ToDo
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Optimised routine to draw a vertical line faster than
+            setting individual pixels
+*/
+/**************************************************************************/
+void lcdDrawVLine(uint16_t x, uint16_t y0, uint16_t y1, uint16_t color)
+{
+  // ToDo
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Gets the 16-bit color of the pixel at the specified location
+*/
+/**************************************************************************/
+uint16_t lcdGetPixel(uint16_t x, uint16_t y)
+{
+  // ToDo
+  return 0;
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Sets the LCD orientation to horizontal and vertical
+*/
+/**************************************************************************/
+void lcdSetOrientation(lcdOrientation_t orientation)
+{
+  // Not supported
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Gets the current screen orientation (horizontal or vertical)
+*/
+/**************************************************************************/
+lcdOrientation_t lcdGetOrientation(void)
+{
+  return lcdOrientation;
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Gets the width in pixels of the LCD screen (varies depending
+            on the current screen orientation)
+*/
+/**************************************************************************/
+uint16_t lcdGetWidth(void)
+{
+  return ssd1351Properties.width;
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Gets the height in pixels of the LCD screen (varies depending
+            on the current screen orientation)
+*/
+/**************************************************************************/
+uint16_t lcdGetHeight(void)
+{
+  return ssd1351Properties.height;
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Scrolls the contents of the LCD screen vertically the
+            specified number of pixels using a HW optimised routine
+*/
+/**************************************************************************/
+void lcdScroll(int16_t pixels, uint16_t fillColor)
+{
+  // ToDo
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Gets the controller's 16-bit (4 hexdigit) ID
+*/
+/**************************************************************************/
+uint16_t lcdGetControllerID(void)
+{
+  return ssd1351Type();
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Returns the LCDs 'lcdProperties_t' that describes the LCDs
+            generic capabilities and dimensions
+*/
+/**************************************************************************/
+lcdProperties_t lcdGetProperties(void)
+{
+  return ssd1351Properties;
+}
diff --git a/drivers/lcd/tft/hw/ssd1351.h b/drivers/lcd/tft/hw/ssd1351.h
new file mode 100644 (file)
index 0000000..eadc181
--- /dev/null
@@ -0,0 +1,147 @@
+/**************************************************************************/
+/*! 
+    @file     ssd1351.h
+    @author   K. Townsend (microBuilder.eu)
+
+    @section LICENSE
+
+    Software License Agreement (BSD License)
+
+    Copyright (c) 2010, microBuilder SARL
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are met:
+    1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+    3. Neither the name of the copyright holders nor the
+    names of its contributors may be used to endorse or promote products
+    derived from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/**************************************************************************/
+#ifndef __SSD1351_H__
+#define __SSD1351_H__
+
+#include "projectconfig.h"
+#include "drivers/lcd/tft/lcd.h"
+#include "core/gpio/gpio.h"
+
+/*=========================================================================
+    SPI modes
+    -----------------------------------------------------------------------
+    The OLED supports both 3-pin and 4-pin SPI modes
+
+    3-PIN MODE      Saves one GPIO pin (D/C) by adding the D/C bit before
+                    every transfer, meaning that 9 bits are sent every frame
+                    instead of 8.  You have slightly slower performance
+                    but use less pins. Requires 3 GPIO pins (SCK, SID, RST)
+
+    4-PIN MODE      Uses a normal SPI interface with 8-bits per transfer,
+                    plus a dedicated D/C pin to indicate if this is a
+                    command or data byte. Requires 4 GPIO pins (SCK, SID,
+                    RST, DC).
+
+    To select one of the SPI modes, make sure the BS0/1 pins are correctly
+    set on the OLED display and uncomment the appropriate define below.
+    -----------------------------------------------------------------------*/
+    // #define SSD1351_BUS_SPI3
+    #define SSD1351_BUS_SPI4
+/*=========================================================================*/
+
+// Control pins
+#define SSD1351_SCK_PORT                (2) // SCK (D0)
+#define SSD1351_SCK_PIN                 (4)
+#define SSD1351_SID_PORT                (2) // DAT/MOSI (D1)
+#define SSD1351_SID_PIN                 (5)
+#define SSD1351_CS_PORT                 (2) // OLEDCS
+#define SSD1351_CS_PIN                  (6)
+#define SSD1351_RST_PORT                (2) // RST
+#define SSD1351_RST_PIN                 (7)
+#define SSD1351_DC_PORT                 (2) // D/C (only required for 4-pin SPI)
+#define SSD1351_DC_PIN                  (8)
+
+// Placed here to try to keep all pin specific values in the header file
+#define SSD1351_DISABLEPULLUPS()  do {  gpioSetPullup(&IOCON_PIO2_4, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_5, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_6, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_7, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_8, gpioPullupMode_Inactive); } while (0)
+
+// These registers allow fast single cycle clear+set of bits (see section 8.5.1 of LPC1343 UM)
+#define SSD1351_GPIO2DATA_SCK           (*(pREG32 (GPIO_GPIO2_BASE + ((1 << SSD1351_SCK_PIN) << 2))))
+#define SSD1351_GPIO2DATA_SID           (*(pREG32 (GPIO_GPIO2_BASE + ((1 << SSD1351_SID_PIN) << 2))))
+#define SSD1351_GPIO2DATA_CS            (*(pREG32 (GPIO_GPIO2_BASE + ((1 << SSD1351_CS_PIN) << 2))))
+#define SSD1351_GPIO2DATA_RST           (*(pREG32 (GPIO_GPIO2_BASE + ((1 << SSD1351_RST_PIN) << 2))))
+#define SSD1351_GPIO2DATA_DC            (*(pREG32 (GPIO_GPIO2_BASE + ((1 << SSD1351_DC_PIN) << 2))))
+
+// Macros for control line state
+#define CLR_SCK                         SSD1351_GPIO2DATA_SCK = (0)
+#define SET_SCK                         SSD1351_GPIO2DATA_SCK = (1 << SSD1351_SCK_PIN)
+#define CLR_SID                         SSD1351_GPIO2DATA_SID = (0)
+#define SET_SID                         SSD1351_GPIO2DATA_SID = (1 << SSD1351_SID_PIN)
+#define CLR_CS                          SSD1351_GPIO2DATA_CS  = (0)
+#define SET_CS                          SSD1351_GPIO2DATA_CS  = (1 << SSD1351_CS_PIN)
+#define CLR_RST                         SSD1351_GPIO2DATA_RST = (0)
+#define SET_RST                         SSD1351_GPIO2DATA_RST = (1 << SSD1351_RST_PIN)
+#define CLR_DC                          SSD1351_GPIO2DATA_DC  = (0)
+#define SET_DC                          SSD1351_GPIO2DATA_DC  = (1 << SSD1351_DC_PIN)
+
+// SSD1351 Commands
+enum
+{
+  SSD1351_CMD_SETCOLUMNADDRESS          = 0x15,
+  SSD1351_CMD_SETROWADDRESS             = 0x75,
+  SSD1351_CMD_WRITERAM                  = 0x5C, // Write data to GRAM and increment until another command is sent
+  SSD1351_CMD_READRAM                   = 0x5D, // Read data from GRAM and increment until another command is sent
+  SSD1351_CMD_COLORDEPTH                = 0xA0, // Numerous functions include increment direction ... see DS 
+                                                // A0[0] = Address Increment Mode (0 = horizontal, 1 = vertical)
+                                                // A0[1] = Column Address Remap (0 = left to right, 1 = right to left)
+                                                // A0[2] = Color Remap (0 = ABC, 1 = CBA) - HW RGB/BGR switch
+                                                // A0[4] = COM Scan Direction (0 = top to bottom, 1 = bottom to top)
+                                                // A0[5] = Odd/Even Paid Split
+                                                // A0[7:6] = Display Color Mode (Bits not documented !?!)
+  SSD1351_CMD_SETDISPLAYSTARTLINE       = 0xA1,
+  SSD1351_CMD_SETDISPLAYOFFSET          = 0xA2, 
+  SSD1351_CMD_SETDISPLAYMODE_ALLOFF     = 0xA4, // Force entire display area to grayscale GS0
+  SSD1351_CMD_SETDISPLAYMODE_ALLON      = 0xA5, // Force entire display area to grayscale GS63
+  SSD1351_CMD_SETDISPLAYMODE_RESET      = 0xA6, // Resets the display area relative to the above two commands
+  SSD1351_CMD_SETDISPLAYMODE_INVERT     = 0xA7, // Inverts the display contents (GS0 -> GS63, GS63 -> GS0, etc.)
+  SSD1351_CMD_FUNCTIONSELECTION         = 0xAB, // Enable/Disable the internal VDD regulator
+  SSD1351_CMD_SLEEPMODE_DISPLAYOFF      = 0xAE, // Sleep mode on (display off)
+  SSD1351_CMD_SLEEPMODE_DISPLAYON       = 0xAF, // Sleep mode off (display on)
+  SSD1351_CMD_SETPHASELENGTH            = 0xB1, // Larger capacitance may require larger delay to discharge previous pixel state
+  SSD1351_CMD_ENHANCEDDRIVINGSCHEME     = 0xB2, 
+  SSD1351_CMD_SETFRONTCLOCKDIV          = 0xB3, // DCLK divide ration fro CLK (from 1 to 16)
+  SSD1351_CMD_SETSEGMENTLOWVOLTAGE      = 0xB4,
+  SSD1351_CMD_SETGPIO                   = 0xB5,
+  SSD1351_CMD_SETSECONDPRECHARGEPERIOD  = 0xB6,
+  SSD1351_CMD_GRAYSCALELOOKUP           = 0xB8,
+  SSD1351_CMD_LINEARLUT                 = 0xB9,
+  SSD1351_CMD_SETPRECHARGEVOLTAGE       = 0xBB,
+  SSD1351_CMD_SETVCOMHVOLTAGE           = 0xBE,
+  SSD1351_CMD_SETCONTRAST               = 0xC1,
+  SSD1351_CMD_MASTERCONTRAST            = 0xC7,
+  SSD1351_CMD_SETMUXRRATIO              = 0xCA,
+  SSD1351_CMD_NOP3                      = 0xD1,
+  SSD1351_CMD_NOP4                      = 0xE3,
+  SSD1351_CMD_SETCOMMANDLOCK            = 0xFD,
+  SSD1351_CMD_HORIZONTALSCROLL          = 0x96,
+  SSD1351_CMD_STOPMOVING                = 0x9E,
+  SSD1351_CMD_STARTMOVING               = 0x9F  
+};
+
+#endif
This page took 0.037302 seconds and 4 git commands to generate.