
N3310LCD library demo
Fork of N3310LCD by
N3310LCD.h@0:36fb749b83c7, 2009-12-07 (annotated)
- Committer:
- snatch59
- Date:
- Mon Dec 07 17:24:52 2009 +0000
- Revision:
- 0:36fb749b83c7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
snatch59 | 0:36fb749b83c7 | 1 | /* |
snatch59 | 0:36fb749b83c7 | 2 | * N3310LCD. A program to interface mbed with the nuelectronics |
snatch59 | 0:36fb749b83c7 | 3 | * Nokia 3310 LCD shield from www.nuelectronics.com. Ported from |
snatch59 | 0:36fb749b83c7 | 4 | * the nuelectronics Arduino code. |
snatch59 | 0:36fb749b83c7 | 5 | * |
snatch59 | 0:36fb749b83c7 | 6 | * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> |
snatch59 | 0:36fb749b83c7 | 7 | * |
snatch59 | 0:36fb749b83c7 | 8 | * This file is part of N3310LCD. |
snatch59 | 0:36fb749b83c7 | 9 | * |
snatch59 | 0:36fb749b83c7 | 10 | * N3310LCD is free software: you can redistribute it and/or modify |
snatch59 | 0:36fb749b83c7 | 11 | * it under the terms of the GNU General Public License as published by |
snatch59 | 0:36fb749b83c7 | 12 | * the Free Software Foundation, either version 3 of the License, or |
snatch59 | 0:36fb749b83c7 | 13 | * (at your option) any later version. |
snatch59 | 0:36fb749b83c7 | 14 | * |
snatch59 | 0:36fb749b83c7 | 15 | * N3310LCD is distributed in the hope that it will be useful, |
snatch59 | 0:36fb749b83c7 | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
snatch59 | 0:36fb749b83c7 | 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
snatch59 | 0:36fb749b83c7 | 18 | * GNU General Public License for more details. |
snatch59 | 0:36fb749b83c7 | 19 | * |
snatch59 | 0:36fb749b83c7 | 20 | * You should have received a copy of the GNU General Public License |
snatch59 | 0:36fb749b83c7 | 21 | * along with N3310LCD. If not, see <http://www.gnu.org/licenses/>. |
snatch59 | 0:36fb749b83c7 | 22 | */ |
snatch59 | 0:36fb749b83c7 | 23 | |
snatch59 | 0:36fb749b83c7 | 24 | #ifndef SNATCH59_N3310LCD_H |
snatch59 | 0:36fb749b83c7 | 25 | #define SNATCH59_N3310LCD_H |
snatch59 | 0:36fb749b83c7 | 26 | |
snatch59 | 0:36fb749b83c7 | 27 | #include <mbed.h> |
snatch59 | 0:36fb749b83c7 | 28 | #include "N3310LCDDefs.h" |
snatch59 | 0:36fb749b83c7 | 29 | |
snatch59 | 0:36fb749b83c7 | 30 | class N3310LCD |
snatch59 | 0:36fb749b83c7 | 31 | { |
snatch59 | 0:36fb749b83c7 | 32 | public: |
snatch59 | 0:36fb749b83c7 | 33 | N3310LCD(PinName mosi, PinName miso, PinName sck, |
snatch59 | 0:36fb749b83c7 | 34 | PinName ce, PinName dat_cmd, PinName lcd_rst, PinName bl_on); |
snatch59 | 0:36fb749b83c7 | 35 | |
snatch59 | 0:36fb749b83c7 | 36 | void init(); |
snatch59 | 0:36fb749b83c7 | 37 | void cls(); |
snatch59 | 0:36fb749b83c7 | 38 | void backlight(eBacklight state); |
snatch59 | 0:36fb749b83c7 | 39 | void write(BYTE data, eRequestType req_type); |
snatch59 | 0:36fb749b83c7 | 40 | void locate(BYTE xPos, BYTE yPos); |
snatch59 | 0:36fb749b83c7 | 41 | |
snatch59 | 0:36fb749b83c7 | 42 | void drawBitmap(BYTE xPos, BYTE yPos, BYTE* bitmap, BYTE bmpXSize, BYTE bmpYSize); |
snatch59 | 0:36fb749b83c7 | 43 | void writeString(BYTE xPos, BYTE yPos, char* string, eDisplayMode mode); |
snatch59 | 0:36fb749b83c7 | 44 | void writeStringBig(BYTE xPos, BYTE yPos, char* string, eDisplayMode mode); |
snatch59 | 0:36fb749b83c7 | 45 | void writeChar(BYTE ch, eDisplayMode mode); |
snatch59 | 0:36fb749b83c7 | 46 | void writeCharBig(BYTE xPos, BYTE yPos, BYTE ch, eDisplayMode mode); |
snatch59 | 0:36fb749b83c7 | 47 | |
snatch59 | 0:36fb749b83c7 | 48 | private: |
snatch59 | 0:36fb749b83c7 | 49 | // I/O |
snatch59 | 0:36fb749b83c7 | 50 | SPI lcdPort; // does SPI MOSI, MISO and SCK |
snatch59 | 0:36fb749b83c7 | 51 | DigitalOut ceWire; // does SPI CE |
snatch59 | 0:36fb749b83c7 | 52 | DigitalOut dcWire; // does 3310 DAT_CMD |
snatch59 | 0:36fb749b83c7 | 53 | DigitalOut rstWire; // does 3310 LCD_RST |
snatch59 | 0:36fb749b83c7 | 54 | DigitalOut blWire; // does 3310 BL_ON (backlight) |
snatch59 | 0:36fb749b83c7 | 55 | }; |
snatch59 | 0:36fb749b83c7 | 56 | |
snatch59 | 0:36fb749b83c7 | 57 | #endif |