SPI flash and makefile updated
authorKevin Townsend <kevin@ktownsend.com>
Sun, 2 Oct 2011 18:30:51 +0000 (20:30 +0200)
committerKevin Townsend <kevin@ktownsend.com>
Sun, 2 Oct 2011 18:30:51 +0000 (20:30 +0200)
ChangeLog.txt
Makefile
build/codelite/LPC1343 Workspace.tags
build/codelite/LPC1343 Workspace.workspace.session
build/codelite/LPC1343_CodeBase.project
build/crossworks/LPC1343_CodeBase.hzs
drivers/lcd/tft/drawing.c
drivers/spiflash/w25q16bv/w25q16bv.c
main.c

index 0cb02bc..73bb2e2 100644 (file)
@@ -2,6 +2,10 @@ v0.9.8 - Ongoing
 ================
 - Added driver for Sharp Memory Display
   /drivers/lcd/bitmap/sharpmem
+- Added SPI Flash example
+  /tools/examples/spiflash/*
+- Added write function to SPI Flash driver
+  /drivers/spiflash/*
 
 v0.9.5 - 3 August 2011
 ======================
index 46c1220..3f71b77 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -98,6 +98,10 @@ OBJS += pn532.o
 VPATH += drivers/sensors/tcs3414 drivers/sensors/tsl2561
 OBJS += tcs3414.o tsl2561.o
 
+# SPI Flash
+VPATH += drivers/spiflash/w25q16bv
+OBJS += w25q16bv.o
+
 ##########################################################################
 # Library files 
 ##########################################################################
index 9773273..d64d744 100644 (file)
Binary files a/build/codelite/LPC1343 Workspace.tags and b/build/codelite/LPC1343 Workspace.tags differ
index 413664f..df01b19 100644 (file)
@@ -1,18 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Session Name="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\build\codelite\LPC1343 Workspace.workspace">
-  <int Value="1" Name="m_selectedTab"/>
+  <int Value="0" Name="m_selectedTab"/>
   <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\build\codelite\LPC1343 Workspace.workspace" Name="m_workspaceName"/>
   <TabInfoArray Name="TabInfoArray">
     <TabInfo>
       <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" Name="FileName"/>
-      <int Value="40" Name="FirstVisibleLine"/>
-      <int Value="41" Name="CurrentLine"/>
+      <int Value="0" Name="FirstVisibleLine"/>
+      <int Value="11" Name="CurrentLine"/>
       <wxArrayString Name="Bookmarks"/>
     </TabInfo>
     <TabInfo>
       <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\Makefile" Name="FileName"/>
-      <int Value="54" Name="FirstVisibleLine"/>
-      <int Value="63" Name="CurrentLine"/>
+      <int Value="161" Name="FirstVisibleLine"/>
+      <int Value="167" Name="CurrentLine"/>
+      <wxArrayString Name="Bookmarks"/>
+    </TabInfo>
+    <TabInfo>
+      <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\projectconfig.h" Name="FileName"/>
+      <int Value="45" Name="FirstVisibleLine"/>
+      <int Value="10" Name="CurrentLine"/>
       <wxArrayString Name="Bookmarks"/>
     </TabInfo>
   </TabInfoArray>
index 1deddee..96405f8 100644 (file)
         <File Name="../../drivers/rtc/isl12022m/isl12022m.h"/>
       </VirtualDirectory>
     </VirtualDirectory>
+    <VirtualDirectory Name="spiflash">
+      <File Name="../../drivers/spiflash/spiflash.h"/>
+      <VirtualDirectory Name="w25q16bv">
+        <File Name="../../drivers/spiflash/w25q16bv/w25q16bv.c"/>
+        <File Name="../../drivers/spiflash/w25q16bv/w25q16bv.h"/>
+      </VirtualDirectory>
+    </VirtualDirectory>
   </VirtualDirectory>
   <VirtualDirectory Name="lpc1xxx">
     <File Name="../../lpc1xxx/linkscript.ld"/>
index 3193043..fea48a7 100644 (file)
   <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;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>
@@ -72,7 +68,7 @@
   <Watches active="0" update="Never" />
  </Watch4>
  <Files>
-  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="52" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="65" 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="76" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="34" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="0" />
  </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" />
 </session>
index a6701ab..e90a8e6 100644 (file)
@@ -350,7 +350,7 @@ void drawString(uint16_t x, uint16_t y, uint16_t color, const FONT_INFO *fontInf
     // Send individual characters
     // We need to manually calculate width in pages since this is screwy with variable width fonts
     //uint8_t heightPages = charWidth % 8 ? charWidth / 8 : charWidth / 8 + 1;
-    drawCharBitmap(currentX, y, color, &fontInfo->data[charOffset], charWidth, fontInfo->height);
+    drawCharBitmap(currentX, y, color, (const char *)(&fontInfo->data[charOffset]), charWidth, fontInfo->height);
 
     // next char X
     currentX += charWidth + 1;
index 909d864..7146938 100644 (file)
@@ -241,8 +241,6 @@ void spiflashWriteEnable (bool enable)
 {
   if (!_w25q16bvInitialised) spiflashInit();
 
-  uint32_t i;
-  
   // ToDo: Put the WP pin in an appropriate state if required
 
   W25Q16BV_SELECT();
@@ -519,9 +517,7 @@ spiflashError_e spiflashEraseChip (void)
 spiflashError_e spiflashWritePage (uint32_t address, uint8_t *buffer, uint32_t len)
 {
   uint8_t status;
-  uint32_t currentpage, totalpages;
-  uint32_t a, i, timeout;
-  a = i = 0;
+  uint32_t i;
 
   if (!_w25q16bvInitialised) spiflashInit();
 
diff --git a/main.c b/main.c
index d0dd354..8b75435 100644 (file)
--- a/main.c
+++ b/main.c
   #include "core/cmd/cmd.h"
 #endif
 
+/**************************************************************************/
+/*! 
+    Approximates a 1 millisecond delay using "nop".  This is less
+    accurate than a dedicated timer, but is useful in certain situations.
+
+    The number of ticks to delay depends on the optimisation level set
+    when compiling (-O).  Depending on the compiler settings, one of the
+    two defined values for 'delay' should be used.
+*/
+/**************************************************************************/
+void delayms(uint32_t ms)
+{
+  uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 45);      // Release Mode (-Os)
+  // uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 120);  // Debug Mode (No optimisations)
+
+  while (delay > 0)
+  {
+    __asm volatile ("nop");
+    delay--;
+  }
+}
+
 /**************************************************************************/
 /*! 
     Main program entry point.  After reset, normal code execution will
This page took 0.036991 seconds and 4 git commands to generate.