New LCD drivers
authorKevin Townsend <kevin@ktownsend.com>
Tue, 17 Jan 2012 19:14:51 +0000 (20:14 +0100)
committerKevin Townsend <kevin@ktownsend.com>
Tue, 17 Jan 2012 19:14:51 +0000 (20:14 +0100)
Makefile
build/codelite/LPC1343 Workspace.workspace.session
build/codelite/LPC1343_CodeBase.project
build/crossworks/LPC1343_CodeBase.hzs
drivers/lcd/tft/hw/ssd1351.c
drivers/lcd/tft/hw/ssd1351.h
main.c
projectconfig.h

index 78bfbf7..12f36ce 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,7 @@ OBJS += verdana9.o verdana14.o verdanabold14.o
 OBJS += ILI9328.o
 # OBJS += ILI9325.o
 # OBJS += ssd1331.o
+# OBJS += ssd1351.o
 # OBJS += st7735.o
 # OBJS += st7783.o
 
index 860bfe3..fce93d4 100644 (file)
@@ -5,14 +5,14 @@
   <TabInfoArray Name="TabInfoArray">
     <TabInfo>
       <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\Makefile" Name="FileName"/>
-      <int Value="15" Name="FirstVisibleLine"/>
-      <int Value="22" Name="CurrentLine"/>
+      <int Value="69" Name="FirstVisibleLine"/>
+      <int Value="73" Name="CurrentLine"/>
       <wxArrayString Name="Bookmarks"/>
     </TabInfo>
     <TabInfo>
       <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" Name="FileName"/>
-      <int Value="60" Name="FirstVisibleLine"/>
-      <int Value="66" Name="CurrentLine"/>
+      <int Value="1" Name="FirstVisibleLine"/>
+      <int Value="13" Name="CurrentLine"/>
       <wxArrayString Name="Bookmarks"/>
     </TabInfo>
   </TabInfoArray>
index 6dbe1c0..54c13ef 100644 (file)
           <File Name="../../drivers/lcd/tft/hw/ILI9328.h"/>
           <File Name="../../drivers/lcd/tft/hw/ssd1331.c"/>
           <File Name="../../drivers/lcd/tft/hw/ssd1331.h"/>
+          <File Name="../../drivers/lcd/tft/hw/ssd1351.c"/>
+          <File Name="../../drivers/lcd/tft/hw/ssd1351.h"/>
         </VirtualDirectory>
         <VirtualDirectory Name="fonts">
           <File Name="../../drivers/lcd/tft/fonts/bitmapfonts.h"/>
index c018daa..70f8d54 100644 (file)
@@ -1,16 +1,7 @@
 <!DOCTYPE CrossStudio_for_ARM_Session_File>
 <session>
  <Bookmarks/>
- <Breakpoints>
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="BusFault" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="ExceptionEntryReturnFault" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="HardFault" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="MemManage" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="3" counter="0" expression="Reset" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="UsageFault_CheckingError" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="UsageFault_Coprocessor" />
-  <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="UsageFault_StateError" />
- </Breakpoints>
+ <Breakpoints/>
  <ETMWindow>
   <ETMRegister number="0" value="800" />
   <ETMRegister number="8" value="6f" />
   <ProjectSessionItem path="LPC1343_CodeBase" name="unnamed" />
   <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase" name="unnamed" />
   <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;core" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;core;systick" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;core;usbcdc" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;lcd" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;lcd;tft" name="unnamed" />
-  <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;lcd;tft;hw" name="unnamed" />
  </Project>
  <Register1>
   <RegisterWindow openNodes="USB;USB/USBRxPLen;USB/USBTxPLen;USB/USBCtrl" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;USB" decimalNodes="" octalNodes="" asciiNodes="" />
  </TraceWindow>
  <Watch1>
   <Watches active="1" update="Each Second" >
-   <Watchpoint linenumber="66" radix="10" name="msTicks" expression="msTicks" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/systick/systick.c" />
-   <Watchpoint linenumber="138" radix="16" name="timer32_0_counter" expression="timer32_0_counter" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/timer32/timer32.c" />
-   <Watchpoint linenumber="155" radix="-1" name="xTickCount" expression="xTickCount" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
    <Watchpoint linenumber="155" radix="16" name="Tick" expression="Tick" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
