A "Hello" program for MARMEX_VB library. This application may work 40pin type mbed platforms ;) This application expects to have the MARMEX_VB module on a "MAPLE mini type-B (MARM03-BASE)" baseboard (slot2) with a MARMEX_OB module (on slot1)

Dependencies:   MARMEX_VB NokiaLCD mbed

Sample code for MARMEX-VB (MARY-VB) camera module.
/media/uploads/nxpfan/dsc_0497s.png

This is a very simple program just copies the data from camera to OELD.
/media/uploads/nxpfan/dsc_0513.jpg

Committer:
nxpfan
Date:
Fri Jun 20 09:19:00 2014 +0000
Revision:
2:7294334432d4
Parent:
0:139f0c46d0fd
sample code with latest libraries (SPI-FIFO optimize option version)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nxpfan 0:139f0c46d0fd 1 /* mbed NokiaLCD Library, for a 130x130 Nokia colour LCD
nxpfan 0:139f0c46d0fd 2 * Copyright (c) 2007-2010, sford
nxpfan 0:139f0c46d0fd 3 *
nxpfan 0:139f0c46d0fd 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
nxpfan 0:139f0c46d0fd 5 * of this software and associated documentation files (the "Software"), to deal
nxpfan 0:139f0c46d0fd 6 * in the Software without restriction, including without limitation the rights
nxpfan 0:139f0c46d0fd 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
nxpfan 0:139f0c46d0fd 8 * copies of the Software, and to permit persons to whom the Software is
nxpfan 0:139f0c46d0fd 9 * furnished to do so, subject to the following conditions:
nxpfan 0:139f0c46d0fd 10 *
nxpfan 0:139f0c46d0fd 11 * The above copyright notice and this permission notice shall be included in
nxpfan 0:139f0c46d0fd 12 * all copies or substantial portions of the Software.
nxpfan 0:139f0c46d0fd 13 *
nxpfan 0:139f0c46d0fd 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
nxpfan 0:139f0c46d0fd 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
nxpfan 0:139f0c46d0fd 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
nxpfan 0:139f0c46d0fd 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
nxpfan 0:139f0c46d0fd 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
nxpfan 0:139f0c46d0fd 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
nxpfan 0:139f0c46d0fd 20 * THE SOFTWARE.
nxpfan 0:139f0c46d0fd 21 */
nxpfan 0:139f0c46d0fd 22
nxpfan 0:139f0c46d0fd 23 #ifndef MBED_NOKIALCD_H
nxpfan 0:139f0c46d0fd 24 #define MBED_NOKIALCD_H
nxpfan 0:139f0c46d0fd 25
nxpfan 0:139f0c46d0fd 26 #include "mbed.h"
nxpfan 0:139f0c46d0fd 27
nxpfan 0:139f0c46d0fd 28 /** An interface for the 130x130 Nokia Mobile phone screens
nxpfan 0:139f0c46d0fd 29 *
nxpfan 0:139f0c46d0fd 30 * @code
nxpfan 0:139f0c46d0fd 31 * #include "mbed.h"
nxpfan 0:139f0c46d0fd 32 * #include "NokiaLCD.h"
nxpfan 0:139f0c46d0fd 33 *
nxpfan 0:139f0c46d0fd 34 * NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::6610); // mosi, sclk, cs, rst, type
nxpfan 0:139f0c46d0fd 35 *
nxpfan 0:139f0c46d0fd 36 * int main() {
nxpfan 0:139f0c46d0fd 37 * lcd.printf("Hello World!");
nxpfan 0:139f0c46d0fd 38 * }
nxpfan 0:139f0c46d0fd 39 * @endcode
nxpfan 0:139f0c46d0fd 40 */
nxpfan 0:139f0c46d0fd 41 class NokiaLCD : public Stream {
nxpfan 0:139f0c46d0fd 42
nxpfan 0:139f0c46d0fd 43 public:
nxpfan 0:139f0c46d0fd 44 /** LCD panel format */
nxpfan 0:139f0c46d0fd 45 enum LCDType {
nxpfan 0:139f0c46d0fd 46 LCD6100 /**< Nokia 6100, as found on sparkfun board (default) */
nxpfan 0:139f0c46d0fd 47 , LCD6610 /**< Nokia 6610, as found on olimex board */
nxpfan 0:139f0c46d0fd 48 , PCF8833
nxpfan 0:139f0c46d0fd 49 };
nxpfan 0:139f0c46d0fd 50
nxpfan 0:139f0c46d0fd 51 /** Create and Nokia LCD interface, using a SPI and two DigitalOut interfaces
nxpfan 0:139f0c46d0fd 52 *
nxpfan 0:139f0c46d0fd 53 * @param mosi SPI data out
nxpfan 0:139f0c46d0fd 54 * @param sclk SPI clock
nxpfan 0:139f0c46d0fd 55 * @param cs Chip Select (DigitalOut)
nxpfan 0:139f0c46d0fd 56 * @param rst Reset (DigitalOut)
nxpfan 0:139f0c46d0fd 57 * @param type The LCDType to select driver chip variants
nxpfan 0:139f0c46d0fd 58 */
nxpfan 0:139f0c46d0fd 59 NokiaLCD(PinName mosi, PinName sclk, PinName cs, PinName rst, LCDType type = LCD6100);
nxpfan 0:139f0c46d0fd 60
nxpfan 0:139f0c46d0fd 61 #if DOXYGEN_ONLY
nxpfan 0:139f0c46d0fd 62 /** Write a character to the LCD
nxpfan 0:139f0c46d0fd 63 *
nxpfan 0:139f0c46d0fd 64 * @param c The character to write to the display
nxpfan 0:139f0c46d0fd 65 */
nxpfan 0:139f0c46d0fd 66 int putc(int c);
nxpfan 0:139f0c46d0fd 67
nxpfan 0:139f0c46d0fd 68 /** Write a formated string to the LCD
nxpfan 0:139f0c46d0fd 69 *
nxpfan 0:139f0c46d0fd 70 * @param format A printf-style format string, followed by the
nxpfan 0:139f0c46d0fd 71 * variables to use in formating the string.
nxpfan 0:139f0c46d0fd 72 */
nxpfan 0:139f0c46d0fd 73 int printf(const char* format, ...);
nxpfan 0:139f0c46d0fd 74 #endif
nxpfan 0:139f0c46d0fd 75
nxpfan 0:139f0c46d0fd 76 /** Locate to a screen column and row
nxpfan 0:139f0c46d0fd 77 *
nxpfan 0:139f0c46d0fd 78 * @param column The horizontal position from the left, indexed from 0
nxpfan 0:139f0c46d0fd 79 * @param row The vertical position from the top, indexed from 0
nxpfan 0:139f0c46d0fd 80 */
nxpfan 0:139f0c46d0fd 81 void locate(int column, int row);
nxpfan 0:139f0c46d0fd 82
nxpfan 0:139f0c46d0fd 83 /** Clear the screen and locate to 0,0 */
nxpfan 0:139f0c46d0fd 84 void cls();
nxpfan 0:139f0c46d0fd 85
nxpfan 0:139f0c46d0fd 86 /** Set a pixel on te screen
nxpfan 0:139f0c46d0fd 87 *
nxpfan 0:139f0c46d0fd 88 * @param x horizontal position from left
nxpfan 0:139f0c46d0fd 89 * @param y vertical position from top
nxpfan 0:139f0c46d0fd 90 * @param colour 24-bit colour in format 0x00RRGGBB
nxpfan 0:139f0c46d0fd 91 */
nxpfan 0:139f0c46d0fd 92 void pixel(int x, int y, int colour);
nxpfan 0:139f0c46d0fd 93
nxpfan 0:139f0c46d0fd 94 /** Fill an area of the screen
nxpfan 0:139f0c46d0fd 95 *
nxpfan 0:139f0c46d0fd 96 * @param x horizontal position from left
nxpfan 0:139f0c46d0fd 97 * @param y vertical position from top
nxpfan 0:139f0c46d0fd 98 * @param width width in pixels
nxpfan 0:139f0c46d0fd 99 * @param height height in pixels
nxpfan 0:139f0c46d0fd 100 * @param colour 24-bit colour in format 0x00RRGGBB
nxpfan 0:139f0c46d0fd 101 */
nxpfan 0:139f0c46d0fd 102 void fill(int x, int y, int width, int height, int colour);
nxpfan 0:139f0c46d0fd 103
nxpfan 0:139f0c46d0fd 104 void blit(int x, int y, int width, int height, const int* colour);
nxpfan 0:139f0c46d0fd 105 void bitblit(int x, int y, int width, int height, const char* bitstream);
nxpfan 0:139f0c46d0fd 106
nxpfan 0:139f0c46d0fd 107 int width();
nxpfan 0:139f0c46d0fd 108 int height();
nxpfan 0:139f0c46d0fd 109 int columns();
nxpfan 0:139f0c46d0fd 110 int rows();
nxpfan 0:139f0c46d0fd 111
nxpfan 0:139f0c46d0fd 112 void reset();
nxpfan 0:139f0c46d0fd 113
nxpfan 0:139f0c46d0fd 114 /** Set the foreground colour
nxpfan 0:139f0c46d0fd 115 *
nxpfan 0:139f0c46d0fd 116 * @param c 24-bit colour
nxpfan 0:139f0c46d0fd 117 */
nxpfan 0:139f0c46d0fd 118 void foreground(int c);
nxpfan 0:139f0c46d0fd 119
nxpfan 0:139f0c46d0fd 120 /** Set the background colour
nxpfan 0:139f0c46d0fd 121 *
nxpfan 0:139f0c46d0fd 122 * @param c 24-bit colour
nxpfan 0:139f0c46d0fd 123 */
nxpfan 0:139f0c46d0fd 124 void background(int c);
nxpfan 0:139f0c46d0fd 125
nxpfan 0:139f0c46d0fd 126 protected:
nxpfan 0:139f0c46d0fd 127 virtual void _window(int x, int y, int width, int height);
nxpfan 0:139f0c46d0fd 128 virtual void _putp(int colour);
nxpfan 0:139f0c46d0fd 129
nxpfan 0:139f0c46d0fd 130 void command(int value);
nxpfan 0:139f0c46d0fd 131 void data(int value);
nxpfan 0:139f0c46d0fd 132
nxpfan 0:139f0c46d0fd 133 void newline();
nxpfan 0:139f0c46d0fd 134 virtual int _putc(int c);
nxpfan 0:139f0c46d0fd 135 virtual int _getc() {
nxpfan 0:139f0c46d0fd 136 return 0;
nxpfan 0:139f0c46d0fd 137 }
nxpfan 0:139f0c46d0fd 138 void putp(int v);
nxpfan 0:139f0c46d0fd 139 void window(int x, int y, int width, int height);
nxpfan 0:139f0c46d0fd 140
nxpfan 0:139f0c46d0fd 141 SPI _spi;
nxpfan 0:139f0c46d0fd 142 DigitalOut _rst;
nxpfan 0:139f0c46d0fd 143 DigitalOut _cs;
nxpfan 0:139f0c46d0fd 144
nxpfan 0:139f0c46d0fd 145 LCDType _type;
nxpfan 0:139f0c46d0fd 146 int _row, _column, _rows, _columns, _foreground, _background, _width, _height;
nxpfan 0:139f0c46d0fd 147 };
nxpfan 0:139f0c46d0fd 148
nxpfan 0:139f0c46d0fd 149 #endif
nxpfan 0:139f0c46d0fd 150
nxpfan 0:139f0c46d0fd 151