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