A basic library for the Freetronics arduino LCD shield.
Fork of freetronicsLCDShield by
freetronicsLCDShield.h
- Committer:
- KKempeneers
- Date:
- 2013-10-27
- Revision:
- 1:ddcefddda4a7
- Parent:
- 0:01f3d38f8b6d
- Child:
- 2:f40a5df43d09
File content as of revision 1:ddcefddda4a7:
/* mbed freetronicsLCDShield Library, written by Koen J.F. Kempeneers * koen.kempeneers@damiaaninstituut.be * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef FREETRONICSLCDSHIELD_H #define FREETRONICSLCDSHIELD_H #define LEFT 0 #define RIGHT 1 class freetronicsLCDShield : public Stream { private: // Functions void writeByte (int byte); void writeCommand (int command); void writeData (int data); void character(int line, int col, int value); // Hardware DigitalOut _rs, _e; BusOut _d; PwmOut _bl; AnalogIn _a0; public: // Constructor freetronicsLCDShield (PinName rs = PTA13, PinName e = PTD5, PinName d0 = PTA4, PinName d1 = PTA5, PinName d2 = PTC8, PinName d3 = PTC9, PinName bl = PTA12, PinName a0 = PTB0); void writeCGRAM (char address, const char *ptr, char nbytes); void setCursorPosition (int line, int col); void setBackLight (bool blStatus); void setBackLight (float blIntensity); void setCursor (bool cStatus = true, bool blink = false); void shiftLeft (void); void shiftRight (void); void shift (bool direction); void cls (void); void home(void); float readButton(void); protected: // Stream implementation functions virtual int _putc(int value); virtual int _getc(); }; #endif