Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.
Dependents: N3310LCD_Demo FRDM_N3110LCD
N3310SPIConfig.h@6:46bcc4e584c4, 2013-07-19 (annotated)
- Committer:
- SomeRandomBloke
- Date:
- Fri Jul 19 13:42:00 2013 +0000
- Revision:
- 6:46bcc4e584c4
- Parent:
- 1:51961974fe55
code comments
Who changed what in which revision?
User | Revision | Line number | New 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 |
SomeRandomBloke | 0:7efa6655d94b | 50 | const PinName N3310SPIPort::MOSI = PTD2; |
SomeRandomBloke | 0:7efa6655d94b | 51 | const PinName N3310SPIPort::MISO = PTD3; // not used for 3310 |
SomeRandomBloke | 0:7efa6655d94b | 52 | const PinName N3310SPIPort::SCK = PTD1; |
SomeRandomBloke | 0:7efa6655d94b | 53 | |
SomeRandomBloke | 0:7efa6655d94b | 54 | //const PinName N3310SPIPort::CE = PTC8; // Alternative test display with CE on pin 6 instead of 10 |
SomeRandomBloke | 0:7efa6655d94b | 55 | const PinName N3310SPIPort::CE = PTD0; |
SomeRandomBloke | 0:7efa6655d94b | 56 | const PinName N3310SPIPort::LCD_RST = PTD5; |
SomeRandomBloke | 0:7efa6655d94b | 57 | const PinName N3310SPIPort::DAT_CMD = PTA13; |
SomeRandomBloke | 0:7efa6655d94b | 58 | const PinName N3310SPIPort::BL_ON = PTC9; |
SomeRandomBloke | 0:7efa6655d94b | 59 | |
SomeRandomBloke | 0:7efa6655d94b | 60 | const PinName N3310SPIPort::AD0 = PTB0; // joystick analog |
SomeRandomBloke | 0:7efa6655d94b | 61 | |
SomeRandomBloke | 0:7efa6655d94b | 62 | /************************************************ |
SomeRandomBloke | 6:46bcc4e584c4 | 63 | * |
SomeRandomBloke | 0:7efa6655d94b | 64 | * Nokia 3310 LCD Shield Pins |
SomeRandomBloke | 0:7efa6655d94b | 65 | * NOTE: the LCD shield must be powered from a 3.3V supply in order |
SomeRandomBloke | 0:7efa6655d94b | 66 | * for the joystick to be read correctly by the mbed analog in |
SomeRandomBloke | 0:7efa6655d94b | 67 | * (which operates on a range of 0 - 3.3V). |
SomeRandomBloke | 0:7efa6655d94b | 68 | * |
SomeRandomBloke | 0:7efa6655d94b | 69 | * Connector J3: |
SomeRandomBloke | 0:7efa6655d94b | 70 | * p13: SCK |
SomeRandomBloke | 0:7efa6655d94b | 71 | * p12: MISO (not used) |
SomeRandomBloke | 0:7efa6655d94b | 72 | * p11: MOSI |
SomeRandomBloke | 0:7efa6655d94b | 73 | * p10: CE |
SomeRandomBloke | 0:7efa6655d94b | 74 | * p9: LCD_RST |
SomeRandomBloke | 0:7efa6655d94b | 75 | * p8: DAT_CMD |
SomeRandomBloke | 1:51961974fe55 | 76 | * |
SomeRandomBloke | 0:7efa6655d94b | 77 | * Connector J1: |
SomeRandomBloke | 0:7efa6655d94b | 78 | * p7: BL_ON |
SomeRandomBloke | 0:7efa6655d94b | 79 | * |
SomeRandomBloke | 0:7efa6655d94b | 80 | * Connector J2: |
SomeRandomBloke | 0:7efa6655d94b | 81 | * p1 : AD0 |
SomeRandomBloke | 0:7efa6655d94b | 82 | * |
SomeRandomBloke | 0:7efa6655d94b | 83 | **************************************************/ |
SomeRandomBloke | 0:7efa6655d94b | 84 | |
SomeRandomBloke | 0:7efa6655d94b | 85 | #endif |