+   <Watchpoint linenumber="155" radix="-1" name="xTickCount" expression="xTickCount" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
+   <Watchpoint linenumber="138" radix="16" name="timer32_0_counter" expression="timer32_0_counter" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/timer32/timer32.c" />
+   <Watchpoint linenumber="66" radix="10" name="msTicks" expression="msTicks" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/systick/systick.c" />
   </Watches>
  </Watch1>
  <Watch2>
   <Watches active="0" update="Never" />
  </Watch4>
  <Files>
-  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="33" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="69" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="58" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="59" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="46" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1351.c" y="190" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1351.c" left="0" selected="0" name="unnamed" top="160" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1351.h" y="78" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1351.h" left="0" selected="0" name="unnamed" top="49" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\projectconfig.h" y="86" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\projectconfig.h" left="0" selected="0" name="unnamed" top="86" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1331.c" y="41" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1331.c" left="0" selected="0" name="unnamed" top="15" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1331.h" y="0" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw\ssd1331.h" left="0" selected="0" name="unnamed" top="21" />
  </Files>
- <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
+ <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\lcd\tft\hw" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
 </session>
index eddc0f0..b53d9e3 100644 (file)
@@ -188,7 +188,8 @@ void lcdInit(void)
   CMD(SSD1351_CMD_SETGPIO);
   DATA(0x00);                               // Disable GPIO pins
   CMD(SSD1351_CMD_FUNCTIONSELECTION);
-  DATA(0x00);                               // External VDD
+  DATA(0x00);                               // External VDD (0 = Internal, 1 = External???)*
+                                            // Which is it ... DS is contradictory here!
   CMD(SSD1351_CMD_SETPHASELENGTH);
   DATA(0x32);
   CMD(SSD1351_CMD_SETSEGMENTLOWVOLTAGE);
index 204b9a8..e4edfd8 100644 (file)
 
 // Control pins
 #define SSD1351_SCK_PORT                (2) // SCK (D0)
-#define SSD1351_SCK_PIN                 (4)
+#define SSD1351_SCK_PIN                 (1)
 #define SSD1351_SID_PORT                (2) // DAT/MOSI (D1)
-#define SSD1351_SID_PIN                 (5)
+#define SSD1351_SID_PIN                 (2)
 #define SSD1351_CS_PORT                 (2) // OLEDCS
-#define SSD1351_CS_PIN                  (6)
+#define SSD1351_CS_PIN                  (3)
 #define SSD1351_RST_PORT                (2) // RST
-#define SSD1351_RST_PIN                 (7)
+#define SSD1351_RST_PIN                 (4)
 #define SSD1351_DC_PORT                 (2) // D/C (only required for 4-pin SPI)
-#define SSD1351_DC_PIN                  (8)
+#define SSD1351_DC_PIN                  (5)
 
 // 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)
+#define SSD1351_DISABLEPULLUPS()  do {  gpioSetPullup(&IOCON_PIO2_1, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_2, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_3, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_4, gpioPullupMode_Inactive); \
+                                        gpioSetPullup(&IOCON_PIO2_5, 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))))
diff --git a/main.c b/main.c
index 6d5c158..dbae27d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -43,6 +43,9 @@
 #include "core/gpio/gpio.h"
 #include "core/systick/systick.h"
 
+#include "drivers/lcd/tft/hw/ssd1351.h"
+#include "drivers/lcd/tft/drawing.h"
+
 #ifdef CFG_INTERFACE
   #include "core/cmd/cmd.h"
 #endif
@@ -61,6 +64,9 @@ int main(void)
   uint32_t currentSecond, lastSecond;
   currentSecond = lastSecond = 0;
   
+  lcdInit();
+  lcdTest();
+
   while (1)
   {
     // Toggle LED once per second
index e59629a..d25de0f 100644 (file)
     ST7735      . .  .  .     X X X X X X . . .     . . . .
     SHARPMEM    . .  .  .     X X X X . . . . .     . . . .
     SSD1306     . .  .  .     X X X . X X . . .     . . . .
+    SSD1351     . .  .  .     X X X X X . . . .     . . . .
     MCP121      . .  .  .     . . . . . . . . .     . X . .
 
                 TIMERS                    SSP     ADC         UART
This page took 0.038234 seconds and 4 git commands to generate.