Library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website).
Fork of N5110 by
Diff: N5110.h
- Revision:
- 2:e93021cfb0a9
- Parent:
- 1:df68f34cd32d
- Child:
- 4:e923c54c1c7d
diff -r df68f34cd32d -r e93021cfb0a9 N5110.h --- a/N5110.h Sun Jan 26 19:30:09 2014 +0000 +++ b/N5110.h Sun Jan 26 20:06:58 2014 +0000 @@ -1,13 +1,17 @@ /** +@file N5110.h -Simple library for interfacing with Nokia 5110 LCD display (https://www.sparkfun.com/products/10168) +@brief Simple library for interfacing with Nokia 5110 LCD display (https://www.sparkfun.com/products/10168) using the hardware SPI on the mbed. +The display is powered from a GPIO pin meaning it can be controlled via software. The LED backlight is also software-controllable (via PWM pin). +-Can print characters and strings to the display using the included 5x7 font. +-The library also implements a screen buffer so that individual pixels on the display (84 x 48) can be set, cleared and read. -Chris Yan's Nokia5110 Library proved a useful starting point. +Acknowledgements to Chris Yan's Nokia_5110 Library. Revision 1.0 -Craig A. Evans -January 2014 +@author Craig A. Evans +@date January 2014 */ @@ -15,7 +19,8 @@ #define N5110_H // Command Bytes - taken from Chris Yan's library -// H = 0 +// More information can be found in the display datasheet +// H = 0 - Basic instructions #define CMD_DC_CLEAR_DISPLAY 0x08 #define CMD_DC_NORMAL_MODE 0x0C #define CMD_DC_FILL_DISPLAY 0x09 @@ -26,7 +31,7 @@ #define CMD_FS_EXTENDED_MODE 0x01 #define CMD_FS_ACTIVE_MODE 0x00 #define CMD_FS_POWER_DOWN_MODE 0x04 -// H = 1 +// H = 1 - Extended instructions #define CMD_TC_TEMP_0 0x04 #define CMD_TC_TEMP_1 0x05 #define CMD_TC_TEMP_2 0x06 @@ -39,6 +44,13 @@ #include "mbed.h" +/** Class for interfacing with Nokia 5110 LCD + * + * Example: + * @code + * + * @endcode + */ class N5110 { @@ -97,10 +109,16 @@ * * Sets the X and Y address of where the next data sent to the displa will be written in RAM. * @param x - the column number (0 to 83) - is automatically incremented after data is written - * @param y - the row number - the diplay is split into 6 banks - each bank can be considered a row + * @param y - the row number (0 to 5) - the diplay is split into 6 banks - each bank can be considered a row */ void setXYAddress(int x, int y); + /** Print String + * + * Prints a string of characters to the display. + * @param x - the column number (0 to 83) + * @param y - the row number (0 to 5) - the display is split into 6 banks - each bank can be considered a row + */ void printString(const char * str,int x,int y); /** Print Character @@ -114,6 +132,8 @@ void setPixel(int x, int y); void clearPixel(int x, int y); unsigned char getPixel(int x, int y); + + void refreshDisplay(); void clearBuffer(); void randomiseBuffer();