![]() |
LCD ST7036 Library 1.2.0
LCD ST7036 Library following the LCD API 1.0
|
00001 // --------------------------------------------------------------------------- 00002 // Created by Francisco Malpartida on 20/08/11. 00003 // Copyright 2011 - Under creative commons license 3.0: 00004 // Attribution-ShareAlike CC BY-SA 00005 // 00006 // This software is furnished "as is", without technical support, and with no 00007 // warranty, express or implied, as to its usefulness for any purpose. 00008 // 00009 // Thread Safe: No 00010 // Extendable: No 00011 // 00012 // @file ST7036.h 00013 // NHD C0220BiZ display class definition. 00014 // 00015 // @brief Based on the LCD API 1.0 by dale@wentztech.com 00016 // This library implements the driver to any I2C display with the ST7036 00017 // LCD controller. 00018 // I2C displays based on the ST7632 should also be compatible. 00019 // 00020 // Other compatible displays: 00021 // - NHD-C0220BiZ-FSW-FBW-3V3M 00022 // - NHD-C0220ST7036BiZ-FS(RGB)-FBW-3VM 00023 // Non tested but should be compatible with no or little changes 00024 // - NHD-C0216CiZ-FSW-FBW-3V3 00025 // - NHD-C0216CiZ-FN-FBW-3V 00026 // 00027 // @author F. Malpartida - fmalpartida@gmail.com 00028 // --------------------------------------------------------------------------- 00029 00030 #ifndef ST7036_h 00031 #define ST7036_h 00032 00033 00034 #define _LCDEXPANDED // If defined turn on advanced functions 00035 #include <Arduino.h> 00036 #include <inttypes.h> 00037 #include <Wire.h> 00038 #include "Print.h" 00039 #include "LCD.h" 00040 00041 00042 #define _ST7036_VERSION "1.2.0" 00043 #define _LCD_API_VERSION "1.0" 00044 00045 class ST7036 : public Print 00046 { 00047 00048 public: 00049 00061 ST7036(uint8_t num_lines, uint8_t num_col, uint8_t i2cAddr ); 00062 00075 ST7036(uint8_t num_lines, uint8_t num_col, uint8_t i2cAddr, 00076 int8_t backlightPin ); 00077 00087 void command(uint8_t value); 00088 00102 void init(); 00103 00115 void setDelay(int,int); 00116 00128 virtual size_t write(uint8_t); 00129 00142 virtual size_t write(const uint8_t *buffer, size_t size); 00143 00149 void clear(); 00150 00156 void home(); 00157 00164 void on(); 00165 00171 virtual void off(); 00172 00178 void cursor_on(); 00179 00186 void cursor_off(); 00187 00193 void blink_on(); 00194 00201 void blink_off(); 00202 00215 void setCursor(uint8_t Line, uint8_t Col ); 00216 00217 // 00218 // EXPANDED FUNCTIONALITY METHODS 00219 // -------------------------------------------------------------------------- 00220 00221 #ifdef _LCDEXPANDED 00222 00232 uint8_t status(); 00233 00248 void load_custom_character(uint8_t char_num, uint8_t *rows); 00249 00255 uint8_t keypad(); 00256 00257 void printstr(const char[]); 00258 00272 void setBacklight(uint8_t new_val); 00273 00284 void setContrast(uint8_t new_val); 00285 00286 00287 #endif 00288 00289 private: 00290 uint8_t _num_lines; 00291 uint8_t _num_col; 00292 uint8_t _i2cAddress; 00293 int _cmdDelay; 00294 int _charDelay; 00295 bool _initialised; 00296 uint8_t _status; 00297 int8_t _backlightPin; 00298 00299 }; 00300 00301 #endif 00302