Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.

Dependents:   LEDFun NetTester

Fork of N3310LCD by Andrew Lindsay

Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.

Committer:
Searle95
Date:
Thu Aug 01 09:14:23 2013 +0000
Revision:
8:0380b34047ad
Parent:
7:d7edfa5903e6
Modified for use in NetTester project.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SomeRandomBloke 6:46bcc4e584c4 1 /**
SomeRandomBloke 6:46bcc4e584c4 2 * @section DESCRIPTION
SomeRandomBloke 6:46bcc4e584c4 3 * N3310LCD. A program to interface mbed with the nuelectronics
SomeRandomBloke 6:46bcc4e584c4 4 * Nokia 3310 LCD shield from www.nuelectronics.com. Ported from
SomeRandomBloke 6:46bcc4e584c4 5 * the nuelectronics Arduino code.
SomeRandomBloke 6:46bcc4e584c4 6 *
SomeRandomBloke 6:46bcc4e584c4 7 * @section LICENSE
SomeRandomBloke 6:46bcc4e584c4 8 *
SomeRandomBloke 6:46bcc4e584c4 9 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk>
SomeRandomBloke 6:46bcc4e584c4 10 *
SomeRandomBloke 6:46bcc4e584c4 11 * Converted to a mbed library by Andrew D. Lindsay
SomeRandomBloke 6:46bcc4e584c4 12 *
SomeRandomBloke 6:46bcc4e584c4 13 * This file is part of N3310LCD.
SomeRandomBloke 6:46bcc4e584c4 14 *
SomeRandomBloke 6:46bcc4e584c4 15 * N3310LCD is free software: you can redistribute it and/or modify
SomeRandomBloke 6:46bcc4e584c4 16 * it under the terms of the GNU General Public License as published by
SomeRandomBloke 6:46bcc4e584c4 17 * the Free Software Foundation, either version 3 of the License, or
SomeRandomBloke 6:46bcc4e584c4 18 * (at your option) any later version.
SomeRandomBloke 6:46bcc4e584c4 19 *
SomeRandomBloke 6:46bcc4e584c4 20 * N3310LCD is distributed in the hope that it will be useful,
SomeRandomBloke 6:46bcc4e584c4 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
SomeRandomBloke 6:46bcc4e584c4 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
SomeRandomBloke 6:46bcc4e584c4 23 * GNU General Public License for more details.
SomeRandomBloke 6:46bcc4e584c4 24 *
SomeRandomBloke 6:46bcc4e584c4 25 * You should have received a copy of the GNU General Public License
SomeRandomBloke 6:46bcc4e584c4 26 * along with N3310LCD. If not, see <http://www.gnu.org/licenses/>.
SomeRandomBloke 6:46bcc4e584c4 27 */
SomeRandomBloke 0:7efa6655d94b 28
SomeRandomBloke 6:46bcc4e584c4 29 #ifndef N3310SPICONFIG_H
SomeRandomBloke 6:46bcc4e584c4 30 #define N3310SPICONFIG_H
SomeRandomBloke 0:7efa6655d94b 31
SomeRandomBloke 0:7efa6655d94b 32 #include <mbed.h>
SomeRandomBloke 0:7efa6655d94b 33
SomeRandomBloke 0:7efa6655d94b 34 class N3310SPIPort
SomeRandomBloke 0:7efa6655d94b 35 {
SomeRandomBloke 0:7efa6655d94b 36 public:
SomeRandomBloke 0:7efa6655d94b 37 static const PinName MOSI; // Master Out Slave In
SomeRandomBloke 0:7efa6655d94b 38 static const PinName MISO; // Master In Slave Out
SomeRandomBloke 0:7efa6655d94b 39 static const PinName SCK; // SPI clock
SomeRandomBloke 0:7efa6655d94b 40 static const PinName CE; // Chip Enable (aka Chip Select)
SomeRandomBloke 0:7efa6655d94b 41 static const PinName LCD_RST; // LCD reset
SomeRandomBloke 0:7efa6655d94b 42 static const PinName DAT_CMD; // indicates if the SPI write is command or date
SomeRandomBloke 0:7efa6655d94b 43 static const PinName BL_ON; // Back Light On
SomeRandomBloke 1:51961974fe55 44
SomeRandomBloke 0:7efa6655d94b 45 static const PinName AD0; // analog in for joystick
SomeRandomBloke 0:7efa6655d94b 46 };
SomeRandomBloke 0:7efa6655d94b 47
SomeRandomBloke 1:51961974fe55 48 // NOTE pins have been chosen not to conflict with any I2C usage.
SomeRandomBloke 0:7efa6655d94b 49 // MOSI = p5, MISO = p6, SCK = p7 is also an option
Searle95 7:d7edfa5903e6 50 const PinName N3310SPIPort::MOSI = p11;
Searle95 7:d7edfa5903e6 51 const PinName N3310SPIPort::MISO = p12; // not used for 3310
Searle95 7:d7edfa5903e6 52 const PinName N3310SPIPort::SCK = p13;
SomeRandomBloke 0:7efa6655d94b 53
Searle95 7:d7edfa5903e6 54 const PinName N3310SPIPort::CE = p10; // was p21;
Searle95 7:d7edfa5903e6 55 const PinName N3310SPIPort::LCD_RST = p9; // was p22;
Searle95 7:d7edfa5903e6 56 const PinName N3310SPIPort::DAT_CMD = p8; // was p23;
Searle95 7:d7edfa5903e6 57 const PinName N3310SPIPort::BL_ON = p24;
SomeRandomBloke 0:7efa6655d94b 58
Searle95 7:d7edfa5903e6 59 const PinName N3310SPIPort::AD0 = p20; // joystick analog
SomeRandomBloke 0:7efa6655d94b 60
SomeRandomBloke 0:7efa6655d94b 61 /************************************************
SomeRandomBloke 6:46bcc4e584c4 62 *
SomeRandomBloke 0:7efa6655d94b 63 * Nokia 3310 LCD Shield Pins
SomeRandomBloke 0:7efa6655d94b 64 * NOTE: the LCD shield must be powered from a 3.3V supply in order
SomeRandomBloke 0:7efa6655d94b 65 * for the joystick to be read correctly by the mbed analog in
SomeRandomBloke 0:7efa6655d94b 66 * (which operates on a range of 0 - 3.3V).
SomeRandomBloke 0:7efa6655d94b 67 *
SomeRandomBloke 0:7efa6655d94b 68 * Connector J3:
SomeRandomBloke 0:7efa6655d94b 69 * p13: SCK
SomeRandomBloke 0:7efa6655d94b 70 * p12: MISO (not used)
SomeRandomBloke 0:7efa6655d94b 71 * p11: MOSI
SomeRandomBloke 0:7efa6655d94b 72 * p10: CE
SomeRandomBloke 0:7efa6655d94b 73 * p9: LCD_RST
SomeRandomBloke 0:7efa6655d94b 74 * p8: DAT_CMD
SomeRandomBloke 1:51961974fe55 75 *
SomeRandomBloke 0:7efa6655d94b 76 * Connector J1:
SomeRandomBloke 0:7efa6655d94b 77 * p7: BL_ON
SomeRandomBloke 0:7efa6655d94b 78 *
SomeRandomBloke 0:7efa6655d94b 79 * Connector J2:
SomeRandomBloke 0:7efa6655d94b 80 * p1 : AD0
SomeRandomBloke 0:7efa6655d94b 81 *
SomeRandomBloke 0:7efa6655d94b 82 **************************************************/
SomeRandomBloke 0:7efa6655d94b 83
SomeRandomBloke 0:7efa6655d94b 84 #endif