Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/Makefile.config
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/Makefile.config	(revision 364)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/Makefile.config	(revision 364)
@@ -0,0 +1,55 @@
+#
+#   TOPPERS/ASP/FMP Kernel
+#       Toyohashi Open Platform for Embedded Real-Time Systems/
+#       Advanced Standard Profile Kernel
+#
+#   Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+#                               Toyohashi Univ. of Technology, JAPAN
+#   Copyright (C) 2003-2008 by Ryosuke Takeuchi
+#                Platform Development Center RICOH COMPANY,LTD. JAPAN
+#   Copyright (C) 2015-2017 by TOPPERS PROJECT Educational Working Group.
+#
+#   上記著作権者は，以下の (1)～(4) の条件か，Free Software Foundation 
+#   によって公表されている GNU General Public License の Version 2 に記
+#   述されている条件を満たす場合に限り，本ソフトウェア（本ソフトウェア
+#   を改変したものを含む．以下同じ）を使用・複製・改変・再配布（以下，
+#   利用と呼ぶ）することを無償で許諾する．
+#   (1) 本ソフトウェアをソースコードの形で利用する場合には，上記の著作
+#       権表示，この利用条件および下記の無保証規定が，そのままの形でソー
+#       スコード中に含まれていること．
+#   (2) 本ソフトウェアを，ライブラリ形式など，他のソフトウェア開発に使
+#       用できる形で再配布する場合には，再配布に伴うドキュメント（利用
+#       者マニュアルなど）に，上記の著作権表示，この利用条件および下記
+#       の無保証規定を掲載すること．
+#   (3) 本ソフトウェアを，機器に組み込むなど，他のソフトウェア開発に使
+#       用できない形で再配布する場合には，次のいずれかの条件を満たすこ
+#       と．
+#     (a) 再配布に伴うドキュメント（利用者マニュアルなど）に，上記の著
+#         作権表示，この利用条件および下記の無保証規定を掲載すること．
+#     (b) 再配布の形態を，別に定める方法によって，TOPPERSプロジェクトに
+#         報告すること．
+#   (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+#       害からも，上記著作権者およびTOPPERSプロジェクトを免責すること．
+#
+#   本ソフトウェアは，無保証で提供されているものである．上記著作権者お
+#   よびTOPPERSプロジェクトは，本ソフトウェアに関して，その適用可能性も
+#   含めて，いかなる保証も行わない．また，本ソフトウェアの利用により直
+#   接的または間接的に生じたいかなる損害に関しても，その責任を負わない．
+#
+#  @(#) $Id$
+#
+ 
+#
+#  Makefile のプロセッサ依存 (adafruit st7735:LCD用)
+#
+
+#
+#  コンパイルオプション
+#
+INCLUDES := $(INCLUDES) -I$(SRCDIR)/gdic/adafruit_ssd1306
+
+#
+#  ADAFRUIT SSD1306 LCD DRIVER(GDIC)に関する定義
+#
+SYSSVC_DIRS := $(SYSSVC_DIRS):$(SRCDIR)/gdic/adafruit_ssd1306
+SYSSVC_COBJS := $(SYSSVC_COBJS) adafruit_ssd1306.o
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.c	(revision 364)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.c	(revision 364)
@@ -0,0 +1,701 @@
+/*********************************************************************
+This is a library for our Monochrome OLEDs based on SSD1306 drivers
+
+  Pick one up today in the adafruit shop!
+  ------> http://www.adafruit.com/category/63_98
+
+These displays use SPI to communicate, 4 or 5 pins are required to
+interface
+
+Adafruit invests time and resources providing this open source code,
+please support Adafruit and open-source hardware by purchasing
+products from Adafruit!
+
+Written by Limor Fried/Ladyada  for Adafruit Industries.
+BSD license, check license.txt for more information
+All text above, and the splash screen below must be included in any redistribution
+*********************************************************************/
+
+#include <string.h>
+#include <kernel.h>
+#include <t_syslog.h>
+#include <t_stdlib.h>
+#include <target_syssvc.h>
+#include <time.h>
+#include "syssvc/serial.h"
+#include "syssvc/syslog.h"
+#include "adafruit_ssd1306.h"
+
+#define HIGH 1
+#define LOW 0
+
+// the memory buffer for the LCD
+
+static uint8_t buffer[SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH / 8] = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x80, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xF8, 0xE0, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
+0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xFF,
+#if (SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH > 96*16)
+0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00,
+0x80, 0xFF, 0xFF, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x8C, 0x8E, 0x84, 0x00, 0x00, 0x80, 0xF8,
+0xF8, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x80,
+0x00, 0xE0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xC7, 0x01, 0x01,
+0x01, 0x01, 0x83, 0xFF, 0xFF, 0x00, 0x00, 0x7C, 0xFE, 0xC7, 0x01, 0x01, 0x01, 0x01, 0x83, 0xFF,
+0xFF, 0xFF, 0x00, 0x38, 0xFE, 0xC7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xC7, 0xFF, 0xFF, 0x00, 0x00,
+0x01, 0xFF, 0xFF, 0x01, 0x01, 0x00, 0xFF, 0xFF, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x7F, 0xFF,
+0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0xFF,
+0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC7, 0xC7, 0x8F,
+0x8F, 0x9F, 0xBF, 0xFF, 0xFF, 0xC3, 0xC0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xFC,
+0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x00, 0x01, 0x03, 0x03, 0x03,
+0x03, 0x03, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01,
+0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x00, 0x00,
+0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03,
+0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+#if (SSD1306_LCDHEIGHT == 64)
+0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F,
+0x87, 0xC7, 0xF7, 0xFF, 0xFF, 0x1F, 0x1F, 0x3D, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0x7C, 0x7D, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x0F, 0x07, 0x00, 0x30, 0x30, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC0, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xC0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x3F, 0x1F,
+0x0F, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00,
+0x00, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xF0, 0xF8, 0x1C, 0x0E,
+0x06, 0x06, 0x06, 0x0C, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFC,
+0xFE, 0xFC, 0x00, 0x18, 0x3C, 0x7E, 0x66, 0xE6, 0xCE, 0x84, 0x00, 0x00, 0x06, 0xFF, 0xFF, 0x06,
+0x06, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x06, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0xC0, 0xF8,
+0xFC, 0x4E, 0x46, 0x46, 0x46, 0x4E, 0x7C, 0x78, 0x40, 0x18, 0x3C, 0x76, 0xE6, 0xCE, 0xCC, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0F, 0x1F, 0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x03,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
+0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x03, 0x07, 0x0E, 0x0C,
+0x18, 0x18, 0x0C, 0x06, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0E, 0x0C, 0x18, 0x0C, 0x0F,
+0x07, 0x01, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00,
+0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x07,
+0x07, 0x0C, 0x0C, 0x18, 0x1C, 0x0C, 0x06, 0x06, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#endif
+#endif
+};
+
+void lcd_fastSPIwrite(LCD_Handler_t *lcd, uint8_t d);
+#define lcd_swap(a, b) { int16_t t = a; a = b; b = t; }
+
+// the most basic function, set a single pixel
+void lcd_drawPixel(LCD_Handler_t *lcd, int16_t x, int16_t y, uint16_t color) {
+	if ((x < 0) || (x >= lcd->_width) || (y < 0) || (y >= lcd->_height))
+		return;
+
+	// check rotation, move pixel around if necessary
+	switch (lcd->rotation) {
+	case 1:
+		lcd_swap(x, y);
+		x = lcd->_width - x - 1;
+		break;
+	case 2:
+		x = lcd->_width - x - 1;
+		y = lcd->_height - y - 1;
+		break;
+	case 3:
+		lcd_swap(x, y);
+		y = lcd->_height - y - 1;
+		break;
+	}
+
+	// x is which column
+	switch (color)
+	{
+	case WHITE:   buffer[x + (y / 8)*SSD1306_LCDWIDTH] |= (1 << (y & 7)); break;
+	case BLACK:   buffer[x + (y / 8)*SSD1306_LCDWIDTH] &= ~(1 << (y & 7)); break;
+	case INVERSE: buffer[x + (y / 8)*SSD1306_LCDWIDTH] ^= (1 << (y & 7)); break;
+	}
+}
+
+void lcd_init1(LCD_Handler_t *lcd, int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS)
+{
+	lcd->_width = SSD1306_LCDWIDTH;
+	lcd->_height = SSD1306_LCDHEIGHT;
+	gpio_init(&lcd->cs, CS);
+	gpio_init(&lcd->rst, RST);
+	gpio_init(&lcd->dc, DC);
+	gpio_init(&lcd->sclk, SCLK);
+	gpio_init(&lcd->sid, SID);
+	lcd->hwSPI = false;
+}
+
+// constructor for hardware SPI - we indicate DataCommand, ChipSelect, Reset
+void lcd_init2(LCD_Handler_t *lcd, int8_t DC, int8_t RST, int8_t CS)
+{
+	lcd->_width = SSD1306_LCDWIDTH;
+	lcd->_height = SSD1306_LCDHEIGHT;
+	gpio_init(&lcd->dc, DC);
+	gpio_init(&lcd->rst, RST);
+	gpio_init(&lcd->cs, CS);
+	lcd->hwSPI = true;
+}
+
+// initializer for I2C - we only indicate the reset pin!
+void lcd_init3(LCD_Handler_t *lcd, int8_t reset)
+{
+	lcd->_width = SSD1306_LCDWIDTH;
+	lcd->_height = SSD1306_LCDHEIGHT;
+	gpio_init(&lcd->sclk, NC);
+	gpio_init(&lcd->dc, NC);
+	gpio_init(&lcd->cs, NC);
+	gpio_init(&lcd->sid, NC);
+	gpio_init(&lcd->rst, reset);
+}
+
+void lcd_begin(LCD_Handler_t *lcd, uint8_t vccstate, uint8_t i2caddr, bool_t reset) {
+	lcd->_vccstate = vccstate;
+	lcd->_i2caddr = i2caddr;
+
+	// set pin directions
+	if (lcd->sid.pin != NC) {
+		gpio_dir(&lcd->dc, PIN_OUTPUT);
+		gpio_dir(&lcd->cs, PIN_OUTPUT);
+		if (!lcd->hwSPI) {
+			// set pins for software-SPI
+			gpio_dir(&lcd->sid, PIN_OUTPUT);
+			gpio_dir(&lcd->sclk, PIN_OUTPUT);
+		}
+		if (lcd->hwSPI) {
+			spi_format(&lcd->spi, 8, 0, 0);
+			spi_master_write(&lcd->spi, 8000000);
+		}
+	}
+	else
+	{
+		// I2C Init
+		//i2c_begin(&lcd->i2c);
+#ifdef __SAM3X8E__
+		// Force 400 KHz I2C, rawr! (Uses pins 20, 21 for SDA, SCL)
+		TWI1->TWI_CWGR = 0;
+		TWI1->TWI_CWGR = ((VARIANT_MCK / (2 * 400000)) - 4) * 0x101;
+#endif
+	}
+	if ((reset) && (lcd->rst.pin != NC)) {
+		// Setup reset pin direction (used by both SPI and I2C)
+		gpio_dir(&lcd->rst, PIN_OUTPUT);
+		gpio_write(&lcd->rst, HIGH);
+		// VDD (3.3V) goes high at start, lets just chill for a ms
+		dly_tsk(1 * 1000);
+		// bring reset low
+		gpio_write(&lcd->rst, LOW);
+		// wait 10ms
+		dly_tsk(10 * 1000);
+		// bring out of reset
+		gpio_write(&lcd->rst, HIGH);
+		// turn on VCC (9V?)
+	}
+
+	// Init sequence
+	lcd_command(lcd, SSD1306_DISPLAYOFF);                    // 0xAE
+	lcd_command(lcd, SSD1306_SETDISPLAYCLOCKDIV);            // 0xD5
+	lcd_command(lcd, 0x80);                                  // the suggested ratio 0x80
+
+	lcd_command(lcd, SSD1306_SETMULTIPLEX);                  // 0xA8
+	lcd_command(lcd, SSD1306_LCDHEIGHT - 1);
+
+	lcd_command(lcd, SSD1306_SETDISPLAYOFFSET);              // 0xD3
+	lcd_command(lcd, 0x0);                                   // no offset
+	lcd_command(lcd, SSD1306_SETSTARTLINE | 0x0);            // line #0
+	lcd_command(lcd, SSD1306_CHARGEPUMP);                    // 0x8D
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x10);
+	}
+	else
+	{
+		lcd_command(lcd, 0x14);
+	}
+	lcd_command(lcd, SSD1306_MEMORYMODE);                    // 0x20
+	lcd_command(lcd, 0x00);                                  // 0x0 act like ks0108
+	lcd_command(lcd, SSD1306_SEGREMAP | 0x1);
+	lcd_command(lcd, SSD1306_COMSCANDEC);
+
+#if defined SSD1306_128_32
+	lcd_command(lcd, SSD1306_SETCOMPINS);                    // 0xDA
+	lcd_command(lcd, 0x02);
+	lcd_command(lcd, SSD1306_SETCONTRAST);                   // 0x81
+	lcd_command(lcd, 0x8F);
+
+#elif defined SSD1306_128_64
+	lcd_command(lcd, SSD1306_SETCOMPINS);                    // 0xDA
+	lcd_command(lcd, 0x12);
+	lcd_command(lcd, SSD1306_SETCONTRAST);                   // 0x81
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x9F);
+	}
+	else
+	{
+		lcd_command(lcd, 0xCF);
+	}
+
+#elif defined SSD1306_96_16
+	lcd_command(lcd, SSD1306_SETCOMPINS);                    // 0xDA
+	lcd_command(lcd, 0x2);   //ada x12
+	lcd_command(lcd, SSD1306_SETCONTRAST);                   // 0x81
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x10);
+	}
+	else
+	{
+		lcd_command(lcd, 0xAF);
+	}
+
+#endif
+
+	lcd_command(lcd, SSD1306_SETPRECHARGE);                  // 0xd9
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x22);
+	}
+	else
+	{
+		lcd_command(lcd, 0xF1);
+	}
+	lcd_command(lcd, SSD1306_SETVCOMDETECT);                 // 0xDB
+	lcd_command(lcd, 0x40);
+	lcd_command(lcd, SSD1306_DISPLAYALLON_RESUME);           // 0xA4
+	lcd_command(lcd, SSD1306_NORMALDISPLAY);                 // 0xA6
+
+	lcd_command(lcd, SSD1306_DEACTIVATE_SCROLL);
+
+	lcd_command(lcd, SSD1306_DISPLAYON);//--turn on oled panel
+}
+
+
+void lcd_invertDisplay(LCD_Handler_t *lcd, uint8_t i) {
+	if (i) {
+		lcd_command(lcd, SSD1306_INVERTDISPLAY);
+	}
+	else {
+		lcd_command(lcd, SSD1306_NORMALDISPLAY);
+	}
+}
+
+void lcd_command(LCD_Handler_t *lcd, uint8_t c) {
+	if (lcd->sid.pin != NC)
+	{
+		// SPI
+		gpio_write(&lcd->cs, HIGH);
+		gpio_write(&lcd->dc, LOW);
+		gpio_write(&lcd->cs, LOW);
+		lcd_fastSPIwrite(lcd, c);
+		gpio_write(&lcd->cs, HIGH);
+	}
+	else
+	{
+		// I2C
+		uint8_t data[2] = { 0x00/* Co = 0, D/C = 0*/, c };
+		i2c_write(&lcd->i2c, lcd->_i2caddr, data, sizeof(data), 1);
+	}
+}
+
+// startscrollright
+// Activate a right handed scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrollright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_RIGHT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, 0XFF);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+// startscrollleft
+// Activate a right handed scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrollleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_LEFT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, 0XFF);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+// startscrolldiagright
+// Activate a diagonal scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrolldiagright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_SET_VERTICAL_SCROLL_AREA);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, SSD1306_LCDHEIGHT);
+	lcd_command(lcd, SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X01);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+// startscrolldiagleft
+// Activate a diagonal scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrolldiagleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_SET_VERTICAL_SCROLL_AREA);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, SSD1306_LCDHEIGHT);
+	lcd_command(lcd, SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X01);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+void lcd_stopscroll(LCD_Handler_t *lcd) {
+	lcd_command(lcd, SSD1306_DEACTIVATE_SCROLL);
+}
+
+// Dim the display
+// dim = true: display is dimmed
+// dim = false: display is normal
+void lcd_dim(LCD_Handler_t *lcd, bool_t dim) {
+	uint8_t contrast;
+
+	if (dim) {
+		contrast = 0; // Dimmed display
+	}
+	else {
+		if (lcd->_vccstate == SSD1306_EXTERNALVCC) {
+			contrast = 0x9F;
+		}
+		else {
+			contrast = 0xCF;
+		}
+	}
+	// the range of contrast to too small to be really useful
+	// it is useful to dim the display
+	lcd_command(lcd, SSD1306_SETCONTRAST);
+	lcd_command(lcd, contrast);
+}
+
+void lcd_display(LCD_Handler_t *lcd) {
+	lcd_command(lcd, SSD1306_COLUMNADDR);
+	lcd_command(lcd, 0);   // Column start address (0 = reset)
+	lcd_command(lcd, SSD1306_LCDWIDTH - 1); // Column end address (127 = reset)
+
+	lcd_command(lcd, SSD1306_PAGEADDR);
+	lcd_command(lcd, 0); // Page start address (0 = reset)
+#if SSD1306_LCDHEIGHT == 64
+	lcd_command(lcd, 7); // Page end address
+#endif
+#if SSD1306_LCDHEIGHT == 32
+	lcd_command(lcd, 3); // Page end address
+#endif
+#if SSD1306_LCDHEIGHT == 16
+	lcd_command(lcd, 1); // Page end address
+#endif
+
+	if (lcd->sid.pin != NC)
+	{
+		// SPI
+		gpio_write(&lcd->cs, HIGH);
+		gpio_write(&lcd->dc, HIGH);
+		gpio_write(&lcd->cs, LOW);
+
+		for (uint16_t i = 0; i < (SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT / 8); i++) {
+			lcd_fastSPIwrite(lcd, buffer[i]);
+		}
+		gpio_write(&lcd->cs, HIGH);
+	}
+	else
+	{
+		// save I2C bitrate
+#ifdef TWBR
+		uint8_t twbrbackup = TWBR;
+		TWBR = 12; // upgrade to 400KHz!
+#endif
+		//Serial.println(TWBR, DEC);
+		//Serial.println(TWSR & 0x3, DEC);
+
+		// I2C
+		uint8_t data[17] = { 0x40, };
+		for (uint16_t i = 0; i < (SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT / 8); i+=16) {
+			// send a bunch of data in one xmission
+			memcpy(&data[1], &buffer[i], 16);
+			i2c_write(&lcd->i2c, lcd->_i2caddr, data, sizeof(data), 1);
+		}
+#ifdef TWBR
+		TWBR = twbrbackup;
+#endif
+	}
+}
+
+// clear everything
+void lcd_clearDisplay(LCD_Handler_t *lcd) {
+	memset(buffer, 0, (SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT / 8));
+}
+
+void lcd_fastSPIwrite(LCD_Handler_t *lcd, uint8_t d)
+{
+	if (lcd->hwSPI) {
+		spi_master_write(&lcd->spi, d);
+	}
+	else {
+		for (uint8_t bit = 0x80; bit; bit >>= 1) {
+			gpio_write(&lcd->sclk, LOW);
+			if (d & bit) gpio_write(&lcd->sid, HIGH);
+			else        gpio_write(&lcd->sid, LOW);
+			gpio_write(&lcd->sclk, HIGH);
+		}
+	}
+}
+
+void lcd_drawFastHLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color) {
+	bool_t bSwap = false;
+	switch (lcd->rotation) {
+	case 0:
+		// 0 degree rotation, do nothing
+		break;
+	case 1:
+		// 90 degree rotation, swap x & y for rotation, then invert x
+		bSwap = true;
+		lcd_swap(x, y);
+		x = lcd->_width - x - 1;
+		break;
+	case 2:
+		// 180 degree rotation, invert x and y - then shift y around for height.
+		x = lcd->_width - x - 1;
+		y = lcd->_height - y - 1;
+		x -= (w - 1);
+		break;
+	case 3:
+		// 270 degree rotation, swap x & y for rotation, then invert y  and adjust y for w (not to become h)
+		bSwap = true;
+		lcd_swap(x, y);
+		y = lcd->_height - y - 1;
+		y -= (w - 1);
+		break;
+	}
+
+	if (bSwap) {
+		lcd_drawFastVLineInternal(lcd, x, y, w, color);
+	}
+	else {
+		lcd_drawFastHLineInternal(lcd, x, y, w, color);
+	}
+}
+
+void lcd_drawFastHLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color) {
+	// Do bounds/limit checks
+	if (y < 0 || y >= lcd->_height) { return; }
+
+	// make sure we don't try to draw below 0
+	if (x < 0) {
+		w += x;
+		x = 0;
+	}
+
+	// make sure we don't go off the edge of the display
+	if ((x + w) > lcd->_width) {
+		w = (lcd->_width - x);
+	}
+
+	// if our width is now negative, punt
+	if (w <= 0) { return; }
+
+	// set up the pointer for  movement through the buffer
+	register uint8_t *pBuf = buffer;
+	// adjust the buffer pointer for the current row
+	pBuf += ((y / 8) * SSD1306_LCDWIDTH);
+	// and offset x columns in
+	pBuf += x;
+
+	register uint8_t mask = 1 << (y & 7);
+
+	switch (color)
+	{
+	case WHITE:         while (w--) { *pBuf++ |= mask; }; break;
+	case BLACK: mask = ~mask;   while (w--) { *pBuf++ &= mask; }; break;
+	case INVERSE:         while (w--) { *pBuf++ ^= mask; }; break;
+	}
+}
+
+void lcd_drawFastVLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t h, uint16_t color) {
+	bool_t bSwap = false;
+	switch (lcd->rotation) {
+	case 0:
+		break;
+	case 1:
+		// 90 degree rotation, swap x & y for rotation, then invert x and adjust x for h (now to become w)
+		bSwap = true;
+		lcd_swap(x, y);
+		x = lcd->_width - x - 1;
+		x -= (h - 1);
+		break;
+	case 2:
+		// 180 degree rotation, invert x and y - then shift y around for height.
+		x = lcd->_width - x - 1;
+		y = lcd->_height - y - 1;
+		y -= (h - 1);
+		break;
+	case 3:
+		// 270 degree rotation, swap x & y for rotation, then invert y
+		bSwap = true;
+		lcd_swap(x, y);
+		y = lcd->_height - y - 1;
+		break;
+	}
+
+	if (bSwap) {
+		lcd_drawFastHLineInternal(lcd, x, y, h, color);
+	}
+	else {
+		lcd_drawFastVLineInternal(lcd, x, y, h, color);
+	}
+}
+
+
+void lcd_drawFastVLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t __y, int16_t __h, uint16_t color) {
+
+	// do nothing if we're off the left or right side of the screen
+	if (x < 0 || x >= lcd->_width) { return; }
+
+	// make sure we don't try to draw below 0
+	if (__y < 0) {
+		// __y is negative, this will subtract enough from __h to account for __y being 0
+		__h += __y;
+		__y = 0;
+
+	}
+
+	// make sure we don't go past the height of the display
+	if ((__y + __h) > lcd->_height) {
+		__h = (lcd->_height - __y);
+	}
+
+	// if our height is now negative, punt
+	if (__h <= 0) {
+		return;
+	}
+
+	// this display doesn't need ints for coordinates, use local byte registers for faster juggling
+	register uint8_t y = __y;
+	register uint8_t h = __h;
+
+
+	// set up the pointer for fast movement through the buffer
+	register uint8_t *pBuf = buffer;
+	// adjust the buffer pointer for the current row
+	pBuf += ((y / 8) * SSD1306_LCDWIDTH);
+	// and offset x columns in
+	pBuf += x;
+
+	// do the first partial byte, if necessary - this requires some masking
+	register uint8_t mod = (y & 7);
+	if (mod) {
+		// mask off the high n bits we want to set
+		mod = 8 - mod;
+
+		// note - lookup table results in a nearly 10% performance improvement in fill* functions
+		// register uint8_t mask = ~(0xFF >> (mod));
+		static uint8_t premask[8] = { 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
+		register uint8_t mask = premask[mod];
+
+		// adjust the mask if we're not going to reach the end of this byte
+		if (h < mod) {
+			mask &= (0XFF >> (mod - h));
+		}
+
+		switch (color)
+		{
+		case WHITE:   *pBuf |= mask;  break;
+		case BLACK:   *pBuf &= ~mask;  break;
+		case INVERSE: *pBuf ^= mask;  break;
+		}
+
+		// fast exit if we're done here!
+		if (h < mod) { return; }
+
+		h -= mod;
+
+		pBuf += SSD1306_LCDWIDTH;
+	}
+
+	// write solid bytes while we can - effectively doing 8 rows at a time
+	if (h >= 8) {
+		if (color == INVERSE) {          // separate copy of the code so we don't impact performance of the black/white write version with an extra comparison per loop
+			do {
+				*pBuf = ~(*pBuf);
+
+				// adjust the buffer forward 8 rows worth of data
+				pBuf += SSD1306_LCDWIDTH;
+
+				// adjust h & y (there's got to be a faster way for me to do this, but this should still help a fair bit for now)
+				h -= 8;
+			} while (h >= 8);
+		}
+		else {
+			// store a local value to work with
+			register uint8_t val = (color == WHITE) ? 255 : 0;
+
+			do {
+				// write our value in
+				*pBuf = val;
+
+				// adjust the buffer forward 8 rows worth of data
+				pBuf += SSD1306_LCDWIDTH;
+
+				// adjust h & y (there's got to be a faster way for me to do this, but this should still help a fair bit for now)
+				h -= 8;
+			} while (h >= 8);
+		}
+	}
+
+	// now do the final partial byte, if necessary
+	if (h) {
+		mod = h & 7;
+		// this time we want to mask the low bits of the byte, vs the high bits we did above
+		// register uint8_t mask = (1 << mod) - 1;
+		// note - lookup table results in a nearly 10% performance improvement in fill* functions
+		static uint8_t postmask[8] = { 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F };
+		register uint8_t mask = postmask[mod];
+		switch (color)
+		{
+		case WHITE:   *pBuf |= mask;  break;
+		case BLACK:   *pBuf &= ~mask;  break;
+		case INVERSE: *pBuf ^= mask;  break;
+		}
+	}
+}
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h	(revision 364)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h	(revision 364)
@@ -0,0 +1,160 @@
+/*********************************************************************
+This is a library for our Monochrome OLEDs based on SSD1306 drivers
+
+  Pick one up today in the adafruit shop!
+  ------> http://www.adafruit.com/category/63_98
+
+These displays use SPI to communicate, 4 or 5 pins are required to
+interface
+
+Adafruit invests time and resources providing this open source code,
+please support Adafruit and open-source hardware by purchasing
+products from Adafruit!
+
+Written by Limor Fried/Ladyada  for Adafruit Industries.
+BSD license, check license.txt for more information
+All text above, and the splash screen must be included in any redistribution
+*********************************************************************/
+#ifndef _Adafruit_SSD1306_H_
+#define _Adafruit_SSD1306_H_
+
+#include "gpio_api.h"
+#include "spi_api.h"
+#include "i2c_api.h"
+
+#define BLACK 0
+#define WHITE 1
+#define INVERSE 2
+
+#define SSD1306_I2C_ADDRESS   0x78  // 011110+SA0+RW - 0x78 or 0x7A
+// Address for 128x32 is 0x3C
+// Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)
+
+/*=========================================================================
+	SSD1306 Displays
+	-----------------------------------------------------------------------
+	The driver is used in multiple displays (128x64, 128x32, etc.).
+	Select the appropriate display below to create an appropriately
+	sized framebuffer, etc.
+
+	SSD1306_128_64  128x64 pixel display
+
+	SSD1306_128_32  128x32 pixel display
+
+	SSD1306_96_16
+
+	-----------------------------------------------------------------------*/
+#define SSD1306_128_64
+//#define SSD1306_128_32
+//   #define SSD1306_96_16
+/*=========================================================================*/
+
+#if defined SSD1306_128_64 && defined SSD1306_128_32
+#error "Only one SSD1306 display can be specified at once in SSD1306.h"
+#endif
+#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
+#error "At least one SSD1306 display must be specified in SSD1306.h"
+#endif
+
+#if defined SSD1306_128_64
+#define SSD1306_LCDWIDTH                  128
+#define SSD1306_LCDHEIGHT                 64
+#endif
+#if defined SSD1306_128_32
+#define SSD1306_LCDWIDTH                  128
+#define SSD1306_LCDHEIGHT                 32
+#endif
+#if defined SSD1306_96_16
+#define SSD1306_LCDWIDTH                  96
+#define SSD1306_LCDHEIGHT                 16
+#endif
+
+#define SSD1306_SETCONTRAST 0x81
+#define SSD1306_DISPLAYALLON_RESUME 0xA4
+#define SSD1306_DISPLAYALLON 0xA5
+#define SSD1306_NORMALDISPLAY 0xA6
+#define SSD1306_INVERTDISPLAY 0xA7
+#define SSD1306_DISPLAYOFF 0xAE
+#define SSD1306_DISPLAYON 0xAF
+
+#define SSD1306_SETDISPLAYOFFSET 0xD3
+#define SSD1306_SETCOMPINS 0xDA
+
+#define SSD1306_SETVCOMDETECT 0xDB
+
+#define SSD1306_SETDISPLAYCLOCKDIV 0xD5
+#define SSD1306_SETPRECHARGE 0xD9
+
+#define SSD1306_SETMULTIPLEX 0xA8
+
+#define SSD1306_SETLOWCOLUMN 0x00
+#define SSD1306_SETHIGHCOLUMN 0x10
+
+#define SSD1306_SETSTARTLINE 0x40
+
+#define SSD1306_MEMORYMODE 0x20
+#define SSD1306_COLUMNADDR 0x21
+#define SSD1306_PAGEADDR   0x22
+
+#define SSD1306_COMSCANINC 0xC0
+#define SSD1306_COMSCANDEC 0xC8
+
+#define SSD1306_SEGREMAP 0xA0
+
+#define SSD1306_CHARGEPUMP 0x8D
+
+#define SSD1306_EXTERNALVCC 0x1
+#define SSD1306_SWITCHCAPVCC 0x2
+
+// Scrolling #defines
+#define SSD1306_ACTIVATE_SCROLL 0x2F
+#define SSD1306_DEACTIVATE_SCROLL 0x2E
+#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
+#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
+#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
+#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
+#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
+
+typedef struct
+{
+	uint16_t                _width;		/* 幅ピクセル数 */
+	uint16_t				_height;	/* 高さピクセル数 */
+	int rotation;
+	int8_t _i2caddr, _vccstate;
+	gpio_t sid, sclk, dc, rst, cs;
+	bool_t hwSPI;
+	i2c_t i2c;
+	spi_t spi;
+} LCD_Handler_t;
+
+void lcd_init1(LCD_Handler_t *lcd, int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);
+void lcd_init2(LCD_Handler_t *lcd, int8_t DC, int8_t RST, int8_t CS);
+//void lcd_init3(LCD_Handler_t *lcd, int8_t RST = -1);
+void lcd_init3(LCD_Handler_t *lcd, int8_t RST);
+
+//void lcd_begin(LCD_Handler_t *lcd, uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool_t reset = true);
+void lcd_begin(LCD_Handler_t *lcd, uint8_t switchvcc, uint8_t i2caddr, bool_t reset);
+void lcd_command(LCD_Handler_t *lcd, uint8_t c);
+
+void lcd_clearDisplay(LCD_Handler_t *lcd);
+void lcd_invertDisplay(LCD_Handler_t *lcd, uint8_t i);
+void lcd_display(LCD_Handler_t *lcd);
+
+void lcd_startscrollright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+void lcd_startscrollleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+
+void lcd_startscrolldiagright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+void lcd_startscrolldiagleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+void lcd_stopscroll(LCD_Handler_t *lcd);
+
+void lcd_dim(LCD_Handler_t *lcd, bool_t dim);
+
+void lcd_drawPixel(LCD_Handler_t *lcd, int16_t x, int16_t y, uint16_t color);
+
+void lcd_drawFastVLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t h, uint16_t color);
+void lcd_drawFastHLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color);
+
+void lcd_drawFastVLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t h, uint16_t color);
+void lcd_drawFastHLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color);
+
+#endif /* _Adafruit_SSD1306_H_ */
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c	(revision 352)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c	(revision 364)
@@ -354,4 +354,37 @@
 
 /*
+ *  LCDへのRGBデータ送信関数
+ */
+ER
+lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height)
+{
+	ER  ercd = E_OK;
+	int index, i;
+
+	if(width == 0 || height == 0)
+		return ercd;
+	if(hlcd->spi_lock != 0){
+		if((ercd = wai_sem(hlcd->spi_lock)) != E_OK)
+			return ercd;
+	}
+	rs_set(PORT_HIGH);
+	cs_set(PORT_LOW);
+	//dly_tsk(100/*us*/);
+	for(index=0; index < height; index++){
+		uint8_t *p = pbmp;
+		for (i = 0; i < width; i++){
+			spi_master_write(&hlcd->hspi, *p++);
+			spi_master_write(&hlcd->hspi, *p++);
+		}
+		pbmp -= width*2;
+	}
+	//dly_tsk(100/*us*/);
+	cs_set(PORT_HIGH);
+	if(hlcd->spi_lock != 0)
+		sig_sem(hlcd->spi_lock);
+	return ercd;
+}
+
+/*
  *  ST7735へのコマンドリスト送信
  */
