Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.
Dependents: N3310LCD_Demo FRDM_N3110LCD
N3310SPIConfig.h@0:7efa6655d94b, 2013-03-10 (annotated)
- Committer:
- SomeRandomBloke
- Date:
- Sun Mar 10 18:15:25 2013 +0000
- Revision:
- 0:7efa6655d94b
- Child:
- 1:51961974fe55
initial commit
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 | 0:7efa6655d94b | 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_N3310SPICONFIG_H |
SomeRandomBloke | 0:7efa6655d94b | 27 | #define SNATCH59_N3310SPICONFIG_H |
SomeRandomBloke | 0:7efa6655d94b | 28 | |
SomeRandomBloke | 0:7efa6655d94b | 29 | #include <mbed.h> |
SomeRandomBloke | 0:7efa6655d94b | 30 | |
SomeRandomBloke | 0:7efa6655d94b | 31 | class N3310SPIPort |
SomeRandomBloke | 0:7efa6655d94b | 32 | { |
SomeRandomBloke | 0:7efa6655d94b | 33 | public: |
SomeRandomBloke | 0:7efa6655d94b | 34 | static const PinName MOSI; // Master Out Slave In |
SomeRandomBloke | 0:7efa6655d94b | 35 | static const PinName MISO; // Master In Slave Out |
SomeRandomBloke | 0:7efa6655d94b | 36 | static const PinName SCK; // SPI clock |
SomeRandomBloke | 0:7efa6655d94b | 37 | static const PinName CE; // Chip Enable (aka Chip Select) |
SomeRandomBloke | 0:7efa6655d94b | 38 | static const PinName LCD_RST; // LCD reset |
SomeRandomBloke | 0:7efa6655d94b | 39 | static const PinName DAT_CMD; // indicates if the SPI write is command or date |
SomeRandomBloke | 0:7efa6655d94b | 40 | static const PinName BL_ON; // Back Light On |
SomeRandomBloke | 0:7efa6655d94b | 41 | |
SomeRandomBloke | 0:7efa6655d94b | 42 | static const PinName AD0; // analog in for joystick |
SomeRandomBloke | 0:7efa6655d94b | 43 | }; |
SomeRandomBloke | 0:7efa6655d94b | 44 | |
SomeRandomBloke | 0:7efa6655d94b | 45 | // NOTE pins have been chosen not to conflict with any I2C usage. |
SomeRandomBloke | 0:7efa6655d94b | 46 | // MOSI = p5, MISO = p6, SCK = p7 is also an option |
SomeRandomBloke | 0:7efa6655d94b | 47 | const PinName N3310SPIPort::MOSI = PTD2; |
SomeRandomBloke | 0:7efa6655d94b | 48 | const PinName N3310SPIPort::MISO = PTD3; // not used for 3310 |
SomeRandomBloke | 0:7efa6655d94b | 49 | const PinName N3310SPIPort::SCK = PTD1; |
SomeRandomBloke | 0:7efa6655d94b | 50 | |
SomeRandomBloke | 0:7efa6655d94b | 51 | //const PinName N3310SPIPort::CE = PTC8; // Alternative test display with CE on pin 6 instead of 10 |
SomeRandomBloke | 0:7efa6655d94b | 52 | const PinName N3310SPIPort::CE = PTD0; |
SomeRandomBloke | 0:7efa6655d94b | 53 | const PinName N3310SPIPort::LCD_RST = PTD5; |
SomeRandomBloke | 0:7efa6655d94b | 54 | const PinName N3310SPIPort::DAT_CMD = PTA13; |
SomeRandomBloke | 0:7efa6655d94b | 55 | const PinName N3310SPIPort::BL_ON = PTC9; |
SomeRandomBloke | 0:7efa6655d94b | 56 | |
SomeRandomBloke | 0:7efa6655d94b | 57 | const PinName N3310SPIPort::AD0 = PTB0; // joystick analog |
SomeRandomBloke | 0:7efa6655d94b | 58 | |
SomeRandomBloke | 0:7efa6655d94b | 59 | /************************************************ |
SomeRandomBloke | 0:7efa6655d94b | 60 | * |
SomeRandomBloke | 0:7efa6655d94b | 61 | * Nokia 3310 LCD Shield Pins |
SomeRandomBloke | 0:7efa6655d94b | 62 | * NOTE: the LCD shield must be powered from a 3.3V supply in order |
SomeRandomBloke | 0:7efa6655d94b | 63 | * for the joystick to be read correctly by the mbed analog in |
SomeRandomBloke | 0:7efa6655d94b | 64 | * (which operates on a range of 0 - 3.3V). |
SomeRandomBloke | 0:7efa6655d94b | 65 | * |
SomeRandomBloke | 0:7efa6655d94b | 66 | * Connector J3: |
SomeRandomBloke | 0:7efa6655d94b | 67 | * p13: SCK |
SomeRandomBloke | 0:7efa6655d94b | 68 | * p12: MISO (not used) |
SomeRandomBloke | 0:7efa6655d94b | 69 | * p11: MOSI |
SomeRandomBloke | 0:7efa6655d94b | 70 | * p10: CE |
SomeRandomBloke | 0:7efa6655d94b | 71 | * p9: LCD_RST |
SomeRandomBloke | 0:7efa6655d94b | 72 | * p8: DAT_CMD |
SomeRandomBloke | 0:7efa6655d94b | 73 | * |
SomeRandomBloke | 0:7efa6655d94b | 74 | * Connector J1: |
SomeRandomBloke | 0:7efa6655d94b | 75 | * p7: BL_ON |
SomeRandomBloke | 0:7efa6655d94b | 76 | * |
SomeRandomBloke | 0:7efa6655d94b | 77 | * Connector J2: |
SomeRandomBloke | 0:7efa6655d94b | 78 | * p1 : AD0 |
SomeRandomBloke | 0:7efa6655d94b | 79 | * |
SomeRandomBloke | 0:7efa6655d94b | 80 | **************************************************/ |
SomeRandomBloke | 0:7efa6655d94b | 81 | |
SomeRandomBloke | 0:7efa6655d94b | 82 | #endif |