Bank Account Security System

Dependencies:   FatFileSystemSD mbed

Committer:
Dhruv_Varun
Date:
Thu Oct 11 20:49:25 2012 +0000
Revision:
0:7e4786a3584b
Code For Bank Account Security System

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Dhruv_Varun 0:7e4786a3584b 1 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780
Dhruv_Varun 0:7e4786a3584b 2 * Copyright (c) 2007-2010, sford, http://mbed.org
Dhruv_Varun 0:7e4786a3584b 3 *
Dhruv_Varun 0:7e4786a3584b 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
Dhruv_Varun 0:7e4786a3584b 5 * of this software and associated documentation files (the "Software"), to deal
Dhruv_Varun 0:7e4786a3584b 6 * in the Software without restriction, including without limitation the rights
Dhruv_Varun 0:7e4786a3584b 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Dhruv_Varun 0:7e4786a3584b 8 * copies of the Software, and to permit persons to whom the Software is
Dhruv_Varun 0:7e4786a3584b 9 * furnished to do so, subject to the following conditions:
Dhruv_Varun 0:7e4786a3584b 10 *
Dhruv_Varun 0:7e4786a3584b 11 * The above copyright notice and this permission notice shall be included in
Dhruv_Varun 0:7e4786a3584b 12 * all copies or substantial portions of the Software.
Dhruv_Varun 0:7e4786a3584b 13 *
Dhruv_Varun 0:7e4786a3584b 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Dhruv_Varun 0:7e4786a3584b 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Dhruv_Varun 0:7e4786a3584b 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Dhruv_Varun 0:7e4786a3584b 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Dhruv_Varun 0:7e4786a3584b 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Dhruv_Varun 0:7e4786a3584b 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Dhruv_Varun 0:7e4786a3584b 20 * THE SOFTWARE.
Dhruv_Varun 0:7e4786a3584b 21 */
Dhruv_Varun 0:7e4786a3584b 22
Dhruv_Varun 0:7e4786a3584b 23 #ifndef MBED_TEXTLCD_H
Dhruv_Varun 0:7e4786a3584b 24 #define MBED_TEXTLCD_H
Dhruv_Varun 0:7e4786a3584b 25
Dhruv_Varun 0:7e4786a3584b 26 #include "mbed.h"
Dhruv_Varun 0:7e4786a3584b 27
Dhruv_Varun 0:7e4786a3584b 28 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
Dhruv_Varun 0:7e4786a3584b 29 *
Dhruv_Varun 0:7e4786a3584b 30 * Currently supports 16x2, 20x2 and 20x4 panels
Dhruv_Varun 0:7e4786a3584b 31 *
Dhruv_Varun 0:7e4786a3584b 32 * @code
Dhruv_Varun 0:7e4786a3584b 33 * #include "mbed.h"
Dhruv_Varun 0:7e4786a3584b 34 * #include "TextLCD.h"
Dhruv_Varun 0:7e4786a3584b 35 *
Dhruv_Varun 0:7e4786a3584b 36 * TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3
Dhruv_Varun 0:7e4786a3584b 37 *
Dhruv_Varun 0:7e4786a3584b 38 * int main() {
Dhruv_Varun 0:7e4786a3584b 39 * lcd.printf("Hello World!\n");
Dhruv_Varun 0:7e4786a3584b 40 * }
Dhruv_Varun 0:7e4786a3584b 41 * @endcode
Dhruv_Varun 0:7e4786a3584b 42 */
Dhruv_Varun 0:7e4786a3584b 43 class TextLCD : public Stream {
Dhruv_Varun 0:7e4786a3584b 44 public:
Dhruv_Varun 0:7e4786a3584b 45
Dhruv_Varun 0:7e4786a3584b 46 /** LCD panel format */
Dhruv_Varun 0:7e4786a3584b 47 enum LCDType {
Dhruv_Varun 0:7e4786a3584b 48 LCD16x2 /**< 16x2 LCD panel (default) */
Dhruv_Varun 0:7e4786a3584b 49 , LCD16x2B /**< 16x2 LCD panel alternate addressing */
Dhruv_Varun 0:7e4786a3584b 50 , LCD20x2 /**< 20x2 LCD panel */
Dhruv_Varun 0:7e4786a3584b 51 , LCD20x4 /**< 20x4 LCD panel */
Dhruv_Varun 0:7e4786a3584b 52 };
Dhruv_Varun 0:7e4786a3584b 53
Dhruv_Varun 0:7e4786a3584b 54 /** Create a TextLCD interface
Dhruv_Varun 0:7e4786a3584b 55 *
Dhruv_Varun 0:7e4786a3584b 56 * @param rs Instruction/data control line
Dhruv_Varun 0:7e4786a3584b 57 * @param e Enable line (clock)
Dhruv_Varun 0:7e4786a3584b 58 * @param d0-d3 Data lines
Dhruv_Varun 0:7e4786a3584b 59 * @param type Sets the panel size/addressing mode (default = LCD16x2)
Dhruv_Varun 0:7e4786a3584b 60 */
Dhruv_Varun 0:7e4786a3584b 61 TextLCD(PinName rs, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type = LCD16x2);
Dhruv_Varun 0:7e4786a3584b 62
Dhruv_Varun 0:7e4786a3584b 63 #if DOXYGEN_ONLY
Dhruv_Varun 0:7e4786a3584b 64 /** Write a character to the LCD
Dhruv_Varun 0:7e4786a3584b 65 *
Dhruv_Varun 0:7e4786a3584b 66 * @param c The character to write to the display
Dhruv_Varun 0:7e4786a3584b 67 */
Dhruv_Varun 0:7e4786a3584b 68 int putc(int c);
Dhruv_Varun 0:7e4786a3584b 69
Dhruv_Varun 0:7e4786a3584b 70 /** Write a formated string to the LCD
Dhruv_Varun 0:7e4786a3584b 71 *
Dhruv_Varun 0:7e4786a3584b 72 * @param format A printf-style format string, followed by the
Dhruv_Varun 0:7e4786a3584b 73 * variables to use in formating the string.
Dhruv_Varun 0:7e4786a3584b 74 */
Dhruv_Varun 0:7e4786a3584b 75 int printf(const char* format, ...);
Dhruv_Varun 0:7e4786a3584b 76 #endif
Dhruv_Varun 0:7e4786a3584b 77
Dhruv_Varun 0:7e4786a3584b 78 /** Locate to a screen column and row
Dhruv_Varun 0:7e4786a3584b 79 *
Dhruv_Varun 0:7e4786a3584b 80 * @param column The horizontal position from the left, indexed from 0
Dhruv_Varun 0:7e4786a3584b 81 * @param row The vertical position from the top, indexed from 0
Dhruv_Varun 0:7e4786a3584b 82 */
Dhruv_Varun 0:7e4786a3584b 83 void locate(int column, int row);
Dhruv_Varun 0:7e4786a3584b 84
Dhruv_Varun 0:7e4786a3584b 85 /** Clear the screen and locate to 0,0 */
Dhruv_Varun 0:7e4786a3584b 86 void cls();
Dhruv_Varun 0:7e4786a3584b 87
Dhruv_Varun 0:7e4786a3584b 88 int rows();
Dhruv_Varun 0:7e4786a3584b 89 int columns();
Dhruv_Varun 0:7e4786a3584b 90
Dhruv_Varun 0:7e4786a3584b 91 protected:
Dhruv_Varun 0:7e4786a3584b 92
Dhruv_Varun 0:7e4786a3584b 93 // Stream implementation functions
Dhruv_Varun 0:7e4786a3584b 94 virtual int _putc(int value);
Dhruv_Varun 0:7e4786a3584b 95 virtual int _getc();
Dhruv_Varun 0:7e4786a3584b 96
Dhruv_Varun 0:7e4786a3584b 97 int address(int column, int row);
Dhruv_Varun 0:7e4786a3584b 98 void character(int column, int row, int c);
Dhruv_Varun 0:7e4786a3584b 99 void writeByte(int value);
Dhruv_Varun 0:7e4786a3584b 100 void writeCommand(int command);
Dhruv_Varun 0:7e4786a3584b 101 void writeData(int data);
Dhruv_Varun 0:7e4786a3584b 102
Dhruv_Varun 0:7e4786a3584b 103 DigitalOut _rs, _e;
Dhruv_Varun 0:7e4786a3584b 104 BusOut _d;
Dhruv_Varun 0:7e4786a3584b 105 LCDType _type;
Dhruv_Varun 0:7e4786a3584b 106
Dhruv_Varun 0:7e4786a3584b 107 int _column;
Dhruv_Varun 0:7e4786a3584b 108 int _row;
Dhruv_Varun 0:7e4786a3584b 109 };
Dhruv_Varun 0:7e4786a3584b 110
Dhruv_Varun 0:7e4786a3584b 111 #endif