@@ -590,4 +623,12 @@
 	lcd_setAddrWindow(hlcd, x0, y0, x0+width-1, y0+height-1);
 	lcd_writedata3(hlcd, pbmp, width, height);
+}
+
+void
+lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp)
+{
+	lcd_setAddrWindow(hlcd, x0, y0, x0+w-1, y0+h-1);
+	pbmp += w * (h - 1) * 3;  
+	lcd_writedata3(hlcd, pbmp, w, h);
 }
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h	(revision 352)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h	(revision 364)
@@ -59,4 +59,5 @@
 #endif
 
+#include <stdbool.h>
 #include "device.h"
 #include "pinmap.h"
@@ -145,4 +146,6 @@
 #ifndef TOPPERS_MACRO_ONLY
 
+typedef struct GFXfont GFXfont;
+
 /*
  *  LCDハンドラ構造体定義
@@ -153,4 +156,9 @@
 	uint16_t                _width;		/* 幅ピクセル数 */
 	uint16_t				_height;	/* 高さピクセル数 */
+	int16_t cursor_x, cursor_y;
+	uint16_t textcolor, textbgcolor;
+	uint8_t textsize, rotation;
+	bool wrap;
+	GFXfont *gfxFont;
 	uint8_t                 colstart;
 	uint8_t                 rowstart;
@@ -188,4 +196,5 @@
 extern ER lcd_writedata2(LCD_Handler_t *hlcd, uint16_t c, int cnt);
 extern ER lcd_writedata3(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
+extern ER lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
 
 extern void lcd_initB(LCD_Handler_t *hlcd);
@@ -198,4 +207,5 @@
 extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, uint16_t color);
 extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, uint8_t *pbmp);
+extern void lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp);
 extern void lcd_invertDisplay(LCD_Handler_t *hlcd, bool_t i);
 
