Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.
Fork of N3310LCD by
Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.
N3310LCD.h@1:51961974fe55, 2013-03-10 (annotated)
- Committer:
- SomeRandomBloke
- Date:
- Sun Mar 10 18:29:09 2013 +0000
- Revision:
- 1:51961974fe55
- Parent:
- 0:7efa6655d94b
- Child:
- 3:9808f63fd2fe
reformatted code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SomeRandomBloke | 0:7efa6655d94b | 1 | /* |
SomeRandomBloke | 0:7efa6655d94b | 2 | * N3310LCD. A program to interface mbed with the nuelectronics |
SomeRandomBloke | 0:7efa6655d94b | 3 | * Nokia 3310 LCD shield from www.nuelectronics.com. Ported from |
SomeRandomBloke | 0:7efa6655d94b | 4 | * the nuelectronics Arduino code. |
SomeRandomBloke | 0:7efa6655d94b | 5 | * |
SomeRandomBloke | 0:7efa6655d94b | 6 | * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> |
SomeRandomBloke | 0:7efa6655d94b | 7 | * |
SomeRandomBloke | 0:7efa6655d94b | 8 | * Converted to a mbed library by Andrew D. Lindsay |
SomeRandomBloke | 0:7efa6655d94b | 9 | * |
SomeRandomBloke | 0:7efa6655d94b | 10 | * This file is part of N3310LCD. |
SomeRandomBloke | 0:7efa6655d94b | 11 | * |
SomeRandomBloke | 0:7efa6655d94b | 12 | * N3310LCD is free software: you can redistribute it and/or modify |
SomeRandomBloke | 0:7efa6655d94b | 13 | * it under the terms of the GNU General Public License as published by |
SomeRandomBloke | 0:7efa6655d94b | 14 | * the Free Software Foundation, either version 3 of the License, or |
SomeRandomBloke | 0:7efa6655d94b | 15 | * (at your option) any later version. |
SomeRandomBloke | 1:51961974fe55 | 16 | * |
SomeRandomBloke | 0:7efa6655d94b | 17 | * N3310LCD is distributed in the hope that it will be useful, |
SomeRandomBloke | 0:7efa6655d94b | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
SomeRandomBloke | 0:7efa6655d94b | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
SomeRandomBloke | 0:7efa6655d94b | 20 | * GNU General Public License for more details. |
SomeRandomBloke | 0:7efa6655d94b | 21 | * |
SomeRandomBloke | 0:7efa6655d94b | 22 | * You should have received a copy of the GNU General Public License |
SomeRandomBloke | 0:7efa6655d94b | 23 | * along with N3310LCD. If not, see <http://www.gnu.org/licenses/>. |
SomeRandomBloke | 0:7efa6655d94b | 24 | */ |
SomeRandomBloke | 0:7efa6655d94b | 25 | |
SomeRandomBloke | 0:7efa6655d94b | 26 | #ifndef SNATCH59_N3310LCD_H |
SomeRandomBloke | 0:7efa6655d94b | 27 | #define SNATCH59_N3310LCD_H |
SomeRandomBloke | 0:7efa6655d94b | 28 | |
SomeRandomBloke | 0:7efa6655d94b | 29 | #include <mbed.h> |
SomeRandomBloke | 0:7efa6655d94b | 30 | #include "N3310LCDDefs.h" |
SomeRandomBloke | 0:7efa6655d94b | 31 | |
SomeRandomBloke | 0:7efa6655d94b | 32 | #define LCDCOLMAX 84 |
SomeRandomBloke | 0:7efa6655d94b | 33 | #define LCDROWMAX 6 |
SomeRandomBloke | 0:7efa6655d94b | 34 | #define LCDPIXELROWMAX 48 |
SomeRandomBloke | 0:7efa6655d94b | 35 | #define PIXEL_OFF 0 |
SomeRandomBloke | 0:7efa6655d94b | 36 | #define PIXEL_ON 1 |
SomeRandomBloke | 0:7efa6655d94b | 37 | #define PIXEL_XOR 2 |
SomeRandomBloke | 0:7efa6655d94b | 38 | |
SomeRandomBloke | 0:7efa6655d94b | 39 | class N3310LCD |
SomeRandomBloke | 0:7efa6655d94b | 40 | { |
SomeRandomBloke | 0:7efa6655d94b | 41 | public: |
SomeRandomBloke | 1:51961974fe55 | 42 | N3310LCD(PinName mosi, PinName miso, PinName sck, |
SomeRandomBloke | 0:7efa6655d94b | 43 | PinName ce, PinName dat_cmd, PinName lcd_rst, PinName bl_on); |
SomeRandomBloke | 1:51961974fe55 | 44 | |
SomeRandomBloke | 0:7efa6655d94b | 45 | void init(); |
SomeRandomBloke | 0:7efa6655d94b | 46 | void cls(); |
SomeRandomBloke | 0:7efa6655d94b | 47 | void backlight(eBacklight state); |
SomeRandomBloke | 1:51961974fe55 | 48 | void write(BYTE data, eRequestType req_type); |
SomeRandomBloke | 0:7efa6655d94b | 49 | void locate(BYTE xPos, BYTE yPos); |
SomeRandomBloke | 1:51961974fe55 | 50 | |
SomeRandomBloke | 0:7efa6655d94b | 51 | void drawBitmap(BYTE xPos, BYTE yPos, BYTE* bitmap, BYTE bmpXSize, BYTE bmpYSize); |
SomeRandomBloke | 0:7efa6655d94b | 52 | void clearBitmap(BYTE xPos,BYTE yPos, BYTE size_x, BYTE size_y); |
SomeRandomBloke | 1:51961974fe55 | 53 | void writeString(BYTE xPos, BYTE yPos, char* string, eDisplayMode mode); |
SomeRandomBloke | 0:7efa6655d94b | 54 | void writeStringBig(BYTE xPos, BYTE yPos, char* string, eDisplayMode mode); |
SomeRandomBloke | 0:7efa6655d94b | 55 | void writeChar(BYTE ch, eDisplayMode mode); |
SomeRandomBloke | 0:7efa6655d94b | 56 | void writeCharBig(BYTE xPos, BYTE yPos, BYTE ch, eDisplayMode mode); |
SomeRandomBloke | 1:51961974fe55 | 57 | |
SomeRandomBloke | 1:51961974fe55 | 58 | void setPixel( BYTE x, BYTE y, BYTE c ); |
SomeRandomBloke | 0:7efa6655d94b | 59 | void drawLine(BYTE x1, BYTE y1, BYTE x2, BYTE y2, BYTE c); |
SomeRandomBloke | 0:7efa6655d94b | 60 | void drawRectangle(BYTE x1, BYTE y1,BYTE x2, BYTE y2, BYTE c); |
SomeRandomBloke | 0:7efa6655d94b | 61 | void drawFilledRectangle(BYTE x1, BYTE y1, BYTE x2, BYTE y2, BYTE c); |
SomeRandomBloke | 0:7efa6655d94b | 62 | void drawCircle(BYTE xc, BYTE yc, BYTE r, BYTE c); |
SomeRandomBloke | 1:51961974fe55 | 63 | |
SomeRandomBloke | 0:7efa6655d94b | 64 | private: |
SomeRandomBloke | 0:7efa6655d94b | 65 | // I/O |
SomeRandomBloke | 0:7efa6655d94b | 66 | SPI lcdPort; // does SPI MOSI, MISO and SCK |
SomeRandomBloke | 0:7efa6655d94b | 67 | DigitalOut ceWire; // does SPI CE |
SomeRandomBloke | 0:7efa6655d94b | 68 | DigitalOut dcWire; // does 3310 DAT_CMD |
SomeRandomBloke | 0:7efa6655d94b | 69 | DigitalOut rstWire; // does 3310 LCD_RST |
SomeRandomBloke | 1:51961974fe55 | 70 | DigitalOut blWire; // does 3310 BL_ON (backlight) |
SomeRandomBloke | 0:7efa6655d94b | 71 | }; |
SomeRandomBloke | 0:7efa6655d94b | 72 | |
SomeRandomBloke | 0:7efa6655d94b | 73 | #endif |