Simple library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website). adapted version offering extra features
Fork of N5110 by
Diff: N5110.h
- Revision:
- 18:3d1747a3174a
- Parent:
- 17:780a542d5f8b
--- a/N5110.h Tue Mar 17 12:56:03 2015 +0000 +++ b/N5110.h Fri May 06 14:57:35 2016 +0000 @@ -207,6 +207,12 @@ * @param brightness - float in range 0.0 to 1.0 */ void setBrightness(float brightness); + + /** Set PWM frequency + * Sets PWM frequency of LED backlight + * @param freq - float in the range 0.1+ + */ + void setPwmFreq(float freq); /** Print String * @@ -224,6 +230,16 @@ * @param y - the row number (0 to 5) - the display is split into 6 banks - each bank can be considered a row */ void printChar(char c,int x,int y); + + /** Select Buffer + * + * Selects active buffer(s). + * @param type - switches between editable and displayed buffer edit; + * type = 1; selects visible buffer. + * type = 2; selects buffer to be written to. + * type = 3; switches both. + */ + void selectBuffer(int type,int buffer); /** Set a Pixel * @@ -233,6 +249,16 @@ * @param y - the y co-ordinate of the pixel (0 to 47) */ void setPixel(int x, int y); + + /** write to a pixel + * + * This function writes the value v to a pixel on the display. A call to refresh() must be made + * to update the display to reflect the change in pixels. + * @param x - the x co-ordinate of the pixel (0 to 83) + * @param y - the y co-ordinate of the pixel (0 to 47) + * @param v - the value to be written to the pixel (0 to 1) + */ + void writePixel(int x, int y, int v); /** Clear a Pixel * @@ -268,6 +294,21 @@ * TODO: Randomise the seed - maybe using the noise on the AnalogIn pins. */ void randomiseBuffer(); + + /** Plot Array 2d + * + * This function plots a two-dimensional array on the display. + * @param array2d[][] - y values of the plot. Values should be normalised in the range 0.0 to 1.0. First 84 plotted. + */ + void plotArray2d(bool array2d[][48]); + + /** Plot Array 3d + * + * This function plots a two-dimensional array on the display. + * @param array2d[][] - y values of the plot. Values should be normalised in the range 0.0 to 1.0. First 84 plotted. + * Slightly over-specific to project + */ + void plotArray3d(bool array3d[][50][2],int z,int off_x=0, int off_y=0); /** Plot Array * @@ -323,7 +364,9 @@ void sendData(unsigned char data); public: - unsigned char buffer[84][6]; // screen buffer - the 6 is for the banks - each one is 8 bits; + unsigned char buffer[84][6][3]; // screen buffer - the 6 is for the banks - each one is 8 bits; + int bufferFrameEdit; + int bufferFrameDisplay; private: // private variables SPI* spi;