MARMEX_VB test application program. This application works on "mbed NXP LPC1768" only. This application expects to have the MARMEX_VB module on a "MAPLE mini type-B (MARM03-BASE)" baseboard (slot2) with MARMEX_OB module (on slot1)

Dependencies:   MARMEX_VB NokiaLCD mbed

This is the library test program.
The program can test features of the library (refer to MARMEX-VB's API document) and can save captured data into BMP file.

Warning!

This test program can run on "mbed NXP LPC1768" only.

/media/uploads/nxpfan/dsc_0506_-1-.jpg
Picture : sample of test program operation
The modules of MARMEX-VB and MARMEX-OB are set on the "MAPLE mini type-B (MARM03-BASE)" baseboard.
The image data from camera is mirrored and alpha graphics added by software.

Files at this revision

API Documentation at this revision

Comitter:
nxpfan
Date:
Mon Jun 09 19:42:34 2014 +0000
Parent:
0:343c01965543
Child:
2:a35c919aa9c2
Commit message:
MARMEX-VB test version 0.2 (mbed_NXP_LPC1768 optimization added)

Changed in this revision

MARMEX_OB_oled.h Show annotated file Show diff for this revision Revisions of this file
MARMEX_VB.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MARMEX_OB_oled.h	Fri Jun 06 03:37:02 2014 +0000
+++ b/MARMEX_OB_oled.h	Mon Jun 09 19:42:34 2014 +0000
@@ -2,8 +2,8 @@
  *
  *  @class   MARMEX_OB_oled
  *  @author  tedd
- *  @version 0.51
- *  @date    08-Apr-2011
+ *  @version 0.52 (optimized for "mbed NXP LPC1768")
+ *  @date    06-Jun-2014
  *
  *  Released under the MIT License: http://mbed.org/license/mit
  *
@@ -30,7 +30,7 @@
  *
  *  If disabled (just coment out the "#define MARMEX_OB_SPI_8BIT_MODE"), SPI access willbe done by 9 bit format.
  */
-#define MARMEX_OB_SPI_8BIT_MODE
+//#define MARMEX_OB_SPI_8BIT_MODE
 
 /** MARMEX_OB_oled OLED screen drawing class
  *
@@ -71,7 +71,8 @@
  *  @endcode
  */
 
-class MARMEX_OB_oled : public NokiaLCD {
+class MARMEX_OB_oled : public NokiaLCD
+{
 
 public:
 
@@ -318,13 +319,85 @@
         _cs = 1;
     }
 
-    void blit565( int x, int y, int width, int height, const short* colour ) {
+    void blit565( int x, int y, int width, int height, short* colour ) {
         _cs = 0;
         _window( x, y, width, height );
 
+#define OPTIMIZE_BY_GPIO_REGISTER_ACCESS
+#if defined( TARGET_MBED_LPC1768 ) && defined (OPTIMIZE_BY_GPIO_REGISTER_ACCESS )
+        LPC_GPIO1->FIOMASK   = ~0x80000000;
+        
+        for (int i = 0; i < width * height; i += 8 ) {
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | (*colour >> 8) );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+
+            LPC_GPIO1->FIOCLR   = 0x80000000;
+            _spi.write( 0x100 | *colour++ );
+            LPC_GPIO1->FIOSET   = 0x80000000;
+        }
+#else
         for (int i = 0; i < width * height; i++ ) {
             _putp565( colour[i] );
         }
+#endif
+
         _window( 0, 0, WIDTH, HEIGHT );
         _cs = 1;
     }
@@ -493,4 +566,3 @@
 
 
 
-
--- a/MARMEX_VB.lib	Fri Jun 06 03:37:02 2014 +0000
+++ b/MARMEX_VB.lib	Mon Jun 09 19:42:34 2014 +0000
@@ -1,1 +1,1 @@
-MARMEX_VB#c4d14dd5d479
+MARMEX_VB#b2324313d4da
--- a/main.cpp	Fri Jun 06 03:37:02 2014 +0000
+++ b/main.cpp	Mon Jun 09 19:42:34 2014 +0000
@@ -1,6 +1,6 @@
 /** Test program for MARMEX_VB Camera control library
  *
- *  @version 0.1
+ *  @version 0.2
  *  @date    10-Jun-2014
  *
  *  Released under the Apache License, Version 2.0 : http://mbed.org/handbook/Apache-Licence
@@ -29,6 +29,7 @@
 void test_camera_resolution_change( void );
 
 void copy_image_from_camera_to_oled( void );
+void copy_image_from_camera_to_oled_small( void );
 void copy_image_from_camera_to_oled_interlaced( void );
 void line_mirroring( short *buf );
 void save_still_image( char *file_name );
@@ -144,7 +145,6 @@
         else
             copy_image_from_camera_to_oled();
 
-
 //        camera.colorbar( ((count++ >> 2) & 0x1) ? MARMEX_VB::ON : MARMEX_VB::OFF );
 
         led    = 0x2;
@@ -197,7 +197,7 @@
 
 void copy_image_from_camera_to_oled( void )
 {
-    short   buf[ MARMEX_OB_oled::WIDTH ];
+    short   buf[ MARMEX_OB_oled::WIDTH ];   //  array size should be multiple of 8 for "mbed LPC1768" optimization
     static int  count   = 0;
 
     camera.open_transfer();
@@ -214,6 +214,23 @@
 }
 
 
+void copy_image_from_camera_to_oled_small( void )
+{
+    short   buf[ 64 ];
+    static int  count   = 0;
+
+    camera.open_transfer();
+
+    for ( int line = 0; line < 64; line++  ) {
+        camera.read_a_line( buf, line, 0, 64 );
+        oled1.blit565( 0, line, 64, 1, buf );
+    }
+
+    count++;
+    camera.close_transfer();
+}
+
+
 void copy_image_from_camera_to_oled_interlaced( void )
 {
     short       buf[ MARMEX_OB_oled::WIDTH ];
@@ -262,7 +279,7 @@
     oled1.locate( 0, 3 );
     oled1.printf( "%s", (MARMEX_VB::NO_ERROR == camera.ready()) ? "Camera is ready" : "No Camera found" );
     oled1.locate( 0, 4 );
-    oled1.printf( "%s", "saving into BMP" );
+    //oled1.printf( "%s", "saving into BMP" );
     oled1.locate( 0, 5 );
     oled1.printf( "%d", camera.get_horizontal_size() );
     oled1.locate( 0, 6 );