Test SD

Dependencies:   FatFileSystem SDFileSystem mbed

Committer:
Tomoseec
Date:
Tue Dec 25 08:37:27 2012 +0000
Revision:
0:f46b40e04fdd
Test SD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Tomoseec 0:f46b40e04fdd 1 /* mbed TextLCD Library
Tomoseec 0:f46b40e04fdd 2 * Copyright (c) 2007-2009 sford
Tomoseec 0:f46b40e04fdd 3 * Released under the MIT License: http://mbed.org/license/mit
Tomoseec 0:f46b40e04fdd 4 *
Tomoseec 0:f46b40e04fdd 5 * TODO: Needs serious rework/neatening up!
Tomoseec 0:f46b40e04fdd 6 */
Tomoseec 0:f46b40e04fdd 7
Tomoseec 0:f46b40e04fdd 8 #ifndef MBED_TEXTLCD_H
Tomoseec 0:f46b40e04fdd 9 #define MBED_TEXTLCD_H
Tomoseec 0:f46b40e04fdd 10
Tomoseec 0:f46b40e04fdd 11 #include "Stream.h"
Tomoseec 0:f46b40e04fdd 12 #include "DigitalOut.h"
Tomoseec 0:f46b40e04fdd 13 #include "BusOut.h"
Tomoseec 0:f46b40e04fdd 14
Tomoseec 0:f46b40e04fdd 15 namespace mbed {
Tomoseec 0:f46b40e04fdd 16
Tomoseec 0:f46b40e04fdd 17 /* Class: TextLCD
Tomoseec 0:f46b40e04fdd 18 * A 16x2 Text LCD controller
Tomoseec 0:f46b40e04fdd 19 *
Tomoseec 0:f46b40e04fdd 20 * Allows you to print to a Text LCD screen, and locate/cls. Could be
Tomoseec 0:f46b40e04fdd 21 * turned in to a more generic libray.
Tomoseec 0:f46b40e04fdd 22 *
Tomoseec 0:f46b40e04fdd 23 * If you are connecting multiple displays, you can connect them all in
Tomoseec 0:f46b40e04fdd 24 * parallel except for the enable (e) pin, which must be unique for each
Tomoseec 0:f46b40e04fdd 25 * display.
Tomoseec 0:f46b40e04fdd 26 *
Tomoseec 0:f46b40e04fdd 27 * Example:
Tomoseec 0:f46b40e04fdd 28 * > #include "mbed.h"
Tomoseec 0:f46b40e04fdd 29 * > #include "TextLCD.h"
Tomoseec 0:f46b40e04fdd 30 * >
Tomoseec 0:f46b40e04fdd 31 * > TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3
Tomoseec 0:f46b40e04fdd 32 * >
Tomoseec 0:f46b40e04fdd 33 * > int main() {
Tomoseec 0:f46b40e04fdd 34 * > lcd.printf("Hello World!");
Tomoseec 0:f46b40e04fdd 35 * > }
Tomoseec 0:f46b40e04fdd 36 */
Tomoseec 0:f46b40e04fdd 37 class TextLCD : public Stream {
Tomoseec 0:f46b40e04fdd 38
Tomoseec 0:f46b40e04fdd 39 public:
Tomoseec 0:f46b40e04fdd 40 /* Constructor: TextLCD
Tomoseec 0:f46b40e04fdd 41 * Create a TextLCD object, connected to the specified pins
Tomoseec 0:f46b40e04fdd 42 *
Tomoseec 0:f46b40e04fdd 43 * All signals must be connected to DigitalIn compatible pins.
Tomoseec 0:f46b40e04fdd 44 *
Tomoseec 0:f46b40e04fdd 45 * Variables:
Tomoseec 0:f46b40e04fdd 46 * rs - Used to specify data or command
Tomoseec 0:f46b40e04fdd 47 * rw - Used to determine read or write
Tomoseec 0:f46b40e04fdd 48 * e - enable
Tomoseec 0:f46b40e04fdd 49 * d0..d3 - The data lines
Tomoseec 0:f46b40e04fdd 50 */
Tomoseec 0:f46b40e04fdd 51 TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1,
Tomoseec 0:f46b40e04fdd 52 PinName d2, PinName d3, int columns = 16, int rows = 2);
Tomoseec 0:f46b40e04fdd 53
Tomoseec 0:f46b40e04fdd 54 #if 0 // Inhereted from Stream, for documentation only
Tomoseec 0:f46b40e04fdd 55 /* Function: putc
Tomoseec 0:f46b40e04fdd 56 * Write a character
Tomoseec 0:f46b40e04fdd 57 *
Tomoseec 0:f46b40e04fdd 58 * Variables:
Tomoseec 0:f46b40e04fdd 59 * c - The character to write to the serial port
Tomoseec 0:f46b40e04fdd 60 */
Tomoseec 0:f46b40e04fdd 61 int putc(int c);
Tomoseec 0:f46b40e04fdd 62
Tomoseec 0:f46b40e04fdd 63 /* Function: printf
Tomoseec 0:f46b40e04fdd 64 * Write a formated string
Tomoseec 0:f46b40e04fdd 65 *
Tomoseec 0:f46b40e04fdd 66 * Variables:
Tomoseec 0:f46b40e04fdd 67 * format - A printf-style format string, followed by the
Tomoseec 0:f46b40e04fdd 68 * variables to use in formating the string.
Tomoseec 0:f46b40e04fdd 69 */
Tomoseec 0:f46b40e04fdd 70 int printf(const char* format, ...);
Tomoseec 0:f46b40e04fdd 71 #endif
Tomoseec 0:f46b40e04fdd 72
Tomoseec 0:f46b40e04fdd 73 /* Function: locate
Tomoseec 0:f46b40e04fdd 74 * Locate to a certian position
Tomoseec 0:f46b40e04fdd 75 *
Tomoseec 0:f46b40e04fdd 76 * Variables:
Tomoseec 0:f46b40e04fdd 77 * column - the column to locate to, from 0..15
Tomoseec 0:f46b40e04fdd 78 * row - the row to locate to, from 0..1
Tomoseec 0:f46b40e04fdd 79 */
Tomoseec 0:f46b40e04fdd 80 virtual void locate(int column, int row);
Tomoseec 0:f46b40e04fdd 81
Tomoseec 0:f46b40e04fdd 82 /* Function: cls
Tomoseec 0:f46b40e04fdd 83 * Clear the screen, and locate to 0,0
Tomoseec 0:f46b40e04fdd 84 */
Tomoseec 0:f46b40e04fdd 85 virtual void cls();
Tomoseec 0:f46b40e04fdd 86
Tomoseec 0:f46b40e04fdd 87 virtual void reset();
Tomoseec 0:f46b40e04fdd 88
Tomoseec 0:f46b40e04fdd 89 //protected:
Tomoseec 0:f46b40e04fdd 90
Tomoseec 0:f46b40e04fdd 91 void clock();
Tomoseec 0:f46b40e04fdd 92 void writeData(int data);
Tomoseec 0:f46b40e04fdd 93 void writeCommand(int command);
Tomoseec 0:f46b40e04fdd 94 void writeByte(int value);
Tomoseec 0:f46b40e04fdd 95 void writeNibble(int value);
Tomoseec 0:f46b40e04fdd 96 virtual int _putc(int c);
Tomoseec 0:f46b40e04fdd 97 virtual int _getc();
Tomoseec 0:f46b40e04fdd 98 virtual void newline();
Tomoseec 0:f46b40e04fdd 99
Tomoseec 0:f46b40e04fdd 100 int _row;
Tomoseec 0:f46b40e04fdd 101 int _column;
Tomoseec 0:f46b40e04fdd 102 DigitalOut _rw, _rs, _e;
Tomoseec 0:f46b40e04fdd 103 BusOut _d;
Tomoseec 0:f46b40e04fdd 104 int _columns;
Tomoseec 0:f46b40e04fdd 105 int _rows;
Tomoseec 0:f46b40e04fdd 106
Tomoseec 0:f46b40e04fdd 107 };
Tomoseec 0:f46b40e04fdd 108
Tomoseec 0:f46b40e04fdd 109 }
Tomoseec 0:f46b40e04fdd 110
Tomoseec 0:f46b40e04fdd 111 #endif