...

Dependencies:   DS_1337_1 mbed

Fork of Xadow_Watch_RGBOLED by hs loovee

Files at this revision

API Documentation at this revision

Comitter:
loovee
Date:
Tue Apr 01 07:02:59 2014 +0000
Commit message:
..

Changed in this revision

DS_1337.lib Show annotated file Show diff for this revision Revisions of this file
Defs.h Show annotated file Show diff for this revision Revisions of this file
font_watch.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DS_1337.lib	Tue Apr 01 07:02:59 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/loovee/code/DS_1337_1/#9d7c6f478d8c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Defs.h	Tue Apr 01 07:02:59 2014 +0000
@@ -0,0 +1,83 @@
+#ifndef Defs_h__
+#define Defs_h__
+
+#include "mbed.h"
+
+/*
+#define RED         0b1111100000000000
+#define GREEN       0b0000011111100000
+#define BLUE        0b0000000000011111
+#define YELLOW      0b1111111111100000
+#define CYAN        0b0000011111111111
+#define PURPLE      0b1000000000010000
+#define MAGENTA     0b1111100000011111
+#define DARKBLUE    0b0000000000010000
+#define DUCKGREEN   0b0000010000010000
+#define DARKGREEN   0b0000010000000000
+#define OLIVE       0b1000010000000000
+#define MAROON      0b1000000000000000
+#define SLIVER      0b1100011000011000
+#define GRAY        0b1000010000010000
+#define BLACK       0b0000000000000000
+#define WHITE       0b1111111111111111
+*/
+
+#define RED         0xF800
+#define GREEN       0x07E0
+#define BLUE        0x001f
+#define YELLOW      0xFFE0
+#define CYAN        0x07FF
+#define PURPLE      0x8010
+#define MAGENTA     0xF81F
+#define DARKBLUE    0x0010
+#define DUCKGREEN   0x0410
+#define DARKGREEN   0x0400
+#define OLIVE       0x8400
+#define MAROON      0x8000
+#define SLIVER      0xC618
+#define GRAY        0x8410
+#define BLACK       0x0000
+#define WHITE       0xffff
+
+
+// Select one of these defines to set the pixel color order
+#define SSD1331_COLORORDER_RGB
+// #define SSD1331_COLORORDER_BGR
+#if defined SSD1331_COLORORDER_RGB && defined SSD1331_COLORORDER_BGR
+  #error "RGB and BGR can not both be defined for SSD1331_COLORODER."
+#endif
+
+// Timing Delays
+#define SSD1331_DELAYS_HWFILL       (3)
+#define SSD1331_DELAYS_HWLINE       (1)
+
+#define SSD1331_CMD_DRAWLINE        0x21
+#define SSD1331_CMD_DRAWRECT        0x22
+#define SSD1331_CMD_FILL            0x26
+#define SSD1331_CMD_SETCOLUMN       0x15
+#define SSD1331_CMD_SETROW          0x75
+#define SSD1331_CMD_CONTRASTA       0x81
+#define SSD1331_CMD_CONTRASTB       0x82
+#define SSD1331_CMD_CONTRASTC       0x83
+#define SSD1331_CMD_MASTERCURRENT   0x87
+#define SSD1331_CMD_SETREMAP        0xA0
+#define SSD1331_CMD_STARTLINE       0xA1
+#define SSD1331_CMD_DISPLAYOFFSET   0xA2
+#define SSD1331_CMD_NORMALDISPLAY   0xA4
+#define SSD1331_CMD_DISPLAYALLON    0xA5
+#define SSD1331_CMD_DISPLAYALLOFF   0xA6
+#define SSD1331_CMD_INVERTDISPLAY   0xA7
+#define SSD1331_CMD_SETMULTIPLEX    0xA8
+#define SSD1331_CMD_SETMASTER       0xAD
+#define SSD1331_CMD_DISPLAYOFF      0xAE
+#define SSD1331_CMD_DISPLAYON       0xAF
+#define SSD1331_CMD_POWERMODE       0xB0
+#define SSD1331_CMD_PRECHARGE       0xB1
+#define SSD1331_CMD_CLOCKDIV        0xB3
+#define SSD1331_CMD_PRECHARGEA      0x8A
+#define SSD1331_CMD_PRECHARGEB      0x8B
+#define SSD1331_CMD_PRECHARGEC      0x8C
+#define SSD1331_CMD_PRECHARGELEVEL  0xBB
+#define SSD1331_CMD_VCOMH           0xBE
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/font_watch.h	Tue Apr 01 07:02:59 2014 +0000
@@ -0,0 +1,526 @@
+#ifndef __FONT_WATCH_H__
+#define __FONT_WATCH_H__
+
+const unsigned char font_num[10][44] = 
+{
+
+/*--  文字:  0  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,
+0xFC,0xFF,0xFF,0xFF,0x07,0x01,0x1F,0xFF,0xFF,0xFF,0x00,
+0x07,0x1F,0x3F,0x7F,0x7C,0x70,0x7F,0x7F,0x3F,0x1F,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  1  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x38,0x3C,0x1E,0xFF,
+0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  2  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x0C,0x0F,0x0F,0x0F,0x87,
+0xC1,0xF3,0xFF,0xFF,0x7F,0x00,0x70,0x78,0x7E,0x7F,0x7F,0x7F,0x73,0x71,0x70,0x70,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  3  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x04,0x07,0x07,0x07,0xE7,
+0xF1,0xFF,0xFF,0xBF,0x9F,0x00,0x0C,0x3C,0x3C,0x7C,0x78,0x70,0x79,0x7F,0x3F,0x3F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  4  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0xC0,0xF0,0xFC,0xFF,
+0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x0F,0x0F,0x0F,0x0F,0x0E,0x7F,0x7F,0x7F,0x7F,0x7F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  5  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x40,0x7F,0x7F,0x7F,0x7F,
+0x39,0x79,0xF9,0xF9,0xF1,0x00,0x06,0x1E,0x3E,0x7E,0x7C,0x70,0x78,0x7F,0x3F,0x3F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  6  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,
+0x71,0xF7,0xF7,0xF7,0xE7,0x00,0x07,0x1F,0x3F,0x7F,0x7F,0x70,0x78,0x7F,0x3F,0x3F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  7  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x01,0x01,0x01,0xC1,0xF1,
+0xFD,0xFF,0x7F,0x0F,0x03,0x00,0x00,0x00,0x7C,0x7F,0x7F,0x7F,0x07,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  8  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x06,0xDF,0xFF,0xFF,0xFF,
+0x71,0xFF,0xFF,0xFF,0xDF,0x00,0x0F,0x3F,0x3F,0x7F,0x78,0x70,0x78,0x7F,0x3F,0x3F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  9  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=11x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=11x32  --*/
+0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xE3,
+0xC1,0xFF,0xFF,0xFF,0xFF,0xFC,0x0C,0x3C,0x7D,0x7D,0x79,0x71,0x7F,0x7F,0x3F,0x1F,
+0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
+const unsigned char font_dot[] = 
+{/*--  文字:  :  --*/
+/*--  Arial Narrow18;  此字体下对应的点阵为:宽x高=7x29   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=7x32  --*/
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x38,0x38,0x38,0x38,0x38,0x00,
+0x00,0x70,0x70,0x70,0x70,0x70,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+
+
+//8*16 font
+const unsigned char font_ascii[95][16] = 
+{
+/*--  文字:     --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  !  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x0D,0x00,0x00,0x00,
+
+/*--  文字:  "  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x08,0x0C,0x0E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  #  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x10,0xD0,0xFC,0x3C,0xD0,0xFC,0x3C,0x00,0x01,0x0F,0x0F,0x01,0x0F,0x0F,0x01,0x00,
+
+/*--  文字:  $  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x38,0x7C,0xFE,0xFE,0x9C,0x18,0x00,0x00,0x06,0x0E,0x1F,0x1F,0x0F,0x07,0x00,
+
+/*--  文字:  %  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x78,0xFC,0xFC,0xF8,0xFC,0xCC,0x80,0x00,0x00,0x0C,0x0F,0x07,0x0F,0x0F,0x07,0x00,
+
+/*--  文字:  &  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x80,0xF8,0xFC,0xFC,0xF8,0xC0,0x40,0x00,0x07,0x0F,0x09,0x0F,0x0F,0x0B,0x0C,0x04,
+
+/*--  文字:  '  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x12,0x1E,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  (  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0xF0,0xFC,0x0E,0x02,0x00,0x00,0x00,0x00,0x03,0x0F,0x1C,0x10,0x00,
+
+/*--  文字:  )  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x02,0x0E,0xFC,0xF0,0x00,0x00,0x00,0x00,0x10,0x1C,0x0F,0x03,0x00,0x00,0x00,
+
+/*--  文字:  *  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x90,0xF0,0xF8,0xF8,0xF0,0x90,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,
+
+/*--  文字:  +  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x80,0x80,0x80,0xF0,0xF0,0x80,0x80,0x80,0x00,0x00,0x00,0x07,0x07,0x00,0x00,0x00,
+
+/*--  文字:  ,  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x3C,0x1C,0x00,0x00,0x00,0x00,
+
+/*--  文字:  -  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  .  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x0C,0x00,0x00,0x00,0x00,
+
+/*--  文字:  /  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x80,0xE0,0x7C,0x1E,0x02,0x00,0x10,0x1E,0x0F,0x01,0x00,0x00,0x00,
+
+/*--  文字:  0  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
+
+/*--  文字:  1  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,
+
+/*--  文字:  2  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x70,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
+
+/*--  文字:  3  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x18,0x20,0x21,0x21,0x22,0x1C,0x00,
+
+/*--  文字:  4  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x40,0x30,0xF8,0x00,0x00,0x00,0x06,0x05,0x24,0x24,0x3F,0x24,0x24,
+
+/*--  文字:  5  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0xF8,0x88,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x20,0x20,0x20,0x11,0x0E,0x00,
+
+/*--  文字:  6  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0xE0,0x10,0x88,0x88,0x90,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x20,0x1F,0x00,
+
+/*--  文字:  7  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x18,0x08,0x08,0x88,0x68,0x18,0x00,0x00,0x00,0x00,0x3E,0x01,0x00,0x00,0x00,
+
+/*--  文字:  8  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,
+
+/*--  文字:  9  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0xF0,0x08,0x08,0x08,0x10,0xE0,0x00,0x00,0x01,0x12,0x22,0x22,0x11,0x0F,0x00,
+
+/*--  文字:  :  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x0C,0x00,0x00,
+
+/*--  文字:  ;  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,
+
+/*--  文字:  <  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0xC0,0xE0,0x30,0x18,0x0C,0x04,0x00,0x00,0x00,0x01,0x03,0x06,0x0C,0x08,0x00,
+
+/*--  文字:  =  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+
+/*--  文字:  >  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x04,0x0C,0x18,0x30,0xE0,0xC0,0x00,0x00,0x08,0x0C,0x06,0x03,0x01,0x00,0x00,
+
+/*--  文字:  ?  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x30,0x38,0x88,0xC8,0x78,0x30,0x00,0x00,0x00,0x00,0x0D,0x0D,0x0C,0x00,0x00,
+
+/*--  文字:  @  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x28,0x2F,0x28,0x17,0x00,
+
+/*--  文字:  A  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,
+
+/*--  文字:  B  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,
+
+/*--  文字:  C  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,
+
+/*--  文字:  D  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,
+
+/*--  文字:  E  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,
+
+/*--  文字:  F  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,
+
+/*--  文字:  G  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,
+
+/*--  文字:  H  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,
+
+/*--  文字:  I  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
+
+/*--  文字:  J  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,
+
+/*--  文字:  K  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,
+
+/*--  文字:  L  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,
+
+/*--  文字:  M  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x01,0x3E,0x01,0x3F,0x20,0x00,
+
+/*--  文字:  N  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,
+
+/*--  文字:  O  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,
+
+/*--  文字:  P  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,
+
+/*--  文字:  Q  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x28,0x28,0x30,0x50,0x4F,0x00,
+
+/*--  文字:  R  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,
+
+/*--  文字:  S  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,
+
+/*--  文字:  T  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,
+
+/*--  文字:  U  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,
+
+/*--  文字:  V  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,
+
+/*--  文字:  W  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0xF8,0x00,0xF8,0x00,0xF8,0x08,0x00,0x00,0x03,0x3E,0x01,0x3E,0x03,0x00,0x00,
+
+/*--  文字:  X  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,
+
+/*--  文字:  Y  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,
+
+/*--  文字:  Z  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,
+
+/*--  文字:  [  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0xFE,0xFE,0x02,0x02,0x00,0x00,0x00,0x00,0x1F,0x1F,0x10,0x10,0x00,
+
+/*--  文字:  \  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x04,0x3C,0xF8,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1E,0x10,0x00,
+
+/*--  文字:  ]  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x02,0x02,0xFE,0xFE,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x00,0x00,0x00,
+
+/*--  文字:  ^  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x02,0x03,0x01,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  _  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+
+/*--  文字:  `  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x01,0x01,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/*--  文字:  a  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x19,0x24,0x24,0x12,0x3F,0x20,0x00,
+
+/*--  文字:  b  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x10,0xF0,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,
+
+/*--  文字:  c  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,
+
+/*--  文字:  d  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x80,0x80,0x90,0xF0,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,
+
+/*--  文字:  e  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x24,0x24,0x24,0x24,0x17,0x00,
+
+/*--  文字:  f  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x80,0x80,0xE0,0x90,0x90,0x20,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
+
+/*--  文字:  g  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,
+
+/*--  文字:  h  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x10,0xF0,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,
+
+/*--  文字:  i  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
+
+/*--  文字:  j  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,
+
+/*--  文字:  k  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x10,0xF0,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x06,0x29,0x30,0x20,0x00,
+
+/*--  文字:  l  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
+
+/*--  文字:  m  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,
+
+/*--  文字:  n  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,
+
+/*--  文字:  o  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,
+
+/*--  文字:  p  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0x91,0x20,0x20,0x11,0x0E,0x00,
+
+/*--  文字:  q  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0x91,0xFF,0x80,
+
+/*--  文字:  r  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,
+
+/*--  文字:  s  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,
+
+/*--  文字:  t  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x10,0x00,
+
+/*--  文字:  u  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,
+
+/*--  文字:  v  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x03,0x0C,0x30,0x0C,0x03,0x00,0x00,
+
+/*--  文字:  w  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x00,0x80,0x80,0x00,0x80,0x80,0x01,0x0E,0x30,0x0C,0x07,0x38,0x06,0x01,
+
+/*--  文字:  x  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x20,0x31,0x0E,0x2E,0x31,0x20,0x00,
+
+/*--  文字:  y  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x81,0x86,0x78,0x18,0x06,0x01,0x00,
+
+/*--  文字:  z  --*/
+/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
+0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,
+
+/*--  文字:  {  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0x80,0xFE,0x7E,0x02,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x10,0x00,
+
+/*--  文字:  |  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,
+
+/*--  文字:  }  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x02,0x7E,0xFE,0x80,0x00,0x00,0x00,0x00,0x10,0x1F,0x1F,0x00,0x00,0x00,0x00,
+
+/*--  文字:  ~  --*/
+/*--  @宋体11;  此字体下对应的点阵为:宽x高=8x14   --*/
+/*--  高度不是8的倍数,现调整为:宽度x高度=8x16  --*/
+0x00,0x02,0x03,0x03,0x06,0x06,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+
+};
+
+
+const unsigned char font_ophw[] = 
+{
+
+0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF8,0xF0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xE0,
+0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xE0,0xC0,0xC0,0xC0,0xC0,0xE0,0xF0,0xF0,
+0xF8,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC7,0xFF,0xFF,
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC7,0x01,0x00,0x00,0x00,0x00,
+0x7E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7E,0x00,0x00,0x00,0x00,0x80,0xE3,0xFF,0xFF,
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x0E,0x00,0x00,0x00,0x00,0x06,0x3F,
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE3,0x80,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x01,0x01,0x03,0x07,0x0F,0x0F,0x0F,0x07,0x03,0x03,0x03,0x07,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x03,0x03,0x07,0x07,0x0F,
+0x0F,0x07,0x03,0x01,0x01,0x00,0x00,0x00
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 01 07:02:59 2014 +0000
@@ -0,0 +1,457 @@
+#include "mbed.h"
+//#include "USBSerial.h"
+#include "Defs.h"
+#include "pinmap.h"
+#include "font_watch.h"
+#include "DS1337.h"
+
+
+#define HARD_SPI        1
+
+//USBSerial pc;
+
+// functions
+void spiWrite(unsigned char data);
+void writeCommand(unsigned char cmd);
+void writeData(unsigned char data);
+void writeColor(unsigned int data);
+void initOLED(void);
+void clearOLED(void);
+void fillRect(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, unsigned int outlineColor, unsigned int fillColor);
+void drawLine(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, unsigned int color);
+void fillOLED(unsigned int color);
+
+//DigitalOut blue(P0_20);
+DigitalOut white(P0_23);
+DigitalOut PowerON_OLED(P0_15);
+DigitalOut DC_OLED(P0_11);
+
+DigitalOut CS_OLED(P0_2);
+
+
+#if HARD_SPI
+
+SPI spi(P0_9, P0_20, P0_10);        // mosi, miso, sclk
+
+#else
+DigitalOut MOSI_OLED(P0_9);
+DigitalOut SCK_OLED(P0_10);
+
+#endif
+
+
+DS1337 RTC(P0_5, P0_4);
+
+
+Serial uart(P0_19, P0_18);
+
+
+typedef struct{
+
+int hour;
+int minutes;
+int second;
+int year;
+int month;
+int day;
+int week;
+
+}TIME_S;
+
+TIME_S time_now, time_buf;
+
+void time_init()
+{
+    RTC.readTime();
+    time_now.hour      = RTC.getHours();
+    time_now.minutes   = RTC.getMinutes();
+    time_now.second    = RTC.getSeconds();
+    time_now.year      = RTC.getYears();
+    time_now.month     = RTC.getMonths();
+    time_now.day       = RTC.getDays();
+    time_now.week      = RTC.getDayOfWeek(); 
+    
+    time_buf.hour      = RTC.getHours();
+    time_buf.minutes   = RTC.getMinutes();
+    time_buf.second    = RTC.getSeconds();
+    time_buf.year      = RTC.getYears();
+    time_buf.month     = RTC.getMonths();
+    time_buf.day       = RTC.getDays();
+    time_buf.week      = RTC.getDayOfWeek(); 
+}
+
+void time_refresh()
+{
+    RTC.readTime();
+    time_now.hour      = RTC.getHours();
+    time_now.minutes   = RTC.getMinutes();
+    time_now.second    = RTC.getSeconds();
+    time_now.year      = RTC.getYears();
+    time_now.month     = RTC.getMonths();
+    time_now.day       = RTC.getDays();
+    time_now.week      = RTC.getDayOfWeek(); 
+}
+
+void setTime()
+{
+    RTC.setSeconds(50);
+    RTC.setMinutes(33);
+    RTC.setHours(16);
+    RTC.setDays(18);
+    RTC.setDayOfWeek(2);
+    RTC.setMonths(3);
+    RTC.setYears(2014);
+    
+    RTC.setTime();
+}
+
+
+void drawPix(int x, int y, unsigned int color)
+{
+    //fillRect(x, y, x, y, color, color);
+    
+    int x1 = 95-y;
+    int y1 = x;
+    drawLine(x1, y1, x1, y1, color);
+}
+
+void drawBuff(int x, int y, int buf_len, int buf_width, int color, const unsigned char *buff)
+{
+    for(int i=0; i<(buf_width/8); i++)
+    {
+        for(int j=0; j<buf_len; j++)
+        {
+            for(int k=0; k<8; k++)
+            {
+                int clr_ = (buff[i*buf_len+j] & (0x01<<k)) ? color : 0;
+                drawPix(j+x, 8*i+k+y, clr_);
+            }
+        }
+    }
+}
+
+void dispFont(int x, int y, int color, const unsigned char *font)
+{
+    drawBuff(x, y, 11, 32, color, font);
+}
+
+void dispFont_small(int x, int y, int color, const unsigned char *font)
+{   
+    drawBuff(x, y, 8, 16, color, font);
+}
+
+void dispChar(char c, int x, int y, int color)
+{
+    c = c-32;
+    drawBuff(x, y, 8, 16, color, font_ascii[c]);
+}
+
+unsigned int make_color(unsigned char r, unsigned char g, unsigned char b)
+{
+    unsigned int color_ = r;
+
+    color_ = r>>3;                              // red
+    color_ = color_<<6 | (g>>2);                // green
+    color_ = color_<<5 | (b>>3);                // blue
+
+    return color_;
+}
+
+void dispString(char *str)
+{
+    clearOLED();
+    
+    int color = make_color(255,255, 255);
+    
+    int x=0, y=0;
+    
+    int pix = 0;
+    
+    while(*str)
+    {
+        dispChar(*str, x, y, make_color(255, 255, 255));
+        str++;
+        x += 8;
+        pix++;
+        
+        if(pix == 8)
+        {
+            pix = 0;
+            x = 0;
+            y += 16;
+        }
+    }
+}
+
+void dispDot(int x, int y, int color)
+{
+    drawBuff(x, y, 7, 32, color, font_dot);
+}
+
+void refresh_time()
+{
+    int y = 60;
+    int color_ = make_color(255, 255, 255); 
+    dispFont(0, y, color_, font_num[time_now.hour/10]);
+    dispFont(14, y, color_, font_num[time_now.hour%10]);
+    dispDot(28, y-2, color_);
+    dispFont(38, y, color_, font_num[time_now.minutes/10]);
+    dispFont(52, y, color_, font_num[time_now.minutes%10]);
+}
+
+void refresh_day()
+{
+    int color_ = make_color(125, 255, 62);
+    
+    dispChar('M', 0, 40, color_);
+    dispChar('a', 8, 40, color_);
+    dispChar('r', 16, 40, color_);
+
+   // dispChar()
+   
+   dispFont_small(30, 40, color_, font_ascii[time_now.day/10+'0'-32]);
+   dispFont_small(38, 40, color_, font_ascii[time_now.day%10+'0'-32]);
+}
+
+void show_time()
+{
+    clearOLED();
+    int color_ = make_color(255, 255, 255);
+    refresh_day();
+    for(int i=0; i<63; i++)
+    {
+        drawPix(i, 56, color_);
+        drawPix(i, 57, color_);
+    }
+    refresh_time();
+}
+
+
+int main()
+{
+    uart.baud(38400);
+    
+    pin_function(P0_15,1);
+    pin_function(P0_10,1);
+
+    //pin_mode(P0_15,OpenDrain);
+    PowerON_OLED = 0; // power on OLED module
+    wait_ms(5);
+    PowerON_OLED = 1; // power off OLED module
+    wait_ms(5);
+    PowerON_OLED = 0; // power on OLED module
+    wait_ms(5);
+
+#if HARD_SPI
+    spi.format(8,3);
+    spi.frequency(1000000);
+#else
+    SCK_OLED = 1;
+    CS_OLED = 1;
+#endif
+    initOLED();
+    clearOLED();
+    //unsigned int color = 0;
+    // blue = 0;
+    
+    
+    dispString("xadow   smart   watch");
+    
+    wait(1);
+    //setTime();
+    time_init();
+    show_time();
+
+    char ble_str[40];
+    int len_str = 0;
+    
+    
+    drawBuff(12, 0, 40, 40, make_color(153, 153, 255), font_ophw);
+    
+    for(;;)
+    {
+        time_refresh();
+        
+        if(time_now.day != time_buf.day)
+        {
+            refresh_day();
+        }
+        
+        if(time_now.minutes != time_buf.minutes)
+        {
+            refresh_time();
+        }
+        
+       wait(0.1);
+        
+        
+        while (uart.readable()) 
+        {
+            ble_str[len_str++] = uart.getc();
+        }
+        
+        if(len_str == 1 && (ble_str[0] == 't' || ble_str[0] == 'T'))
+        {
+            time_refresh();
+            uart.printf("%d/%d/%d\r\n", time_now.year, time_now.month, time_now.day);
+            uart.printf("%d:%d:%d\r\n", time_now.hour, time_now.minutes, time_now.second);
+            len_str = 0;
+        }
+        else if(len_str>0)
+        {
+            ble_str[len_str] = '\0';
+            dispString(ble_str);
+            
+            wait(3);
+            show_time();
+            len_str = 0;
+            
+        }
+        
+    }
+}
+
+void spiWrite(unsigned char data)
+{
+    
+#if HARD_SPI
+    
+    spi.write(data);
+#else
+    for(unsigned char i=0;i<8;i++)
+    {
+        SCK_OLED = 0;
+        if(data&0x80)
+        {
+            MOSI_OLED = 1;
+        }
+        else
+        {
+            MOSI_OLED = 0;
+        }
+        data<<=1;
+        wait_us(1);
+        SCK_OLED = 1;
+        wait_us(1);
+    }
+#endif
+}
+
+void writeCommand(unsigned char cmd)
+{
+    DC_OLED = 0;
+    CS_OLED = 0;
+    spiWrite(cmd);
+    CS_OLED = 1;
+}
+
+void writeData(unsigned char data)
+{
+    DC_OLED = 1;
+    CS_OLED = 0;
+    spiWrite(data);
+    CS_OLED = 1;
+}
+
+void writeColor(unsigned int data)
+{
+    DC_OLED = 1;
+    CS_OLED = 0;
+    spiWrite(data>>8);
+    spiWrite(data);
+    CS_OLED = 1;
+}
+
+void initOLED(void)
+{
+    writeCommand(SSD1331_CMD_DISPLAYOFF);           // 0xAE
+    writeCommand(SSD1331_CMD_SETREMAP);             // 0xA0
+#if defined SSD1331_COLORORDER_RGB
+    writeCommand(0x72);                             // RGB Color
+#else
+    writeCommand(0x76);                             // BGR Color
+#endif
+    writeCommand(SSD1331_CMD_STARTLINE);            // 0xA1
+    writeCommand(0x0);
+    writeCommand(SSD1331_CMD_DISPLAYOFFSET);        // 0xA2
+    writeCommand(0x0);
+    writeCommand(SSD1331_CMD_NORMALDISPLAY);        // 0xA4
+    writeCommand(SSD1331_CMD_SETMULTIPLEX);         // 0xA8
+    writeCommand(0x3F);                             // 0x3F 1/64 duty
+    writeCommand(SSD1331_CMD_SETMASTER);            // 0xAD
+    writeCommand(0x8E);
+    writeCommand(SSD1331_CMD_POWERMODE);            // 0xB0
+    writeCommand(0x0B);
+    writeCommand(SSD1331_CMD_PRECHARGE);    // 0xB1
+    writeCommand(0x31);
+    writeCommand(SSD1331_CMD_CLOCKDIV);     // 0xB3
+    writeCommand(0xF0);  // 7:4 = Oscillator Frequency, 3:0 = CLK Div Ratio (A[3:0]+1 = 1..16)
+    writeCommand(SSD1331_CMD_PRECHARGEA);   // 0x8A
+    writeCommand(0x64);
+    writeCommand(SSD1331_CMD_PRECHARGEB);   // 0x8B
+    writeCommand(0x78);
+    writeCommand(SSD1331_CMD_PRECHARGEA);   // 0x8C
+    writeCommand(0x64);
+    writeCommand(SSD1331_CMD_PRECHARGELEVEL);   // 0xBB
+    writeCommand(0x3A);
+    writeCommand(SSD1331_CMD_VCOMH);        // 0xBE
+    writeCommand(0x3E);
+    writeCommand(SSD1331_CMD_MASTERCURRENT);    // 0x87
+    writeCommand(0x06);
+    writeCommand(SSD1331_CMD_CONTRASTA);    // 0x81
+    writeCommand(0x91);
+    writeCommand(SSD1331_CMD_CONTRASTB);    // 0x82
+    writeCommand(0x50);
+    writeCommand(SSD1331_CMD_CONTRASTC);    // 0x83
+    writeCommand(0x7D);
+    writeCommand(SSD1331_CMD_DISPLAYON);    //--turn on oled panel
+    
+}
+
+void clearOLED(void)
+{
+    fillRect(0,0,95,63,0,0);
+}
+
+void fillOLED(unsigned int color)
+{
+    fillRect(0,0,95,63,color,color);
+}
+
+void fillRect(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, unsigned int outlineColor, unsigned int fillColor)
+{
+    writeCommand(SSD1331_CMD_FILL);
+    writeCommand(0x01);
+
+    writeCommand(SSD1331_CMD_DRAWRECT);
+    writeCommand(x0);                           // Starting column
+    writeCommand(y0);                           // Starting row
+    writeCommand(x1); // End column
+    writeCommand(y1); // End row
+
+    // Outline color
+    writeCommand((uint8_t)((outlineColor >> 11) << 1));
+    writeCommand((uint8_t)((outlineColor >> 5) & 0x3F));
+    writeCommand((uint8_t)((outlineColor << 1) & 0x3F));
+    // Fill color
+    writeCommand((uint8_t)((fillColor >> 11) << 1));
+    writeCommand((uint8_t)((fillColor >> 5) & 0x3F));
+    writeCommand((uint8_t)((fillColor << 1) & 0x3F));
+
+    // Delay while the fill completes
+    wait_ms(SSD1331_DELAYS_HWFILL);
+}
+
+void drawLine(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, unsigned int color)
+{
+    writeCommand(SSD1331_CMD_DRAWLINE);
+    writeCommand(x0);
+    writeCommand(y0);
+    writeCommand(x1);
+    writeCommand(y1);
+    //wait_ms(SSD1331_DELAYS_HWLINE);
+    writeCommand((uint8_t)((color >> 11) << 1));
+    writeCommand((uint8_t)((color >> 5) & 0x3F));
+    writeCommand((uint8_t)((color << 1) & 0x3F));
+    // wait_ms(SSD1331_DELAYS_HWLINE);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 01 07:02:59 2014 +0000
@@ -0,0 +1,1 @@
+http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file