From e7843dae1650cfaa31c39b4ba73aee8fa78f6fb5 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Wed, 29 Oct 2014 23:33:50 +1100 Subject: Update MultiLCD library --- libraries/MultiLCD/ILI9325D.cpp | 6 +++--- libraries/MultiLCD/ILI9341.cpp | 13 ++++++++++--- libraries/MultiLCD/MultiLCD.cpp | 7 +++---- libraries/MultiLCD/MultiLCD.h | 14 ++++++++------ libraries/MultiLCD/SSD1289.cpp | 20 ++++++++++++-------- 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/libraries/MultiLCD/ILI9325D.cpp b/libraries/MultiLCD/ILI9325D.cpp index ac4cfcf..2c791bc 100644 --- a/libraries/MultiLCD/ILI9325D.cpp +++ b/libraries/MultiLCD/ILI9325D.cpp @@ -1,8 +1,8 @@ /************************************************************************* -* Arduino Text Display Library for Multiple LCDs +* Arduino Text & Bitmap Display Library for color LCDs * Distributed under GPL v2.0 -* Copyright (c) 2013 Stanley Huang -* All rights reserved. +* Developed by Stanley Huang +* For more information, please visit http://arduinodev.com *************************************************************************/ #include diff --git a/libraries/MultiLCD/ILI9341.cpp b/libraries/MultiLCD/ILI9341.cpp index 32b2356..9cb5c27 100644 --- a/libraries/MultiLCD/ILI9341.cpp +++ b/libraries/MultiLCD/ILI9341.cpp @@ -1,3 +1,10 @@ +/************************************************************************* +* Arduino Text & Bitmap Display Library for color LCDs +* Distributed under GPL v2.0 +* Developed by Stanley Huang +* For more information, please visit http://arduinodev.com +*************************************************************************/ + #include #include #include "MultiLCD.h" @@ -240,7 +247,7 @@ void LCD_ILI9341::begin (void) sendCMD(0x2c); clear(); - backlight(true); + setBackLight(255); setColor(0xffff); setBackColor(0); } @@ -342,9 +349,9 @@ void LCD_ILI9341::setPixel(uint16_t poX, uint16_t poY,uint16_t color) sendData(color); } -void LCD_ILI9341::backlight(bool on) +void LCD_ILI9341::setBackLight(byte brightness) { - digitalWrite(PIN_LED, on); + digitalWrite(PIN_LED, brightness ? HIGH : LOW); } void LCD_ILI9341::clearPixels(uint16_t pixels) diff --git a/libraries/MultiLCD/MultiLCD.cpp b/libraries/MultiLCD/MultiLCD.cpp index 60291e1..e60e773 100644 --- a/libraries/MultiLCD/MultiLCD.cpp +++ b/libraries/MultiLCD/MultiLCD.cpp @@ -1,12 +1,11 @@ /************************************************************************* -* Arduino Text Display Library for Multiple LCDs +* Arduino Text & Bitmap Display Library for color LCDs * Distributed under GPL v2.0 -* Copyright (c) 2013 Stanley Huang -* All rights reserved. +* Developed by Stanley Huang +* For more information, please visit http://arduinodev.com *************************************************************************/ #include -#include #include "MultiLCD.h" #include "fonts.h" diff --git a/libraries/MultiLCD/MultiLCD.h b/libraries/MultiLCD/MultiLCD.h index f58cad2..98b11e8 100644 --- a/libraries/MultiLCD/MultiLCD.h +++ b/libraries/MultiLCD/MultiLCD.h @@ -1,12 +1,13 @@ /************************************************************************* -* Arduino Text Display Library for Multiple LCDs +* Arduino Text & Bitmap Display Library for color LCDs * Distributed under GPL v2.0 -* Copyright (c) 2013 Stanley Huang -* All rights reserved. +* Developed by Stanley Huang +* For more information, please visit http://arduinodev.com *************************************************************************/ + #include -#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168P__) +#if defined(__AVR_ATmega168P__) #define MEMORY_SAVING #endif @@ -50,7 +51,7 @@ public: LCD_Common():m_font(FONT_SIZE_SMALL),m_flags(0) {} void setFontSize(FONT_SIZE size) { m_font = size; } void setFlags(byte flags) { m_flags = flags; } - virtual void backlight(bool on) {} + virtual void setBackLight(byte brightness) {} virtual void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height) {} virtual void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY = 0) {} virtual void draw4bpp(const PROGMEM byte* buffer, uint16_t width, uint16_t height) {} @@ -180,7 +181,7 @@ public: void fill(uint16_t XL,uint16_t XR,uint16_t YU,uint16_t YD,uint16_t color = 0); void clear(void); size_t write(uint8_t); - void backlight(bool on); + void setBackLight(byte brightness); void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height); void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY = 0); private: @@ -246,6 +247,7 @@ public: { //clear(0, line * TFT_LINE_HEIGHT, 320, 8); } + void setBackLight(byte brightness); private: void setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); void writeDigit(byte n); diff --git a/libraries/MultiLCD/SSD1289.cpp b/libraries/MultiLCD/SSD1289.cpp index f2aebed..0f57264 100644 --- a/libraries/MultiLCD/SSD1289.cpp +++ b/libraries/MultiLCD/SSD1289.cpp @@ -1,8 +1,8 @@ /************************************************************************* -* Arduino Text Display Library for Multiple LCDs +* Arduino Text & Bitmap Display Library for color LCDs * Distributed under GPL v2.0 -* Copyright (c) 2013 Stanley Huang -* All rights reserved. +* Developed by Stanley Huang +* For more information, please visit http://arduinodev.com *************************************************************************/ #include @@ -17,11 +17,7 @@ Define zone #define CS 57 #define RST 56 -#define T_CLK 55 -#define T_CS 60 -#define T_DIN 54 -#define T_DOUT 8 -#define T_IRQ 9 +#define PIN_BACKLIGHT 8 #define X_CONST 240 #define Y_CONST 320 @@ -130,6 +126,9 @@ void LCD_SSD1289::begin() sbi (P_CS, B_CS); clear(); + + pinMode(PIN_BACKLIGHT, OUTPUT); + digitalWrite(PIN_BACKLIGHT, HIGH); } void LCD_SSD1289::setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) @@ -148,6 +147,11 @@ void LCD_SSD1289::setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) LCD_Write_COM(0x22); } +void LCD_SSD1289::setBackLight(byte brightness) +{ + analogWrite(PIN_BACKLIGHT, brightness); +} + void LCD_SSD1289::Enable() { cbi(P_CS, B_CS); -- cgit v1.2.3