Code to interface mbed to a Nokia 3310 LCD using the Nokia 3310 LCD shield from nuelectronics. Includes joystick interface and demo.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers N3310LCD.h Source File

N3310LCD.h

00001 /*
00002 * N3310LCD. A program to interface mbed with the nuelectronics
00003 * Nokia 3310 LCD shield from www.nuelectronics.com. Ported from
00004 * the nuelectronics Arduino code.
00005 *
00006 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk>
00007 *
00008 * This file is part of N3310LCD.
00009 *
00010 * N3310LCD is free software: you can redistribute it and/or modify
00011 * it under the terms of the GNU General Public License as published by
00012 * the Free Software Foundation, either version 3 of the License, or
00013 * (at your option) any later version.
00014 * 
00015 * N3310LCD is distributed in the hope that it will be useful,
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 * GNU General Public License for more details.
00019 *
00020 * You should have received a copy of the GNU General Public License
00021 * along with N3310LCD.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 
00024 #ifndef SNATCH59_N3310LCD_H
00025 #define SNATCH59_N3310LCD_H
00026 
00027 #include <mbed.h>
00028 #include "N3310LCDDefs.h"
00029 
00030 class N3310LCD
00031 {
00032 public:
00033     N3310LCD(PinName mosi, PinName miso, PinName sck, 
00034              PinName ce, PinName dat_cmd, PinName lcd_rst, PinName bl_on);
00035     
00036     void init();
00037     void cls();
00038     void backlight(eBacklight state);
00039     void write(BYTE data, eRequestType req_type);   
00040     void locate(BYTE xPos, BYTE yPos);
00041     
00042     void drawBitmap(BYTE xPos, BYTE yPos, BYTE* bitmap, BYTE bmpXSize, BYTE bmpYSize);
00043     void writeString(BYTE xPos, BYTE yPos, char* string, eDisplayMode mode);                  
00044     void writeStringBig(BYTE xPos, BYTE yPos, char* string, eDisplayMode mode);
00045     void writeChar(BYTE ch, eDisplayMode mode);
00046     void writeCharBig(BYTE xPos, BYTE yPos, BYTE ch, eDisplayMode mode);
00047     
00048 private:
00049     // I/O
00050     SPI lcdPort;            // does SPI MOSI, MISO and SCK
00051     DigitalOut ceWire;      // does SPI CE
00052     DigitalOut dcWire;      // does 3310 DAT_CMD
00053     DigitalOut rstWire;     // does 3310 LCD_RST
00054     DigitalOut blWire;      // does 3310 BL_ON (backlight)    
00055 };
00056 
00057 #endif