tr
Diff: N5110.h
- Revision:
- 44:57f9d32fb521
- Parent:
- 42:596c207519de
- Child:
- 45:97e54ea40dac
--- a/N5110.h Tue Mar 21 11:46:14 2017 +0000 +++ b/N5110.h Wed Nov 01 20:48:05 2017 +0000 @@ -3,42 +3,6 @@ #include "mbed.h" -// Command Bytes - taken from Chris Yan's library -// 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 -#define CMD_DC_INVERT_VIDEO 0x0D -#define CMD_FS_HORIZONTAL_MODE 0x00 -#define CMD_FS_VERTICAL_MODE 0x02 -#define CMD_FS_BASIC_MODE 0x00 -#define CMD_FS_EXTENDED_MODE 0x01 -#define CMD_FS_ACTIVE_MODE 0x00 -#define CMD_FS_POWER_DOWN_MODE 0x04 -// H = 1 - Extended instructions -#define CMD_TC_TEMP_0 0x04 -#define CMD_TC_TEMP_1 0x05 -#define CMD_TC_TEMP_2 0x06 -#define CMD_TC_TEMP_3 0x07 -#define CMD_BI_MUX_24 0x15 -#define CMD_BI_MUX_48 0x13 -#define CMD_BI_MUX_100 0x10 -#define CMD_VOP_6V06 0xB2 -#define CMD_VOP_7V38 0xC8 - -// number of pixels on display -#define WIDTH 84 -#define HEIGHT 48 -#define BANKS 6 - -/// Fill types for 2D shapes -enum FillType { - FILL_TRANSPARENT, ///< Transparent with outline - FILL_BLACK, ///< Filled black - FILL_WHITE, ///< Filled white (no outline) -}; - /** N5110 Class @brief Library for interfacing with Nokia 5110 LCD display (https://www.sparkfun.com/products/10168) using the hardware SPI on the mbed. @brief 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). @@ -202,6 +166,19 @@ @endcode */ + +// number of pixels on display +#define WIDTH 84 +#define HEIGHT 48 +#define BANKS 6 + +/// Fill types for 2D shapes +enum FillType { + FILL_TRANSPARENT, ///< Transparent with outline + FILL_BLACK, ///< Filled black + FILL_WHITE, ///< Filled white (no outline) +}; + class N5110 { private: @@ -278,6 +255,11 @@ */ void clear(); + /** Set screen constrast + * @param constrast - float in range 0.0 to 1.0 (0.40 to 0.60 is usually a good value) + */ + void setContrast(float contrast); + /** Turn on normal video mode (default) * Black on white */ @@ -450,6 +432,8 @@ void clearRAM(); void sendCommand(unsigned char command); void sendData(unsigned char data); + void setTempCoefficient(char tc); // 0 to 3 + void setBias(char bias); // 0 to 7 }; const unsigned char font5x7[480] = {