Просмотр исходного кода

Replace U8GLI v1.11 with v1.17

In Travis we already test against 1.17.
AnHardt 9 лет назад
Родитель
Сommit
6f4873329e
100 измененных файлов: 8738 добавлений и 714 удалений
  1. 49
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/ChangeLog
  2. 7
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/INSTALL.TXT
  3. 0
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/U8glib.cpp
  4. 454
    12
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/U8glib.h
  5. 131
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/A2Printer/A2Printer.ino
  6. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Bitmap/Bitmap.ino
  7. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Chess/Chess.ino
  8. 201
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Color/Color.ino
  9. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Console/Console.ino
  10. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/F/F.ino
  11. 398
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/FPS/FPS.ino
  12. 95
    18
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/GraphicsTest/GraphicsTest.ino
  13. 51
    10
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/HelloWorld/HelloWorld.ino
  14. 42
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Menu/Menu.ino
  15. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/PrintTest/PrintTest.ino
  16. 43
    7
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Rotation/Rotation.ino
  17. 43
    7
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Scale/Scale.ino
  18. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/TextRotX/TextRotX.ino
  19. 348
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Touch4WSetup/Touch4WSetup.ino
  20. 335
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Touch4WTest/Touch4WTest.ino
  21. 65
    14
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/U8gLogo/U8gLogo.ino
  22. 41
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/XBM/XBM.ino
  23. 1
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/license.txt
  24. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/chessengine.c
  25. 812
    442
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g.h
  26. 4
    4
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_clip.c
  27. 2
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_api.c
  28. 160
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_attiny85_hw_spi.c
  29. 10
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_fast_parallel.c
  30. 250
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_hw_spi.c
  31. 159
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_hw_usart_spi.c
  32. 15
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_no_en_parallel.c
  33. 1
    4
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_parallel.c
  34. 9
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_port_d_wr.c
  35. 19
    8
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_ssd_i2c.c
  36. 330
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_st7920_custom.c
  37. 77
    4
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_st7920_hw_spi.c
  38. 51
    16
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_st7920_spi.c
  39. 0
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_std_sw_spi.c
  40. 62
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_sw_spi.c
  41. 19
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_t6963.c
  42. 206
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_uc_i2c.c
  43. 14
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_atmega_hw_spi.c
  44. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_atmega_parallel.c
  45. 12
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_atmega_st7920_hw_spi.c
  46. 408
    15
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_i2c.c
  47. 58
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_io.c
  48. 124
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_raspberrypi_hw_spi.c
  49. 176
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_raspberrypi_ssd_i2c.c
  50. 49
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_delay.c
  51. 199
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_a2_micro_printer.c
  52. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_flipdisc_2x7.c
  53. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_gprof.c
  54. 281
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ht1632.c
  55. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ili9325d_320x240.c
  56. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ks0108_128x64.c
  57. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_160x80.c
  58. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_240x128.c
  59. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_240x64.c
  60. 7
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_320x64.c
  61. 232
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ld7032_60x32.c
  62. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_null.c
  63. 32
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_pcd8544_84x48.c
  64. 16
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_pcf8812_96x65.c
  65. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_sbn1661_122x32.c
  66. 47
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1306_128x32.c
  67. 179
    4
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1306_128x64.c
  68. 3
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1309_128x64.c
  69. 9
    5
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1322_nhd31oled_bw.c
  70. 14
    9
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1322_nhd31oled_gr.c
  71. 2
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_bw.c
  72. 4
    4
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_bw_new.c
  73. 2
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_gr.c
  74. 4
    4
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_gr_new.c
  75. 2
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1327_96x96_gr.c
  76. 787
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1351_128x128.c
  77. 53
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_64128n.c
  78. 53
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_dogm128.c
  79. 3
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_dogm132.c
  80. 51
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_lm6059.c
  81. 51
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_lm6063.c
  82. 5
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_nhd_c12832.c
  83. 52
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_nhd_c12864.c
  84. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7687_c144mvgd.c
  85. 7
    3
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7920_128x64.c
  86. 2
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7920_192x32.c
  87. 2
    2
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7920_202x32.c
  88. 193
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_128x128.c
  89. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_128x64.c
  90. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_240x128.c
  91. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_240x64.c
  92. 1
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_tls8204_84x48.c
  93. 201
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1601_c128032.c
  94. 200
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1608_240x128.c
  95. 168
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1608_240x64.c
  96. 7
    7
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1610_dogxl160.c
  97. 116
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1611_dogm240.c
  98. 116
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1611_dogxl240.c
  99. 45
    1
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1701_dogs102.c
  100. 0
    0
      ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1701_mini12864.c

+ 49
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/ChangeLog Просмотреть файл

@@ -107,7 +107,55 @@ u8glib ChangeLog
107 107
   * Sleep Mode
108 108
   * 4x mode for ST7920
109 109
   * New C++ interface for ST7920 
110
-
110
+2013-03-24	v1.12	  Oliver Kraus <olikraus@gmail.com>
111
+  * Added touch panel examples
112
+2013-06-30	v1.13	  Oliver Kraus <olikraus@gmail.com>
113
+  * Fixed missing "Arduino.h" in u8g_delay.c
114
+  * Disable interrupt for port/pin access (AVR), issue 19
115
+  * Support for HT1632: U8GLIB_HT1632_24X16 u8g(wr, data, cs), issue 165
116
+  * Support for SSD1351 OLED, issue 168
117
+  * Cleaned up several compiler warnings
118
+  * Fixed conflict with scheduler (Arduino Due), issue 155
119
+  * HW SPI for Arduino Due, issue 180
120
+  * Performance improvement for ST7920, issue 177
121
+  * Added ":" to the "n"umeric variant of the fonts, issue 166
122
+  * Added additional argument u8g_InitCom(). Use U8G_SPI_CLK_CYCLE_NONE by default.
123
+  * Added double buffer option for many ST7565 devices
124
+  * Tested with Arduino 1.0.5
125
+2013-10-03	v1.14	  Oliver Kraus <olikraus@gmail.com>
126
+  * Support for ARM controller
127
+  * Support for the A2 micro printer  (issue 191)
128
+  * Ellipse drawing primitive (issue 187)
129
+  * Added software reset for UC1701
130
+  * Fixed compiler warning (issue 196)
131
+  * Support for Freetronics SSD1351 OLED  (issue 195)
132
+  * Several other fixes and improvements
133
+2014-01-25	v1.15	  Oliver Kraus <olikraus@gmail.com>
134
+  * Fixed a bug with the rotation procs:  Occupied too much flash ROM (issue 219)
135
+  * Fixed issue with more than one SPI controller (SW SPI, issue 227)
136
+  * Added "drawTriangle" (issue 226)
137
+  * Added support for UC1608 (issue 214)
138
+  * Added ProFont family of fonts (issue  234)
139
+  * SW SPI support for Teensy 3 (issue 230)
140
+  * Removed Arduino/AVR specific files from ARM port (issue 209)
141
+2014-07-05	v1.16	  Oliver Kraus <olikraus@gmail.com>
142
+  * Added support for LD7032 60x32 OLED
143
+  * Added support for SSD1306 OLED, which does not send I2C ACK (issue 239)
144
+  * Added support for SH1106 128x64 OLED
145
+  * Added support for T6963 128x128 displays
146
+  * Added U8GLIB_SSD1306_ADAFRUIT_128X64 constructor
147
+2014-12-21	v1.17	  Oliver Kraus <olikraus@gmail.com>
148
+  * Added U8GLIB_UC1611_DOGM240 constructor (Issue 284)
149
+  * Added U8GLIB_UC1611_DOGXL240 constructor
150
+  * Added support for UC1608 controller (Issue 300)
151
+  * Added U8GLIB_SSD1306_ADAFRUIT_128X64 for Adafruit OLEDs (Issue 289)
152
+  * Bufix in the sleep on/off sequence (CS has not been releases, issue 298)
153
+  * helvB and helvR number only fonts (Issue 271)
154
+  * 400KHz option for I2C with U8G_I2C_OPT_FAST available for Due and Uno (Issue 303)
155
+  * I2C support for Arduino Due. 100KHz/400KHz, TWI & TWI1, ACK will be ignored (issue 285)
156
+  * Unifont update (Issue 297)
157
+  
158
+  
111 159
   
112 160
   
113 161
   

+ 7
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/INSTALL.TXT Просмотреть файл

@@ -2,10 +2,15 @@
2 2
 U8GLIB
3 3
 http://code.google.com/p/u8glib/
4 4
 
5
-
6 5
 Install instructions for the Arduino environment.
7 6
 
8
-  1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder
7
+  1. Start Arduino IDE
8
+  2. In the Arduino IDE, import the library from the "Add Library" Menu.
9
+
10
+Alternative install instructions for the Arduino environment.
11
+
12
+  1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder of the
13
+      Arduino install directory
9 14
   2. Start Arduino IDE
10 15
 
11 16
 Install instructions for the Chipkit (Arduino) environment.

+ 0
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/U8glib.cpp Просмотреть файл

@@ -77,4 +77,3 @@ uint8_t U8GLIB::initRW8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, u
77 77
   return u8g_InitRW8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset); 
78 78
 }
79 79
 
80
-

+ 454
- 12
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/U8glib.h Просмотреть файл

@@ -57,10 +57,8 @@ class U8GLIB : public Print
57 57
   protected:
58 58
     uint8_t init8BitFixedPort(u8g_dev_t *dev, uint8_t en, uint8_t cs, uint8_t di, uint8_t rw, uint8_t reset);
59 59
   private:
60
-    uint8_t init8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
61
-        uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE);
62
-    uint8_t initRW8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
63
-      uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset);
60
+    uint8_t init8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE);
61
+    uint8_t initRW8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset);
64 62
   public:
65 63
   
66 64
     /* constructor */
@@ -68,17 +66,17 @@ class U8GLIB : public Print
68 66
       { }
69 67
     U8GLIB(u8g_dev_t *dev)
70 68
       { prepare(); u8g_Init(&u8g, dev); }
69
+    U8GLIB(u8g_dev_t *dev, u8g_com_fnptr com_fn)
70
+      { prepare(); u8g_InitComFn(&u8g, dev, com_fn); }
71 71
     U8GLIB(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset) 
72 72
       { initSPI(dev, sck, mosi, cs, a0, reset); }
73 73
     U8GLIB(u8g_dev_t *dev, uint8_t cs, uint8_t a0, uint8_t reset) 
74 74
       { initHWSPI(dev, cs, a0, reset); }
75 75
     U8GLIB(u8g_dev_t *dev, uint8_t options) 
76 76
       { initI2C(dev, options); }
77
-    U8GLIB(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
78
-        uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw, uint8_t reset) 
77
+    U8GLIB(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw, uint8_t reset) 
79 78
       { init8Bit(dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset); }
80
-    U8GLIB(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
81
-        uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset) 
79
+    U8GLIB(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset) 
82 80
       { initRW8Bit(dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset); }
83 81
 
84 82
     uint8_t begin(void) { is_begin = 1; return u8g_Begin(&u8g); }
@@ -114,6 +112,11 @@ class U8GLIB : public Print
114 112
     void sleepOff(void) { u8g_SleepOff(&u8g); }
115 113
     
116 114
     /* graphic primitives */
115
+    void setColorEntry(uint8_t color_index, uint8_t r, uint8_t g, uint8_t b) { u8g_SetColorEntry(&u8g, color_index, r, g, b); }
116
+    void setHiColor(uint16_t  rgb) { u8g_SetHiColor(&u8g, rgb); }
117
+    void setHiColorByRGB(uint8_t r, uint8_t g, uint8_t b) { u8g_SetHiColorByRGB(&u8g, r, g, b); }
118
+    void setRGB(uint8_t r, uint8_t g, uint8_t b) { u8g_SetRGB(&u8g, r, g, b); }
119
+    
117 120
     void setColorIndex(uint8_t color_index) { u8g_SetColorIndex(&u8g, color_index); }
118 121
     uint8_t getColorIndex(void) { return u8g_GetColorIndex(&u8g); }
119 122
     
@@ -138,6 +141,14 @@ class U8GLIB : public Print
138 141
     void drawCircle(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawCircle(&u8g, x0, y0, rad, opt); }
139 142
     void drawDisc(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawDisc(&u8g, x0, y0, rad, opt); }
140 143
      
144
+    void drawEllipse(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rx, u8g_uint_t ry, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawEllipse(&u8g, x0, y0, rx, ry, opt); }
145
+    void drawFilledEllipse(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rx, u8g_uint_t ry, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawFilledEllipse(&u8g, x0, y0, rx, ry, opt); }    
146
+
147
+    void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) 
148
+      { u8g_DrawTriangle(&u8g, x0, y0, x1, y1, x2, y2); }
149
+      
150
+
151
+    
141 152
     /* bitmap handling */
142 153
     void drawBitmap(u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, u8g_uint_t h, const uint8_t *bitmap) 
143 154
       { u8g_DrawBitmap(&u8g, x, y, cnt, h, bitmap); }
@@ -223,6 +234,17 @@ class U8GLIB_DOGS102 : public U8GLIB
223 234
       { }
224 235
 };
225 236
 
237
+class U8GLIB_DOGS102_2X : public U8GLIB 
238
+{
239
+  public:
240
+    U8GLIB_DOGS102_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
241
+      : U8GLIB(&u8g_dev_uc1701_dogs102_2x_sw_spi, sck, mosi, cs, a0, reset)
242
+      { }
243
+    U8GLIB_DOGS102_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
244
+      : U8GLIB(&u8g_dev_uc1701_dogs102_2x_hw_spi, cs, a0, reset)
245
+      { }
246
+};
247
+
226 248
 class U8GLIB_MINI12864 : public U8GLIB 
227 249
 {
228 250
   public:
@@ -234,6 +256,17 @@ class U8GLIB_MINI12864 : public U8GLIB
234 256
       { }
235 257
 };
236 258
 
259
+class U8GLIB_MINI12864_2X : public U8GLIB 
260
+{
261
+  public:
262
+    U8GLIB_MINI12864_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
263
+      : U8GLIB(&u8g_dev_uc1701_mini12864_2x_sw_spi, sck, mosi, cs, a0, reset)
264
+      { }
265
+    U8GLIB_MINI12864_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
266
+      : U8GLIB(&u8g_dev_uc1701_mini12864_2x_hw_spi, cs, a0, reset)
267
+      { }
268
+};
269
+
237 270
 class U8GLIB_DOGM132 : public U8GLIB 
238 271
 {
239 272
   public:
@@ -260,6 +293,14 @@ class U8GLIB_NHD_C12832 : public U8GLIB
260 293
       { }
261 294
 };
262 295
 
296
+class U8GLIB_NHD_C12832_USART : public U8GLIB 
297
+{
298
+  public:
299
+    U8GLIB_NHD_C12832_USART(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
300
+      : U8GLIB(&u8g_dev_st7565_nhd_c12832_hw_usart_spi, cs, a0, reset)
301
+      { }
302
+};
303
+
263 304
 class U8GLIB_DOGM128 : public U8GLIB 
264 305
 {
265 306
   public:
@@ -269,6 +310,25 @@ class U8GLIB_DOGM128 : public U8GLIB
269 310
     U8GLIB_DOGM128(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
270 311
       : U8GLIB(&u8g_dev_st7565_dogm128_hw_spi, cs, a0, reset)
271 312
       { }
313
+    U8GLIB_DOGM128(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
314
+        uint8_t en, uint8_t cs1, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
315
+      : U8GLIB(&u8g_dev_st7565_dogm128_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
316
+      { }
317
+};
318
+
319
+class U8GLIB_DOGM128_2X : public U8GLIB 
320
+{
321
+  public:
322
+    U8GLIB_DOGM128_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
323
+      : U8GLIB(&u8g_dev_st7565_dogm128_2x_sw_spi, sck, mosi, cs, a0, reset)
324
+      { }
325
+    U8GLIB_DOGM128_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
326
+      : U8GLIB(&u8g_dev_st7565_dogm128_2x_hw_spi, cs, a0, reset)
327
+      { }
328
+    U8GLIB_DOGM128_2X(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
329
+        uint8_t en, uint8_t cs1, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
330
+      : U8GLIB(&u8g_dev_st7565_dogm128_2x_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
331
+      { }
272 332
 };
273 333
 
274 334
 class U8GLIB_LM6059 : public U8GLIB 
@@ -282,6 +342,17 @@ class U8GLIB_LM6059 : public U8GLIB
282 342
       { }
283 343
 };
284 344
 
345
+class U8GLIB_LM6059_2X : public U8GLIB 
346
+{
347
+  public:
348
+    U8GLIB_LM6059_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
349
+      : U8GLIB(&u8g_dev_st7565_lm6059_2x_sw_spi, sck, mosi, cs, a0, reset)
350
+      { }
351
+    U8GLIB_LM6059_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
352
+      : U8GLIB(&u8g_dev_st7565_lm6059_2x_hw_spi, cs, a0, reset)
353
+      { }
354
+};
355
+
285 356
 class U8GLIB_LM6063 : public U8GLIB 
286 357
 {
287 358
   public:
@@ -293,6 +364,17 @@ class U8GLIB_LM6063 : public U8GLIB
293 364
       { }
294 365
 };
295 366
 
367
+class U8GLIB_LM6063_2X : public U8GLIB 
368
+{
369
+  public:
370
+    U8GLIB_LM6063_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
371
+      : U8GLIB(&u8g_dev_st7565_lm6063_2x_sw_spi, sck, mosi, cs, a0, reset)
372
+      { }
373
+    U8GLIB_LM6063_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
374
+      : U8GLIB(&u8g_dev_st7565_lm6063_2x_hw_spi, cs, a0, reset)
375
+      { }
376
+};
377
+
296 378
 class U8GLIB_64128N : public U8GLIB 
297 379
 {
298 380
   public:
@@ -302,6 +384,25 @@ class U8GLIB_64128N : public U8GLIB
302 384
     U8GLIB_64128N(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
303 385
       : U8GLIB(&u8g_dev_st7565_64128n_hw_spi, cs, a0, reset)
304 386
       { }
387
+    U8GLIB_64128N(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
388
+        uint8_t en, uint8_t cs1, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
389
+      : U8GLIB(&u8g_dev_st7565_64128n_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
390
+      { }
391
+};
392
+
393
+class U8GLIB_64128N_2X : public U8GLIB 
394
+{
395
+  public:
396
+    U8GLIB_64128N_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
397
+      : U8GLIB(&u8g_dev_st7565_64128n_2x_sw_spi, sck, mosi, cs, a0, reset)
398
+      { }
399
+    U8GLIB_64128N_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
400
+      : U8GLIB(&u8g_dev_st7565_64128n_2x_hw_spi, cs, a0, reset)
401
+      { }
402
+    U8GLIB_64128N_2X(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
403
+        uint8_t en, uint8_t cs1, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
404
+      : U8GLIB(&u8g_dev_st7565_64128n_2x_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
405
+      { }
305 406
 };
306 407
 
307 408
 class U8GLIB_NHD_C12864 : public U8GLIB 
@@ -315,6 +416,111 @@ class U8GLIB_NHD_C12864 : public U8GLIB
315 416
       { }
316 417
 };
317 418
 
419
+class U8GLIB_NHD_C12864_2X : public U8GLIB 
420
+{
421
+  public:
422
+    U8GLIB_NHD_C12864_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
423
+      : U8GLIB(&u8g_dev_st7565_nhd_c12864_2x_sw_spi, sck, mosi, cs, a0, reset)
424
+      { }
425
+    U8GLIB_NHD_C12864_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
426
+      : U8GLIB(&u8g_dev_st7565_nhd_c12864_2x_hw_spi, cs, a0, reset)
427
+      { }
428
+};
429
+
430
+class U8GLIB_UC1601_C128032 : public U8GLIB 
431
+{
432
+  public:
433
+    U8GLIB_UC1601_C128032(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
434
+      : U8GLIB(&u8g_dev_uc1601_c128032_sw_spi, sck, mosi, cs, a0, reset)
435
+      { }
436
+    U8GLIB_UC1601_C128032(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
437
+      : U8GLIB(&u8g_dev_uc1601_c128032_hw_spi, cs, a0, reset)
438
+      { }
439
+};
440
+
441
+class U8GLIB_UC1601_C128032_2X : public U8GLIB 
442
+{
443
+  public:
444
+    U8GLIB_UC1601_C128032_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
445
+      : U8GLIB(&u8g_dev_uc1601_c128032_2x_sw_spi, sck, mosi, cs, a0, reset)
446
+      { }
447
+    U8GLIB_UC1601_C128032_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
448
+      : U8GLIB(&u8g_dev_uc1601_c128032_2x_hw_spi, cs, a0, reset)
449
+      { }
450
+};
451
+
452
+class U8GLIB_UC1608_240X64 : public U8GLIB 
453
+{
454
+  public:
455
+    U8GLIB_UC1608_240X64(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
456
+      : U8GLIB(&u8g_dev_uc1608_240x64_sw_spi, sck, mosi, cs, a0, reset)
457
+      { }
458
+    U8GLIB_UC1608_240X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
459
+      : U8GLIB(&u8g_dev_uc1608_240x64_hw_spi, cs, a0, reset)
460
+      { }
461
+};
462
+
463
+class U8GLIB_UC1608_240X64_2X : public U8GLIB 
464
+{
465
+  public:
466
+    U8GLIB_UC1608_240X64_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
467
+      : U8GLIB(&u8g_dev_uc1608_240x64_2x_sw_spi, sck, mosi, cs, a0, reset)
468
+      { }
469
+    U8GLIB_UC1608_240X64_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
470
+      : U8GLIB(&u8g_dev_uc1608_240x64_2x_hw_spi, cs, a0, reset)
471
+      { }
472
+};
473
+
474
+class U8GLIB_UC1608_240X128 : public U8GLIB 
475
+{
476
+  public:
477
+    U8GLIB_UC1608_240X128(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
478
+      : U8GLIB(&u8g_dev_uc1608_240x128_sw_spi, sck, mosi, cs, a0, reset)
479
+      { }
480
+    U8GLIB_UC1608_240X128(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
481
+      : U8GLIB(&u8g_dev_uc1608_240x128_hw_spi, cs, a0, reset)
482
+      { }
483
+};
484
+
485
+class U8GLIB_UC1608_240X128_2X : public U8GLIB 
486
+{
487
+  public:
488
+    U8GLIB_UC1608_240X128_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
489
+      : U8GLIB(&u8g_dev_uc1608_240x128_2x_sw_spi, sck, mosi, cs, a0, reset)
490
+      { }
491
+    U8GLIB_UC1608_240X128_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
492
+      : U8GLIB(&u8g_dev_uc1608_240x128_2x_hw_spi, cs, a0, reset)
493
+      { }
494
+};
495
+
496
+
497
+class U8GLIB_UC1611_DOGM240 : public U8GLIB
498
+{
499
+  public:
500
+    U8GLIB_UC1611_DOGM240(uint8_t options = U8G_I2C_OPT_NONE)
501
+      : U8GLIB(&u8g_dev_uc1611_dogm240_i2c, options)
502
+      {}
503
+    U8GLIB_UC1611_DOGM240(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
504
+      : U8GLIB(&u8g_dev_uc1611_dogm240_sw_spi, sck, mosi, cs, a0, reset)
505
+      { }
506
+    U8GLIB_UC1611_DOGM240(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
507
+      : U8GLIB(&u8g_dev_uc1611_dogm240_hw_spi, cs, a0, reset)
508
+      { }
509
+};
510
+
511
+class U8GLIB_UC1611_DOGXL240 : public U8GLIB
512
+{
513
+  public:
514
+    U8GLIB_UC1611_DOGXL240(uint8_t options = U8G_I2C_OPT_NONE)
515
+      : U8GLIB(&u8g_dev_uc1611_dogxl240_i2c, options)
516
+      {}
517
+    U8GLIB_UC1611_DOGXL240(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
518
+      : U8GLIB(&u8g_dev_uc1611_dogxl240_sw_spi, sck, mosi, cs, a0, reset)
519
+      { }
520
+    U8GLIB_UC1611_DOGXL240(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
521
+      : U8GLIB(&u8g_dev_uc1611_dogxl240_hw_spi, cs, a0, reset)
522
+      { }
523
+};
318 524
 
319 525
 class U8GLIB_ST7920_128X64 : public U8GLIB 
320 526
 {
@@ -349,6 +555,14 @@ class U8GLIB_ST7920_128X64_1X : public U8GLIB
349 555
       { }
350 556
 };
351 557
 
558
+class U8GLIB_ST7920_128X64_CUSTOM_1X : public U8GLIB 
559
+{
560
+  public:
561
+    U8GLIB_ST7920_128X64_CUSTOM_1X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t reset = U8G_PIN_NONE) 
562
+      : U8GLIB(&u8g_dev_st7920_128x64_custom, sck, mosi, cs, U8G_PIN_NONE, reset)		// a0 = U8G_PIN_NONE
563
+      { }
564
+};
565
+
352 566
 class U8GLIB_ST7920_128X64_4X : public U8GLIB 
353 567
 {
354 568
   public:
@@ -364,6 +578,13 @@ class U8GLIB_ST7920_128X64_4X : public U8GLIB
364 578
       { }
365 579
 };
366 580
 
581
+class U8GLIB_ST7920_128X64_CUSTOM_4X : public U8GLIB 
582
+{
583
+  public:
584
+    U8GLIB_ST7920_128X64_CUSTOM_4X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t reset = U8G_PIN_NONE) 
585
+      : U8GLIB(&u8g_dev_st7920_128x64_4x_custom, sck, mosi, cs, U8G_PIN_NONE, reset)		// a0 = U8G_PIN_NONE
586
+      { }
587
+};
367 588
 
368 589
 
369 590
 class U8GLIB_ST7920_192X32 : public U8GLIB  // OBSOLETE, use U8GLIB_ST7920_192X32_1X instead
@@ -485,7 +706,7 @@ class U8GLIB_LC7981_240X128 : public U8GLIB
485 706
       { }
486 707
 };
487 708
 
488
-// 16 bit mode required: Remove comment from "#define U8G_16BIT 1" in utility/u8g.h
709
+// 16 bit mode required: Remove comment from "#define U8G_16BIT 1" in utility/utility/u8g.h
489 710
 class U8GLIB_LC7981_320X64 : public U8GLIB 
490 711
 {
491 712
   public:
@@ -581,6 +802,10 @@ class U8GLIB_NHD31OLED_BW : public U8GLIB
581 802
     U8GLIB_NHD31OLED_BW(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
582 803
       : U8GLIB(&u8g_dev_ssd1322_nhd31oled_bw_hw_spi, cs, a0, reset)
583 804
       { }
805
+    U8GLIB_NHD31OLED_BW(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
806
+        uint8_t cs, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
807
+      : U8GLIB(&u8g_dev_ssd1322_nhd31oled_bw_parallel, d0, d1, d2, d3, d4, d5, d6, d7, U8G_PIN_NONE, cs, U8G_PIN_NONE, di, rw, reset)
808
+      { }
584 809
 };
585 810
 
586 811
 class U8GLIB_NHD31OLED_2X_BW : public U8GLIB 
@@ -603,6 +828,10 @@ class U8GLIB_NHD31OLED_GR : public U8GLIB
603 828
     U8GLIB_NHD31OLED_GR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
604 829
       : U8GLIB(&u8g_dev_ssd1322_nhd31oled_gr_hw_spi, cs, a0, reset)
605 830
       { }
831
+    U8GLIB_NHD31OLED_GR(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
832
+        uint8_t cs, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
833
+      : U8GLIB(&u8g_dev_ssd1322_nhd31oled_gr_parallel, d0, d1, d2, d3, d4, d5, d6, d7, U8G_PIN_NONE, cs, U8G_PIN_NONE, di, rw, reset)
834
+      { }
606 835
 };
607 836
 
608 837
 class U8GLIB_NHD31OLED_2X_GR : public U8GLIB 
@@ -629,7 +858,63 @@ class U8GLIB_SSD1306_128X64 : public U8GLIB
629 858
     U8GLIB_SSD1306_128X64(uint8_t options = U8G_I2C_OPT_NONE) 
630 859
       : U8GLIB(&u8g_dev_ssd1306_128x64_i2c, options)
631 860
       { }
632
-      
861
+};
862
+
863
+class U8GLIB_SSD1306_ADAFRUIT_128X64 : public U8GLIB 
864
+{
865
+  public:
866
+    U8GLIB_SSD1306_ADAFRUIT_128X64(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
867
+      : U8GLIB(&u8g_dev_ssd1306_adafruit_128x64_sw_spi, sck, mosi, cs, a0, reset)
868
+      { }
869
+    U8GLIB_SSD1306_ADAFRUIT_128X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
870
+      : U8GLIB(&u8g_dev_ssd1306_adafruit_128x64_hw_spi, cs, a0, reset)
871
+      { }
872
+    U8GLIB_SSD1306_ADAFRUIT_128X64(uint8_t options = U8G_I2C_OPT_NONE) 
873
+      : U8GLIB(&u8g_dev_ssd1306_adafruit_128x64_i2c, options)
874
+      { }
875
+};
876
+
877
+
878
+class U8GLIB_SSD1306_128X64_2X : public U8GLIB 
879
+{
880
+  public:
881
+    U8GLIB_SSD1306_128X64_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
882
+      : U8GLIB(&u8g_dev_ssd1306_128x64_2x_sw_spi, sck, mosi, cs, a0, reset)
883
+      { }
884
+    U8GLIB_SSD1306_128X64_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
885
+      : U8GLIB(&u8g_dev_ssd1306_128x64_2x_hw_spi, cs, a0, reset)
886
+      { }
887
+    U8GLIB_SSD1306_128X64_2X(uint8_t options = U8G_I2C_OPT_NONE) 
888
+      : U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c, options)
889
+      { }
890
+};
891
+
892
+class U8GLIB_SH1106_128X64 : public U8GLIB 
893
+{
894
+  public:
895
+    U8GLIB_SH1106_128X64(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
896
+      : U8GLIB(&u8g_dev_sh1106_128x64_sw_spi, sck, mosi, cs, a0, reset)
897
+      { }
898
+    U8GLIB_SH1106_128X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
899
+      : U8GLIB(&u8g_dev_sh1106_128x64_hw_spi, cs, a0, reset)
900
+      { }
901
+    U8GLIB_SH1106_128X64(uint8_t options = U8G_I2C_OPT_NONE) 
902
+      : U8GLIB(&u8g_dev_sh1106_128x64_i2c, options)
903
+      { }
904
+};
905
+
906
+class U8GLIB_SH1106_128X64_2X : public U8GLIB 
907
+{
908
+  public:
909
+    U8GLIB_SH1106_128X64_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
910
+      : U8GLIB(&u8g_dev_sh1106_128x64_2x_sw_spi, sck, mosi, cs, a0, reset)
911
+      { }
912
+    U8GLIB_SH1106_128X64_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
913
+      : U8GLIB(&u8g_dev_sh1106_128x64_2x_hw_spi, cs, a0, reset)
914
+      { }
915
+    U8GLIB_SH1106_128X64_2X(uint8_t options = U8G_I2C_OPT_NONE) 
916
+      : U8GLIB(&u8g_dev_sh1106_128x64_2x_i2c, options)
917
+      { }
633 918
 };
634 919
 
635 920
 class U8GLIB_SSD1309_128X64 : public U8GLIB 
@@ -644,7 +929,6 @@ class U8GLIB_SSD1309_128X64 : public U8GLIB
644 929
     U8GLIB_SSD1309_128X64(uint8_t options = U8G_I2C_OPT_NONE) 
645 930
       : U8GLIB(&u8g_dev_ssd1309_128x64_i2c, options)
646 931
       { }
647
-      
648 932
 };
649 933
 
650 934
 class U8GLIB_SSD1306_128X32 : public U8GLIB 
@@ -659,7 +943,20 @@ class U8GLIB_SSD1306_128X32 : public U8GLIB
659 943
     U8GLIB_SSD1306_128X32(uint8_t options = U8G_I2C_OPT_NONE) 
660 944
       : U8GLIB(&u8g_dev_ssd1306_128x32_i2c, options)
661 945
       { }
662
-      
946
+};
947
+
948
+class U8GLIB_SSD1306_128X32_2X : public U8GLIB 
949
+{
950
+  public:
951
+    U8GLIB_SSD1306_128X32_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
952
+      : U8GLIB(&u8g_dev_ssd1306_128x32_2x_sw_spi, sck, mosi, cs, a0, reset)
953
+      { }
954
+    U8GLIB_SSD1306_128X32_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
955
+      : U8GLIB(&u8g_dev_ssd1306_128x32_2x_hw_spi, cs, a0, reset)
956
+      { }
957
+    U8GLIB_SSD1306_128X32_2X(uint8_t options = U8G_I2C_OPT_NONE) 
958
+      : U8GLIB(&u8g_dev_ssd1306_128x32_2x_i2c, options)
959
+      { }
663 960
 };
664 961
 
665 962
 
@@ -713,12 +1010,43 @@ class U8GLIB_SSD1327_96X96_2X_GR : public U8GLIB
713 1010
       { }
714 1011
 };
715 1012
 
1013
+
1014
+class U8GLIB_LD7032_60x32 : public U8GLIB 
1015
+{
1016
+  public:
1017
+    U8GLIB_LD7032_60x32(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1018
+      : U8GLIB(&u8g_dev_ld7032_60x32_sw_spi, sck, mosi, cs, a0, reset)
1019
+      { }
1020
+    U8GLIB_LD7032_60x32(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1021
+      : U8GLIB(&u8g_dev_ld7032_60x32_hw_spi, cs, a0, reset)
1022
+      { }
1023
+    U8GLIB_LD7032_60x32(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
1024
+        uint8_t en, uint8_t cs1, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE) 
1025
+      : U8GLIB(&u8g_dev_ld7032_60x32_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
1026
+      { }
1027
+};
1028
+
1029
+
1030
+
1031
+class U8GLIB_HT1632_24X16 : public U8GLIB 
1032
+{
1033
+  public:
1034
+    U8GLIB_HT1632_24X16(uint8_t wr, uint8_t data, uint8_t cs) 
1035
+      : U8GLIB(&u8g_dev_ht1632_24x16, wr, data, cs, U8G_PIN_NONE, U8G_PIN_NONE)
1036
+      { }
1037
+};
1038
+
1039
+
1040
+
716 1041
 class U8GLIB_PCF8812 : public U8GLIB 
717 1042
 {
718 1043
   public:
719 1044
     U8GLIB_PCF8812(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
720 1045
       : U8GLIB(&u8g_dev_pcf8812_96x65_sw_spi, sck, mosi, cs, a0, reset)
721 1046
       { }
1047
+    U8GLIB_PCF8812(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1048
+      : U8GLIB(&u8g_dev_pcf8812_96x65_hw_spi, cs, a0, reset)
1049
+      { }
722 1050
 };
723 1051
 
724 1052
 class U8GLIB_PCD8544 : public U8GLIB 
@@ -727,6 +1055,9 @@ class U8GLIB_PCD8544 : public U8GLIB
727 1055
     U8GLIB_PCD8544(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
728 1056
       : U8GLIB(&u8g_dev_pcd8544_84x48_sw_spi, sck, mosi, cs, a0, reset)
729 1057
       { }
1058
+    U8GLIB_PCD8544(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1059
+      : U8GLIB(&u8g_dev_pcd8544_84x48_hw_spi, cs, a0, reset)
1060
+      { }
730 1061
 };
731 1062
 
732 1063
 class U8GLIB_TLS8204_84X48 : public U8GLIB 
@@ -764,6 +1095,15 @@ class U8GLIB_T6963_240X128 : public U8GLIB
764 1095
       { }
765 1096
 };
766 1097
 
1098
+class U8GLIB_T6963_128X128 : public U8GLIB 
1099
+{
1100
+  public:
1101
+    U8GLIB_T6963_128X128(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
1102
+        uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset = U8G_PIN_NONE) 
1103
+      : U8GLIB(&u8g_dev_t6963_128x128_8bit, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset)
1104
+      { }
1105
+};
1106
+
767 1107
 class U8GLIB_T6963_240X64 : public U8GLIB 
768 1108
 {
769 1109
   public:
@@ -808,6 +1148,108 @@ class U8GLIB_ILI9325D_320x240 : public U8GLIB
808 1148
       { init8BitFixedPort(&u8g_dev_ili9325d_320x240_8bit, en, cs1, di, rw, reset); }
809 1149
 };
810 1150
 
1151
+
1152
+
1153
+class U8GLIB_SSD1351_128X128_332 : public U8GLIB 
1154
+{
1155
+  public:
1156
+    U8GLIB_SSD1351_128X128_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1157
+      : U8GLIB(&u8g_dev_ssd1351_128x128_332_sw_spi, sck, mosi, cs, a0, reset)
1158
+      { }
1159
+    U8GLIB_SSD1351_128X128_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1160
+      : U8GLIB(&u8g_dev_ssd1351_128x128_332_hw_spi, cs, a0, reset)
1161
+      { }
1162
+};
1163
+
1164
+class U8GLIB_SSD1351_128X128_4X_332 : public U8GLIB 
1165
+{
1166
+  public:
1167
+    U8GLIB_SSD1351_128X128_4X_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1168
+      : U8GLIB(&u8g_dev_ssd1351_128x128_4x_332_sw_spi, sck, mosi, cs, a0, reset)
1169
+      { }
1170
+    U8GLIB_SSD1351_128X128_4X_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1171
+      : U8GLIB(&u8g_dev_ssd1351_128x128_4x_332_hw_spi, cs, a0, reset)
1172
+      { }
1173
+};
1174
+
1175
+class U8GLIB_SSD1351_128X128GH_332 : public U8GLIB 
1176
+{
1177
+  public:
1178
+    U8GLIB_SSD1351_128X128GH_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1179
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_332_sw_spi, sck, mosi, cs, a0, reset)
1180
+      { }
1181
+    U8GLIB_SSD1351_128X128GH_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1182
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_332_hw_spi, cs, a0, reset)
1183
+      { }
1184
+};
1185
+
1186
+class U8GLIB_SSD1351_128X128GH_4X_332 : public U8GLIB 
1187
+{
1188
+  public:
1189
+    U8GLIB_SSD1351_128X128GH_4X_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1190
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_332_sw_spi, sck, mosi, cs, a0, reset)
1191
+      { }
1192
+    U8GLIB_SSD1351_128X128GH_4X_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1193
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_332_hw_spi, cs, a0, reset)
1194
+      { }
1195
+};
1196
+
1197
+class U8GLIB_SSD1351_128X128_IDX : public U8GLIB 
1198
+{
1199
+  public:
1200
+    U8GLIB_SSD1351_128X128_IDX(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1201
+      : U8GLIB(&u8g_dev_ssd1351_128x128_idx_sw_spi, sck, mosi, cs, a0, reset)
1202
+      { }
1203
+    U8GLIB_SSD1351_128X128_IDX(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1204
+      : U8GLIB(&u8g_dev_ssd1351_128x128_idx_hw_spi, cs, a0, reset)
1205
+      { }
1206
+};
1207
+
1208
+class U8GLIB_SSD1351_128X128_HICOLOR : public U8GLIB 
1209
+{
1210
+  public:
1211
+    U8GLIB_SSD1351_128X128_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1212
+      : U8GLIB(&u8g_dev_ssd1351_128x128_hicolor_sw_spi, sck, mosi, cs, a0, reset)
1213
+      { }
1214
+    U8GLIB_SSD1351_128X128_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1215
+      : U8GLIB(&u8g_dev_ssd1351_128x128_hicolor_hw_spi, cs, a0, reset)
1216
+      { }
1217
+};
1218
+
1219
+class U8GLIB_SSD1351_128X128_4X_HICOLOR : public U8GLIB 
1220
+{
1221
+  public:
1222
+    U8GLIB_SSD1351_128X128_4X_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1223
+      : U8GLIB(&u8g_dev_ssd1351_128x128_4x_hicolor_sw_spi, sck, mosi, cs, a0, reset)
1224
+      { }
1225
+    U8GLIB_SSD1351_128X128_4X_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1226
+      : U8GLIB(&u8g_dev_ssd1351_128x128_4x_hicolor_hw_spi, cs, a0, reset)
1227
+      { }
1228
+};
1229
+
1230
+class U8GLIB_SSD1351_128X128GH_HICOLOR : public U8GLIB 
1231
+{
1232
+  public:
1233
+    U8GLIB_SSD1351_128X128GH_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1234
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_hicolor_sw_spi, sck, mosi, cs, a0, reset)
1235
+      { }
1236
+    U8GLIB_SSD1351_128X128GH_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1237
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_hicolor_hw_spi, cs, a0, reset)
1238
+      { }
1239
+};
1240
+
1241
+class U8GLIB_SSD1351_128X128GH_4X_HICOLOR : public U8GLIB 
1242
+{
1243
+  public:
1244
+    U8GLIB_SSD1351_128X128GH_4X_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1245
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_hicolor_sw_spi, sck, mosi, cs, a0, reset)
1246
+      { }
1247
+    U8GLIB_SSD1351_128X128GH_4X_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) 
1248
+      : U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_hicolor_hw_spi, cs, a0, reset)
1249
+      { }
1250
+};
1251
+
1252
+
811 1253
 class U8GLIB_FLIPDISC_2X7 : public U8GLIB 
812 1254
 {
813 1255
   public:

+ 131
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/A2Printer/A2Printer.ino Просмотреть файл

@@ -0,0 +1,131 @@
1
+/*
2
+
3
+  A2Printer.pde
4
+  
5
+  Special example code for the A2 Mciro Printer (https://www.sparkfun.com/products/10438)
6
+  
7
+  
8
+  Universal 8bit Graphics Library, http://code.google.com/p/u8glib/
9
+  
10
+  Copyright (c) 2013, olikraus@gmail.com
11
+  All rights reserved.
12
+
13
+  Redistribution and use in source and binary forms, with or without modification, 
14
+  are permitted provided that the following conditions are met:
15
+
16
+  * Redistributions of source code must retain the above copyright notice, this list 
17
+    of conditions and the following disclaimer.
18
+    
19
+  * Redistributions in binary form must reproduce the above copyright notice, this 
20
+    list of conditions and the following disclaimer in the documentation and/or other 
21
+    materials provided with the distribution.
22
+
23
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
24
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
25
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
26
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
27
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
28
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
30
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
33
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
34
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
35
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
36
+  
37
+*/
38
+
39
+
40
+#include "U8glib.h"
41
+
42
+// use this serial interface
43
+#define PRINTER_SERIAL Serial
44
+// #define PRINTER_SERIAL Serial1
45
+
46
+
47
+uint8_t u8g_com_uart(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
48
+  switch(msg) {
49
+    case U8G_COM_MSG_WRITE_BYTE:
50
+      PRINTER_SERIAL.write(arg_val);
51
+      break;
52
+  }
53
+  return 1;
54
+}
55
+
56
+// setup u8g object, please remove comment from one of the following constructor calls
57
+
58
+// half resolution
59
+//U8GLIB u8g(&u8g_dev_a2_micro_printer_192x120_ds, (u8g_com_fnptr)u8g_com_uart);
60
+
61
+// full resolution, requires to uncomment U8G_16BIT in u8g.h
62
+//U8GLIB u8g(&u8g_dev_a2_micro_printer_384x240, (u8g_com_fnptr)u8g_com_uart);
63
+
64
+// half resolution, extra log, requires to uncomment U8G_16BIT in u8g.h
65
+//U8GLIB u8g(&u8g_dev_a2_micro_printer_192x360_ds, (u8g_com_fnptr)u8g_com_uart);
66
+U8GLIB u8g(&u8g_dev_a2_micro_printer_192x720_ds, (u8g_com_fnptr)u8g_com_uart);
67
+
68
+
69
+
70
+void drawLogo(uint8_t d) {
71
+  u8g.setFont(u8g_font_gdr25r);
72
+  u8g.drawStr(0+d, 30+d, "U");
73
+  u8g.setFont(u8g_font_gdr30n);
74
+  u8g.drawStr90(23+d,10+d,"8");
75
+  u8g.setFont(u8g_font_gdr25r);
76
+  u8g.drawStr(53+d,30+d,"g");
77
+  
78
+  u8g.drawHLine(2+d, 35+d, 47);
79
+  u8g.drawVLine(45+d, 32+d, 12);
80
+}
81
+
82
+void drawURL(void) {
83
+  u8g.setFont(u8g_font_4x6);
84
+  if ( u8g.getHeight() < 59 ) {
85
+    u8g.drawStr(53,9,"code.google.com");
86
+    u8g.drawStr(77,18,"/p/u8glib");
87
+  }
88
+  else {
89
+    u8g.drawStr(1,54,"code.google.com/p/u8glib");
90
+  }
91
+}
92
+
93
+void draw(void) {
94
+  // graphic commands to redraw the complete screen should be placed here  
95
+  
96
+  drawLogo(0);
97
+  drawURL();
98
+  u8g.drawFrame(0,0,u8g.getWidth(), u8g.getHeight());
99
+  
100
+  u8g.setFont(u8g_font_helvR24r);
101
+  u8g.setPrintPos(0, 100);
102
+  u8g.print(u8g.getWidth(), DEC);
103
+  u8g.print("x");
104
+  u8g.print(u8g.getHeight(), DEC);
105
+}
106
+
107
+void setup(void) {
108
+  PRINTER_SERIAL.begin(19200);
109
+  
110
+  // flip screen, if required
111
+  // u8g.setRot180();
112
+  
113
+  // assign default color value
114
+  u8g.setColorIndex(1);         // pixel on
115
+}
116
+
117
+void loop(void) {
118
+  
119
+  // picture loop: This will print the picture  
120
+  u8g.firstPage();  
121
+  do {
122
+    draw();
123
+  } while( u8g.nextPage() );
124
+
125
+  // send manual CR to the printer
126
+  PRINTER_SERIAL.write('\n'); 		
127
+  
128
+  // reprint the picture after 10 seconds
129
+  delay(10000);
130
+}
131
+

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Bitmap/Bitmap.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Bitmap/Bitmap.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 const uint8_t rook_bitmap[] PROGMEM = {
102 138
   0x00,         // 00000000 

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Chess/Chess.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Chess/Chess.ino Просмотреть файл

@@ -43,8 +43,8 @@
43 43
 #include "U8glib.h"
44 44
 
45 45
 // setup u8g object, please remove comment from one of the following constructor calls
46
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
47
-
46
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
47
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
48 48
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
50 50
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -53,9 +53,10 @@
53 53
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55 55
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 58
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59 60
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
61 62
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -85,19 +86,54 @@
85 86
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
86 87
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
87 88
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
89
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
88 90
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
93
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
95
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90 96
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
91 97
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
92
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
98
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
99
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
100
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
103
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
93 104
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94 105
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
95 106
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
108
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
109
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
110
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
111
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
112
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
96 113
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 114
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
116
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
117
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
124
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
98 125
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
126
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
100 128
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
129
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
130
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
135
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
136
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
101 137
 
102 138
 
103 139
 // DOGS102 shield configuration values

+ 201
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Color/Color.ino Просмотреть файл

@@ -0,0 +1,201 @@
1
+/*
2
+
3
+  Color.pde
4
+  
5
+  "Hello World!" example code with color.
6
+  
7
+  >>> Before compiling: Please remove comment from the constructor of the 
8
+  >>> connected graphics display (see below).
9
+  
10
+  Universal 8bit Graphics Library, http://code.google.com/p/u8glib/
11
+  
12
+  Copyright (c) 2012, olikraus@gmail.com
13
+  All rights reserved.
14
+
15
+  Redistribution and use in source and binary forms, with or without modification, 
16
+  are permitted provided that the following conditions are met:
17
+
18
+  * Redistributions of source code must retain the above copyright notice, this list 
19
+    of conditions and the following disclaimer.
20
+    
21
+  * Redistributions in binary form must reproduce the above copyright notice, this 
22
+    list of conditions and the following disclaimer in the documentation and/or other 
23
+    materials provided with the distribution.
24
+
25
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
26
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
27
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
28
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
29
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
30
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
31
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
32
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
33
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
34
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
35
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
36
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
37
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
38
+  
39
+*/
40
+
41
+
42
+#include "U8glib.h"
43
+
44
+// setup u8g object, please remove comment from one of the following constructor calls
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47
+//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48
+//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49
+//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
50
+//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
51
+//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
52
+//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53
+//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54
+//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56
+//U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57
+//U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59
+//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60
+//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
61
+//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
62
+//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
63
+//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
64
+//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
65
+//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
66
+//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
67
+//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10);	// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
68
+//U8GLIB_ST7920_192X32_4X u8g(10);		// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
69
+//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
70
+//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
71
+//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
72
+//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
73
+//U8GLIB_LM6059 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
74
+//U8GLIB_LM6063 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
75
+//U8GLIB_DOGXL160_BW u8g(10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
76
+//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
77
+//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
78
+//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
79
+//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
80
+//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
81
+//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); 		// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
82
+//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
83
+//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
84
+//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
85
+//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
86
+//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
87
+//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
89
+//U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95
+//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
96
+//U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
103
+//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
104
+//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
105
+//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
112
+//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
113
+//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
124
+//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
126
+//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
127
+//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
136
+
137
+
138
+void draw(void) {
139
+  
140
+  if ( u8g.getMode() == U8G_MODE_HICOLOR || u8g.getMode() == U8G_MODE_R3G3B2) {
141
+    /* draw background (area is 128x128) */
142
+    u8g_uint_t r, g, b;
143
+    for( b = 0; b < 4; b++ )
144
+    {
145
+      for( g = 0; g < 32; g++ )
146
+      {
147
+	for( r = 0; r < 32; r++ )
148
+	{
149
+	  u8g.setRGB(r<<3, g<<3, b<<4 );
150
+	  u8g.drawPixel(g + b*32, r);
151
+	  u8g.setRGB(r<<3, g<<3, (b<<4)+64 );
152
+	  u8g.drawPixel(g + b*32, r+32);
153
+	  u8g.setRGB(r<<3, g<<3, (b<<4)+128 );
154
+	  u8g.drawPixel(g + b*32, r+32+32);
155
+	  u8g.setRGB(r<<3, g<<3, (b<<4)+128+64 );
156
+	  u8g.drawPixel(g + b*32, r+32+32+32);
157
+	}
158
+      }
159
+    }
160
+  }
161
+
162
+  // assign default color value
163
+  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
164
+    u8g.setColorIndex(255);     // white
165
+  }
166
+  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
167
+    u8g.setColorIndex(3);         // max intensity
168
+  }
169
+  else if ( u8g.getMode() == U8G_MODE_BW ) {
170
+    u8g.setColorIndex(1);         // pixel on
171
+  }
172
+  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
173
+    u8g.setHiColorByRGB(255,255,255);
174
+  }
175
+  u8g.setFont(u8g_font_unifont);
176
+  u8g.drawStr( 0, 22, "Hello World!");
177
+  
178
+  
179
+}
180
+
181
+void setup(void) {
182
+  
183
+  // flip screen, if required
184
+  // u8g.setRot180();
185
+  
186
+  // set SPI backup if required
187
+  //u8g.setHardwareBackup(u8g_backup_avr_spi);
188
+
189
+}
190
+
191
+void loop(void) {
192
+  // picture loop
193
+  u8g.firstPage();  
194
+  do {
195
+    draw();
196
+  } while( u8g.nextPage() );
197
+  
198
+  // rebuild the picture after some delay
199
+  delay(500);
200
+}
201
+

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Console/Console.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Console/Console.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 
102 138
 // setup input buffer

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/F/F.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/F/F.ino Просмотреть файл

@@ -44,8 +44,8 @@
44 44
 #include "U8glib.h"
45 45
 
46 46
 // setup u8g object, please remove comment from one of the following constructor calls
47
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
48
-
47
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
48
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
49 49
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
50 50
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
51 51
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -54,9 +54,10 @@
54 54
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55 55
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 58
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59 59
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
60
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
60 61
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
61 62
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
62 63
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -86,19 +87,54 @@
86 87
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
87 88
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
88 89
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
89 91
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
93
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
94
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
95
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
96
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91 97
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
92 98
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
93
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
99
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
100
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
101
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
103
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
104
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
94 105
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
95 106
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
96 107
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
108
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
109
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
110
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
111
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
112
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
113
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97 114
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
98 115
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
116
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
118
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
124
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
125
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
99 126
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
127
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
100 128
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
101 129
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
130
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
131
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
135
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
136
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
137
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
102 138
 
103 139
 void draw(void) {
104 140
   // graphic commands to redraw the complete screen should be placed here  

+ 398
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/FPS/FPS.ino Просмотреть файл

@@ -0,0 +1,398 @@
1
+/*
2
+
3
+  FPS.pde
4
+  
5
+  >>> Before compiling: Please remove comment from the constructor of the 
6
+  >>> connected graphics display (see below).
7
+  
8
+  Universal 8bit Graphics Library, http://code.google.com/p/u8glib/
9
+  
10
+  Copyright (c) 2012, olikraus@gmail.com
11
+  All rights reserved.
12
+
13
+  Redistribution and use in source and binary forms, with or without modification, 
14
+  are permitted provided that the following conditions are met:
15
+
16
+  * Redistributions of source code must retain the above copyright notice, this list 
17
+    of conditions and the following disclaimer.
18
+    
19
+  * Redistributions in binary form must reproduce the above copyright notice, this 
20
+    list of conditions and the following disclaimer in the documentation and/or other 
21
+    materials provided with the distribution.
22
+
23
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
24
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
25
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
26
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
27
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
28
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
30
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
33
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
34
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
35
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
36
+
37
+  ST7920_192X32, SPI:    FPS: Box=7.6   @=9.8                iFPS: Box=11.4  @=14.7
38
+  ST7920_192X32, 8Bit:   FPS: Box=6.2   @=7.5                iFPS: Box=9.3 @=11.2
39
+  DOGM128 SW SPI:         FPS: Box=5.1   @=5.9  Pix=2.6               iFPS: Box=10.2 @=11.8 Pix=5.2
40
+  DOGM128 HW SPI:         FPS: Box=5.5   @=6.3               iFPS: Box=11.0 @=12.6
41
+  DOGXL160 SW SPI:         FPS: Box=1.7   @=1.9               iFPS: Box=6.9 @=7.7
42
+  DOGXL160 HW SPI:         FPS: Box=1.8   @=2.1               
43
+  
44
+  NHD27OLED_BW, SW SPI: FPS: Box=3.0  @=3.7
45
+  NHD27OLED_BW, HW SPI: FPS: Box=3.5  @=4.5
46
+  NHD27OLED_2X_BW, SW SPI: FPS: Box=3.8  @=4.9
47
+  NHD27OLED_2X_BW, HW SPI: FPS: Box=4.6  @=6.4
48
+  
49
+  30 Sep 2012
50
+  NHD27OLED_BW, SW SPI: FPS: Clip=9.2 Box=3.9  @=4.4		NEW_CODE
51
+  NHD27OLED_BW, SW SPI: FPS: Clip=9.2 Box=3.6  @=4.5
52
+  NHD27OLED_BW, HW SPI: FPS: Clip=16.3 Box=4.7  @=5.6
53
+  NHD27OLED_2X_BW, SW SPI: FPS: Clip=9.7 Box=4.5  @=5.8
54
+  NHD27OLED_2X_BW, SW SPI: FPS: Clip=18.0 Box=5.8  @=7.9
55
+
56
+  1 Oct 2012
57
+  ST7920_192X32, 8Bit:   FPS: Box=7.2   @=10.0                
58
+  DOGM128 SW SPI:         FPS: Box=5.2   @=6.6  Pix=2.6               
59
+  DOGM128 HW SPI:         FPS: Clip=33.2 Box=5.5   @=7.1
60
+  DOGXL160 SW SPI:         FPS: Box=1.7   @=2.0
61
+  DOGXL160 HW SPI:         FPS: Box=1.8   @=2.2
62
+
63
+  DOGXL160 GR SW SPI:         FPS: Box=1.1   @=1.3
64
+
65
+  1 Mar 2013
66
+  ST7920_192X32_1X, SPI:    FPS: Clip=10.3 Box=5.5  @=7.2 Pix=3.9
67
+  ST7920_192X32_4X, SPI:    FPS: Clip=10.9 Box=6.7  @=8.8 Pix=7.4
68
+  ST7920_192X32_1X, 8Bit:    FPS: Clip=14.2 Box=6.1  @=8.4 Pix=4.2
69
+  ST7920_192X32_4X, 8Bit:    FPS: Clip=14.2 Box=7.8  @=10.7 Pix=8.7
70
+  ST7920_192X32_1X, HW SPI:    FPS: Clip=14.2 Box=6.3  @=8.7 Pix=4.3
71
+  ST7920_192X32_4X, HW SPI:    FPS: Clip=15.3 Box=8.0  @=11.2 Pix=9.0
72
+
73
+  2 Jun 2013
74
+  U8GLIB_DOGM128 SW SPI:		FPS: Clip=23.9 Box=4.5  @=6.6 Pix=2.1
75
+  U8GLIB_DOGM128_2X SW SPI:	FPS: Clip=28.5 Box=6.6  @=9.7 Pix=3.9
76
+  U8GLIB_DOGM128_2X HW SPI:	FPS: Clip=40.8 Box=7.1  @=10.8 Pix=4.1
77
+  
78
+  3 Jun 2013
79
+  U8GLIB_ST7920_192X32_1X -Os	SW SPI	FPS: Clip=11.0 Box=5.4  @=7.1 Pix=3.9	Size=11828
80
+  U8GLIB_ST7920_192X32_1X -O3	SW SPI	FPS: Clip=10.9 Box=5.6  @=7.5 Pix=4.0	Size=13800
81
+  U8GLIB_ST7920_192X32_1X -Os	SW SPI	FPS: Clip=16.8 Box=6.7  @=9.6 Pix=4.5	Size=11858	(new seq data output)
82
+  U8GLIB_ST7920_192X32_1X -Os	HW SPI	FPS: Clip=25.7 Box=7.5  @=11.3 Pix=4.8	(new seq data output)
83
+  
84
+  6 Jun 2013
85
+  U8GLIB_DOGS102 u8g(13, 11, 10, 9);    STD SW SPI	FPS: Clip=9.5 Box=7.6  @=8.2 Pix=6.2	Size=15652
86
+  U8GLIB_DOGS102 u8g(13, 11, 10, 9);    SW SPI	        FPS: Clip=19.1 Box=12.8  @=14.0 Pix=9.2	Size=15532
87
+
88
+
89
+  12 Jun 2013
90
+  SSD1351_128X128_332	SW SPI Clip=1.3 Box=0.7  @=0.9 Pix=0.4
91
+  SSD1351_128X128_332	HW SPI Clip=3.6 Box=1.1  @=1.5 Pix=0.5
92
+
93
+  24 Jun 2013
94
+  Uno SSD1351_128X128_332				SW SPI Clip=1.4 Box=0.8  @=0.9 Pix=0.4
95
+  
96
+  Uno SSD1351_128X128_332					HW SPI Clip=4.4 Box=1.2  @=1.6 Pix=0.5
97
+  Uno SSD1351_128X128_HICOLOR			HW SPI Clip=3.7 Box=0.8  @=1.0 Pix=0.3
98
+
99
+  Mega2560 SSD1351_128X128_332			HW SPI Clip=4.4 Box=1.2  @=1.6 Pix=0.5
100
+  Mega2560 SSD1351_128X128_4X_332			HW SPI Clip=4.6 Box=2.3  @=2.8 Pix=1.5
101
+  Mega2560 SSD1351_128X128_HICOLOR		HW SPI Clip=3.6 Box=0.8  @=1.0 Pix=0.3
102
+  Mega2560 SSD1351_128X128_4X_HICOLOR	HW SPI Clip=4.2 Box=1.7  @=2.1 Pix=1.0
103
+
104
+  Due SSD1351_128X128_332					HW SPI Clip=24.6 Box=6.3  @=7.8 Pix=2.8
105
+  Due SSD1351_128X128_4X_332 				HW SPI Clip=28.1 Box=13.0  @=15.1 Pix=8.5
106
+  Due SSD1351_128X128_HICOLOR			HW SPI Clip=20.8 Box=3.4  @=4.5 Pix=1.4
107
+  Due SSD1351_128X128_4X_HICOLOR			HW SPI Clip=26.3 Box=8.9  @=11.1 Pix=4.8
108
+
109
+  Due SSD1351_128X128_4X_HICOLOR			SW SPI Clip=0.4 Box=0.4  @=0.4 Pix=0.4
110
+  
111
+  Due DOGS102 u8g(13, 11, 10, 9);    			SW SPI	        FPS: Clip=19.1 Box=13.1  @=14.3 Pix=9.4
112
+  Due DOGS102 u8g(10, 9);    					HW SPI	        FPS: Clip=128.9 Box=30.7  @=40.6 Pix=15.4
113
+
114
+  Due NHD27OLED_BW u8g(10, 9)				HW SPI		FPS: Clip=53.0 Box=19.6  @=23.8 Pix=10.6
115
+  Due NHD27OLED_2X_BW u8g(10, 9)			HW SPI		FPS: Clip=57.0 Box=25.3  @=31.7 Pix=18.1
116
+  Due NHD27OLED_GR u8g(10, 9)				HW SPI		FPS: Clip=34.1 Box=11.7  @=13.7 Pix=5.6
117
+  Due NHD27OLED_2X_GR u8g(10, 9)			HW SPI		FPS: Clip=38.1 Box=15.5  @=20.0 Pix=8.8
118
+
119
+*/
120
+
121
+
122
+#include "U8glib.h"
123
+
124
+// setup u8g object, please remove comment from one of the following constructor calls
125
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
126
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
127
+//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
128
+//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
129
+//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
130
+//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
131
+//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
132
+//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
133
+//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
134
+//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
135
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
136
+//U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
137
+//U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
138
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
139
+//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
140
+//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
141
+//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
142
+//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
143
+//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
144
+//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
145
+//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
146
+//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
147
+//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10);	// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
148
+//U8GLIB_ST7920_192X32_4X u8g(10);		// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
149
+//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
150
+//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
151
+//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
152
+//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
153
+//U8GLIB_LM6059 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
154
+//U8GLIB_LM6063 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
155
+//U8GLIB_DOGXL160_BW u8g(10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
156
+//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
157
+//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
158
+//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
159
+//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
160
+//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
161
+//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); 		// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
162
+//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
163
+//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
164
+//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
165
+//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
166
+//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
167
+//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
168
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
169
+//U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
170
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
171
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
172
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
173
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
174
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
175
+//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
176
+//U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
177
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
178
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
179
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
180
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
181
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
182
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
183
+//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
184
+//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
185
+//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
186
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
187
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
188
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
189
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
190
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
191
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
192
+//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
193
+//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
194
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
195
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
196
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
197
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
198
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
199
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
200
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
201
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
202
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
203
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
204
+//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
205
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
206
+//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
207
+//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
208
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
209
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
210
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
211
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
212
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
213
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
214
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
215
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
216
+
217
+#define SECONDS 10
218
+uint8_t flip_color = 0;
219
+uint8_t draw_color = 1;
220
+
221
+void draw_set_screen(void) {
222
+  // graphic commands to redraw the complete screen should be placed here  
223
+  if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
224
+    if ( flip_color == 0 ) 
225
+      u8g.setHiColorByRGB(0,0,0);
226
+    else
227
+      u8g.setHiColorByRGB(255,255,255);
228
+  }
229
+  else {
230
+    u8g.setColorIndex(flip_color);
231
+  }
232
+  u8g.drawBox( 0, 0, u8g.getWidth(), u8g.getHeight() );
233
+}
234
+
235
+void draw_clip_test(void) {
236
+  u8g_uint_t i, j, k;
237
+  char buf[3] = "AB";
238
+  k = 0;
239
+  if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
240
+    u8g.setHiColorByRGB(255,255,255);
241
+  }
242
+  else {
243
+    u8g.setColorIndex(draw_color);
244
+  }
245
+  u8g.setFont(u8g_font_6x10);
246
+  
247
+  for( i = 0; i  < 6; i++ ) {
248
+    for( j = 1; j  < 8; j++ ) {
249
+      u8g.drawHLine(i-3, k, j);
250
+      u8g.drawHLine(i-3+10, k, j);
251
+      
252
+      u8g.drawVLine(k+20, i-3, j);
253
+      u8g.drawVLine(k+20, i-3+10, j);
254
+      
255
+      k++;
256
+    }
257
+  }
258
+  u8g.drawStr(0-3, 50, buf);
259
+  u8g.drawStr180(0+3, 50, buf);
260
+  
261
+  u8g.drawStr(u8g.getWidth()-3, 40, buf);
262
+  u8g.drawStr180(u8g.getWidth()+3, 40, buf);
263
+
264
+  u8g.drawStr90(u8g.getWidth()-10, 0-3, buf);
265
+  u8g.drawStr270(u8g.getWidth()-10, 3, buf);
266
+
267
+  u8g.drawStr90(u8g.getWidth()-20, u8g.getHeight()-3, buf);
268
+  u8g.drawStr270(u8g.getWidth()-20, u8g.getHeight()+3, buf);
269
+  
270
+}
271
+
272
+void draw_char(void) {
273
+  char buf[2] = "@";
274
+  u8g_uint_t i, j;
275
+  // graphic commands to redraw the complete screen should be placed here  
276
+  if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
277
+    u8g.setHiColorByRGB(255,255,255);
278
+  }
279
+  else {
280
+    u8g.setColorIndex(draw_color);
281
+  }
282
+  u8g.setFont(u8g_font_6x10);
283
+  j = 8;
284
+  for(;;) {
285
+    i = 0;
286
+    for(;;) {
287
+      u8g.drawStr( i, j, buf);
288
+      i += 8;
289
+      if ( i > u8g.getWidth() )
290
+        break;
291
+    }
292
+    j += 8;
293
+    if ( j > u8g.getHeight() )
294
+      break;
295
+  }
296
+  
297
+}
298
+
299
+void draw_pixel(void) {
300
+  u8g_uint_t x, y, w2, h2;
301
+  if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
302
+    u8g.setHiColorByRGB(255,255,255);
303
+  }
304
+  else {
305
+    u8g.setColorIndex(draw_color);
306
+  }
307
+  w2 = u8g.getWidth();
308
+  h2 = u8g.getHeight();
309
+  w2 /= 2;
310
+  h2 /= 2;
311
+  for( y = 0; y < h2; y++ ) {
312
+    for( x = 0; x < w2; x++ ) {
313
+      if ( (x + y) & 1 ) {
314
+        u8g.drawPixel(x,y);
315
+        u8g.drawPixel(x,y+h2);
316
+        u8g.drawPixel(x+w2,y);
317
+        u8g.drawPixel(x+w2,y+h2);
318
+      }
319
+    }
320
+  }
321
+}
322
+
323
+// returns unadjusted FPS
324
+uint16_t picture_loop_with_fps(void (*draw_fn)(void)) {
325
+  uint16_t FPS10 = 0;
326
+  uint32_t time;
327
+  
328
+  time = millis() + SECONDS*1000;
329
+  
330
+  // picture loop
331
+  do {
332
+    u8g.firstPage();  
333
+    do {
334
+      draw_fn();
335
+    } while( u8g.nextPage() );
336
+    FPS10++;
337
+    flip_color = flip_color ^ 1;
338
+  } while( millis() < time );
339
+  return FPS10;  
340
+}
341
+
342
+const char *convert_FPS(uint16_t fps) {
343
+  static char buf[6];
344
+  strcpy(buf, u8g_u8toa( (uint8_t)(fps/10), 3));
345
+  buf[3] =  '.';
346
+  buf[4] = (fps % 10) + '0';
347
+  buf[5] = '\0';
348
+  return buf;
349
+}
350
+
351
+void show_result(const char *s, uint16_t fps) {
352
+  // assign default color value
353
+  if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
354
+    u8g.setHiColorByRGB(255,255,255);
355
+  }
356
+  else {
357
+    u8g.setColorIndex(draw_color);
358
+  }
359
+  u8g.setFont(u8g_font_8x13B);
360
+  u8g.firstPage();  
361
+  do {
362
+    u8g.drawStr(0,12, s);
363
+    u8g.drawStr(0,24, convert_FPS(fps));
364
+  } while( u8g.nextPage() );
365
+}
366
+
367
+void setup(void) {
368
+  // flip screen, if required
369
+  // u8g.setRot180();
370
+  
371
+  // assign default color value
372
+  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) 
373
+    draw_color = 255;     // white
374
+  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
375
+    draw_color = 3;         // max intensity
376
+  else if ( u8g.getMode() == U8G_MODE_BW )
377
+    draw_color = 1;         // pixel on
378
+  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
379
+    u8g.setHiColorByRGB(255,255,255);
380
+  }
381
+}
382
+
383
+void loop(void) {
384
+  uint16_t fps;
385
+  fps = picture_loop_with_fps(draw_clip_test);
386
+  show_result("draw clip test", fps);
387
+  delay(5000);
388
+  fps = picture_loop_with_fps(draw_set_screen);
389
+  show_result("clear screen", fps);
390
+  delay(5000);
391
+  fps = picture_loop_with_fps(draw_char);
392
+  show_result("draw @", fps);
393
+  delay(5000);  
394
+  fps = picture_loop_with_fps(draw_pixel);
395
+  show_result("draw pixel", fps);
396
+  delay(5000);
397
+}
398
+

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/GraphicsTest/GraphicsTest.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/GraphicsTest/GraphicsTest.ino Просмотреть файл

@@ -41,8 +41,8 @@
41 41
 #include "U8glib.h"
42 42
 
43 43
 // setup u8g object, please remove comment from one of the following constructor calls
44
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
45
-
44
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
45
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
46 46
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
47 47
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -51,9 +51,10 @@
51 51
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
52 52
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55 55
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 58
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
58 59
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -83,19 +84,54 @@
83 84
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
84 85
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
85 86
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
87
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
86 88
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
87
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
92
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88 94
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
89 95
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
96
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
97
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
98
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
99
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
91 102
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
92 103
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
93 104
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
105
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
107
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
108
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
109
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
110
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
94 111
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
95 112
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
113
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
115
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
116
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 123
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
124
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
97 125
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
127
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
128
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
129
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
134
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
99 135
 
100 136
 void u8g_prepare(void) {
101 137
   u8g.setFont(u8g_font_6x10);
@@ -143,6 +179,15 @@ void u8g_line(uint8_t a) {
143 179
   u8g.drawLine(7+a*4, 10, 100, 55);
144 180
 }
145 181
 
182
+void u8g_triangle(uint8_t a) {
183
+  uint16_t offset = a;
184
+  u8g.drawStr( 0, 0, "drawTriangle");
185
+  u8g.drawTriangle(14,7, 45,30, 10,40);
186
+  u8g.drawTriangle(14+offset,7-offset, 45+offset,30-offset, 57+offset,10-offset);
187
+  u8g.drawTriangle(57+offset*2,10, 45+offset*2,30, 86+offset*2,53);
188
+  u8g.drawTriangle(10+offset,40+offset, 45+offset,30+offset, 86+offset,53+offset);
189
+}
190
+
146 191
 void u8g_ascii_1() {
147 192
   char s[2] = " ";
148 193
   uint8_t x, y;
@@ -167,6 +212,45 @@ void u8g_ascii_2() {
167 212
   }
168 213
 }
169 214
 
215
+void u8g_extra_page(uint8_t a)
216
+{
217
+  if ( u8g.getMode() == U8G_MODE_HICOLOR || u8g.getMode() == U8G_MODE_R3G3B2) {
218
+    /* draw background (area is 128x128) */
219
+    u8g_uint_t r, g, b;
220
+    b = a << 5;
221
+    for( g = 0; g < 64; g++ )
222
+    {
223
+      for( r = 0; r < 64; r++ )
224
+      {
225
+	u8g.setRGB(r<<2, g<<2, b );
226
+	u8g.drawPixel(g, r);
227
+      }
228
+    }
229
+    u8g.setRGB(255,255,255);
230
+    u8g.drawStr( 66, 0, "Color Page");
231
+  }
232
+  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
233
+  {
234
+    u8g.drawStr( 66, 0, "Gray Level");
235
+    u8g.setColorIndex(1);
236
+    u8g.drawBox(0, 4, 64, 32);    
237
+    u8g.drawBox(70, 20, 4, 12);
238
+    u8g.setColorIndex(2);
239
+    u8g.drawBox(0+1*a, 4+1*a, 64-2*a, 32-2*a);
240
+    u8g.drawBox(74, 20, 4, 12);
241
+    u8g.setColorIndex(3);
242
+    u8g.drawBox(0+2*a, 4+2*a, 64-4*a, 32-4*a);
243
+    u8g.drawBox(78, 20, 4, 12);
244
+  }
245
+  else
246
+  {
247
+    u8g.drawStr( 0, 12, "setScale2x2");
248
+    u8g.setScale2x2();
249
+    u8g.drawStr( 0, 6+a, "setScale2x2");
250
+    u8g.undoScale();
251
+  }
252
+}
253
+
170 254
 
171 255
 uint8_t draw_state = 0;
172 256
 
@@ -178,8 +262,10 @@ void draw(void) {
178 262
     case 2: u8g_r_frame(draw_state&7); break;
179 263
     case 3: u8g_string(draw_state&7); break;
180 264
     case 4: u8g_line(draw_state&7); break;
181
-    case 5: u8g_ascii_1(); break;
182
-    case 6: u8g_ascii_2(); break;
265
+    case 5: u8g_triangle(draw_state&7); break;
266
+    case 6: u8g_ascii_1(); break;
267
+    case 7: u8g_ascii_2(); break;
268
+    case 8: u8g_extra_page(draw_state&7); break;
183 269
   }
184 270
 }
185 271
 
@@ -188,15 +274,6 @@ void setup(void) {
188 274
   // flip screen, if required
189 275
   //u8g.setRot180();
190 276
 
191
-  // assign default color value
192
-  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) 
193
-    u8g.setColorIndex(255);     // white
194
-  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
195
-    u8g.setColorIndex(3);         // max intensity
196
-  else if ( u8g.getMode() == U8G_MODE_BW )
197
-    u8g.setColorIndex(1);         // pixel on
198
-  
199
-  //u8g.setContrast(0x30);
200 277
   
201 278
   pinMode(13, OUTPUT);           
202 279
   digitalWrite(13, HIGH);  
@@ -212,11 +289,11 @@ void loop(void) {
212 289
   
213 290
   // increase the state
214 291
   draw_state++;
215
-  if ( draw_state >= 7*8 )
292
+  if ( draw_state >= 9*8 )
216 293
     draw_state = 0;
217 294
   
218 295
   // rebuild the picture after some delay
219
-  delay(150);
296
+  //delay(150);
220 297
 
221 298
 }
222 299
 

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/HelloWorld/HelloWorld.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/HelloWorld/HelloWorld.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 
102 138
 void draw(void) {
@@ -107,7 +143,6 @@ void draw(void) {
107 143
 }
108 144
 
109 145
 void setup(void) {
110
-  
111 146
   // flip screen, if required
112 147
   // u8g.setRot180();
113 148
   
@@ -115,12 +150,18 @@ void setup(void) {
115 150
   //u8g.setHardwareBackup(u8g_backup_avr_spi);
116 151
 
117 152
   // assign default color value
118
-  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) 
153
+  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
119 154
     u8g.setColorIndex(255);     // white
120
-  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
155
+  }
156
+  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
121 157
     u8g.setColorIndex(3);         // max intensity
122
-  else if ( u8g.getMode() == U8G_MODE_BW )
158
+  }
159
+  else if ( u8g.getMode() == U8G_MODE_BW ) {
123 160
     u8g.setColorIndex(1);         // pixel on
161
+  }
162
+  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
163
+    u8g.setHiColorByRGB(255,255,255);
164
+  }
124 165
 }
125 166
 
126 167
 void loop(void) {
@@ -131,6 +172,6 @@ void loop(void) {
131 172
   } while( u8g.nextPage() );
132 173
   
133 174
   // rebuild the picture after some delay
134
-  delay(500);
175
+  delay(50);
135 176
 }
136 177
 

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Menu/Menu.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Menu/Menu.ino Просмотреть файл

@@ -45,6 +45,9 @@
45 45
 // setup u8g object, please remove comment from one of the following constructor calls
46 46
 // IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
47 47
 
48
+// setup u8g object, please remove comment from one of the following constructor calls
49
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
50
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
48 51
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 52
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
50 53
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -53,9 +56,10 @@
53 56
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 57
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55 58
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 60
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 61
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
62
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59 63
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 64
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
61 65
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -85,19 +89,54 @@
85 89
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
86 90
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
87 91
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
92
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
88 93
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
94
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
95
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
96
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
97
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
98
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90 99
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
91 100
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
92
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
101
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
102
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
103
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
104
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
105
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
106
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
93 107
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94 108
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
95 109
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
111
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
112
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
113
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
114
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
115
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
96 116
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 117
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
120
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
124
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
125
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
126
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
127
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
98 128
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
129
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 130
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
100 131
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
132
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
133
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
135
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
136
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
137
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
138
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
139
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
101 140
 
102 141
 
103 142
 #define KEY_NONE 0

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/PrintTest/PrintTest.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/PrintTest/PrintTest.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 void draw(void) {
102 138
   // graphic commands to redraw the complete screen should be placed here  

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Rotation/Rotation.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Rotation/Rotation.ino Просмотреть файл

@@ -1,8 +1,8 @@
1 1
 /*
2 2
 
3
-  HelloWorld.pde
3
+  Rotation.pde
4 4
   
5
-  "Hello World!" example code.
5
+  Example code for RotXXX functions.
6 6
   
7 7
   >>> Before compiling: Please remove comment from the constructor of the 
8 8
   >>> connected graphics display (see below).
@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 uint8_t offset = 0;
102 138
 

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Scale/Scale.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Scale/Scale.ino Просмотреть файл

@@ -1,8 +1,8 @@
1 1
 /*
2 2
 
3
-  HelloWorld.pde
3
+  Scale.pde
4 4
   
5
-  "Hello World!" example code.
5
+  Example code for the 2x2 scale function.
6 6
   
7 7
   >>> Before compiling: Please remove comment from the constructor of the 
8 8
   >>> connected graphics display (see below).
@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 
102 138
 void draw(void) {

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/TextRotX/TextRotX.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/TextRotX/TextRotX.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 // graphic commands to redraw the complete screen should be placed here  
102 138
 void draw(void) {

+ 348
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Touch4WSetup/Touch4WSetup.ino Просмотреть файл

@@ -0,0 +1,348 @@
1
+/*
2
+
3
+  Touch4WSetup.pde
4
+  
5
+  Use this example to figure out the ranges for of the active area of a 4-wire resistive 
6
+  touch panel.
7
+  
8
+  >>> Before compiling: Please remove comment from the constructor of the 
9
+  >>> connected graphics display (see below).
10
+  
11
+  Universal 8bit Graphics Library, http://code.google.com/p/u8glib/
12
+  
13
+  Copyright (c) 2012, olikraus@gmail.com
14
+  All rights reserved.
15
+
16
+  Redistribution and use in source and binary forms, with or without modification, 
17
+  are permitted provided that the following conditions are met:
18
+
19
+  * Redistributions of source code must retain the above copyright notice, this list 
20
+    of conditions and the following disclaimer.
21
+    
22
+  * Redistributions in binary form must reproduce the above copyright notice, this 
23
+    list of conditions and the following disclaimer in the documentation and/or other 
24
+    materials provided with the distribution.
25
+
26
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
27
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
28
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
29
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
30
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
31
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
32
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
33
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
34
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
35
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
36
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
37
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
38
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
39
+  
40
+*/
41
+
42
+
43
+#include "U8glib.h"
44
+
45
+// setup u8g object, please remove comment from one of the following constructor calls
46
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
47
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
48
+//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49
+//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
50
+//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
51
+//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
52
+//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53
+//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54
+//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57
+//U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
60
+//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
61
+//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
62
+//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
63
+//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
64
+//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
65
+//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
66
+//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
67
+//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
68
+//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10);	// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
69
+//U8GLIB_ST7920_192X32_4X u8g(10);		// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
70
+//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
71
+//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
72
+//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
73
+//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
74
+//U8GLIB_LM6059 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
75
+//U8GLIB_LM6063 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
76
+//U8GLIB_DOGXL160_BW u8g(10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
77
+//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
78
+//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
79
+//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
80
+//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
81
+//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
82
+//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); 		// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
83
+//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
84
+//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
85
+//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
86
+//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
87
+//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
88
+//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
89
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
90
+//U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
93
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
95
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
96
+//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
97
+//U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
98
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
99
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
100
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
103
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
104
+//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
105
+//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
108
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
109
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
110
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
111
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
112
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
113
+//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
116
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
117
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
124
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
125
+//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
126
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
127
+//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
129
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
130
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
135
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
136
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
137
+
138
+//================================================================
139
+// Setup 4-Wire Resistive Touch Panel
140
+
141
+uint8_t tp_left = A3;
142
+uint8_t tp_right = A5;
143
+uint8_t tp_top = A4;
144
+uint8_t tp_bottom = A2;
145
+
146
+#define X_START 120
147
+#define X_END 140
148
+#define Y_START 120
149
+#define Y_END 140 
150
+
151
+#define PULLUP_THRESHOLD 235
152
+
153
+//================================================================
154
+// Touch Panel Code
155
+
156
+/* touch panel dimension */
157
+struct tpd_struct
158
+{
159
+  /* raw value */
160
+  uint8_t raw;
161
+  
162
+  /* calibration values  */
163
+  uint8_t start;
164
+  uint8_t end;		
165
+  
166
+  /* user values */
167
+  uint8_t range;	/* result will have range fron 0..range  (including the value of range) */
168
+  
169
+  uint8_t result;	/* output value: position [0...range] */
170
+  uint8_t is_pressed;	/* output value: pressed (=1) or not pressed (=0) */
171
+  uint8_t is_update;	/* will be set to 1 if result or is_pressed has been updated */
172
+};
173
+
174
+struct tp_struct
175
+{
176
+  struct tpd_struct x;
177
+  struct tpd_struct y;
178
+  uint8_t is_pressed; /* combination of x.is_pressed && y.is_pressed */
179
+  uint8_t is_update;
180
+};
181
+
182
+struct tp_struct tp;
183
+
184
+/* map raw value to 0...range (result) */
185
+void tpd_map_touch_position(struct tpd_struct *d, uint8_t raw)
186
+{
187
+  uint8_t is_pressed;
188
+  uint16_t p;
189
+  uint8_t start, end;
190
+  
191
+  d->raw = raw;
192
+  
193
+  start = d->start;
194
+  end = d->end;
195
+
196
+  /* check if position is within active area; store result in "is_pressed" */
197
+  is_pressed = 1;  
198
+  if ( raw >= PULLUP_THRESHOLD )
199
+  {
200
+    d->result = 0;
201
+    is_pressed = 0;
202
+  }
203
+  else
204
+  {
205
+    /* update start and end */
206
+    if ( raw < start )
207
+    {
208
+      start = raw;
209
+      d->start = raw;
210
+    }
211
+    if ( raw > end )
212
+    {
213
+      end = raw;
214
+      d->end = raw;
215
+    }
216
+  }
217
+  
218
+  /* store "is_pressed" in the global structure, set update flag */
219
+  if ( d->is_pressed != is_pressed )
220
+    d->is_update = 1;
221
+  d->is_pressed = is_pressed;
222
+    
223
+  /* map "raw" value into target range */
224
+  if ( is_pressed != 0 )
225
+  {    
226
+    p = raw;
227
+    p -= start;
228
+    p *= d->range;
229
+    end -= start;
230
+    p /= end;
231
+
232
+    if ( d->result != p )
233
+      d->is_update = 1;
234
+    d->result = p;
235
+  }
236
+}
237
+
238
+void tp_Init(uint8_t width, uint8_t height)
239
+{
240
+  tp.x.start = X_START;
241
+  tp.x.end = X_END;
242
+  tp.x.range = width-1;
243
+  
244
+  tp.y.start = Y_START;
245
+  tp.y.end = Y_END;
246
+  tp.y.range = height-1;
247
+  
248
+  tp.is_update = 1;
249
+}
250
+
251
+void setTouchRawValues(uint8_t x, uint8_t y)
252
+{
253
+      tpd_map_touch_position(&(tp.x), x);
254
+      tpd_map_touch_position(&(tp.y), y);
255
+      
256
+      tp.is_pressed = tp.x.is_pressed && tp.y.is_pressed;
257
+      if ( tp.x.is_update || tp.y.is_update )
258
+	tp.is_update = 1;
259
+}
260
+
261
+
262
+uint8_t getTouchPos(uint8_t hiPin, uint8_t lowPin, uint8_t sensePin, uint8_t dcPin)
263
+{
264
+  uint8_t val;
265
+  pinMode(dcPin, INPUT);
266
+  pinMode(sensePin, INPUT_PULLUP);
267
+  pinMode(hiPin, OUTPUT);
268
+  pinMode(lowPin, OUTPUT);  
269
+  
270
+  digitalWrite(hiPin, HIGH);
271
+  digitalWrite(lowPin, LOW);
272
+  delay(10);
273
+  val = analogRead(sensePin) >> 2;
274
+  pinMode(hiPin, INPUT);
275
+  pinMode(lowPin, INPUT);  
276
+  delay(10);
277
+  return val;
278
+}
279
+
280
+void updateTouchPanel(void)
281
+{
282
+  uint8_t tp_raw_x;
283
+  uint8_t tp_raw_y;
284
+
285
+  tp_raw_x = getTouchPos(tp_right, tp_left, tp_bottom, tp_top);
286
+  tp_raw_y = getTouchPos(tp_top, tp_bottom, tp_left, tp_right);
287
+  
288
+  setTouchRawValues(tp_raw_x, tp_raw_y);  
289
+}
290
+
291
+//================================================================
292
+// graphics output and picture loop
293
+
294
+void center(u8g_uint_t y, const char *str)
295
+{
296
+  u8g_uint_t x;
297
+  x = u8g.getWidth();
298
+  x -= u8g.getStrWidth(str);
299
+  x /= 2;
300
+  u8g.drawStr(x, y, str);
301
+}
302
+
303
+
304
+void draw(void) {
305
+  u8g.setFont(u8g_font_6x10);
306
+  center( 10, "Touch Panel Setup");
307
+  u8g.setPrintPos(0, 20); u8g.print("x_start=");u8g.print((int)tp.x.start);u8g.print(" x_end=");u8g.print((int)tp.x.end);
308
+  u8g.setPrintPos(0, 30); u8g.print("y_start=");u8g.print((int)tp.y.start);u8g.print(" y_end=");u8g.print((int)tp.y.end);
309
+  u8g.setPrintPos(0, 40); u8g.print("x=");u8g.print((int)tp.x.raw);
310
+  u8g.setPrintPos(0, 50); u8g.print("y=");u8g.print((int)tp.y.raw);
311
+}
312
+
313
+void setup(void) {
314
+  
315
+  // flip screen, if required
316
+  // u8g.setRot180();
317
+  u8g.setCursorFont(u8g_font_cursor);
318
+  u8g.setCursorStyle(32);
319
+  
320
+  tp_Init(u8g.getWidth(), u8g.getHeight());
321
+  
322
+  tp.is_update = 1;
323
+}
324
+
325
+void loop(void) {
326
+  
327
+  // update touch panel and handle return values
328
+  updateTouchPanel();
329
+  
330
+  if ( tp.is_pressed != 0 )
331
+    u8g.enableCursor();
332
+  else
333
+    u8g.disableCursor();
334
+  
335
+  u8g.setCursorPos(tp.x.result, u8g.getHeight()-tp.y.result-1);
336
+  
337
+  // picture loop
338
+  if ( tp.is_update != 0 )
339
+  {
340
+    tp.is_update = 0;
341
+    u8g.firstPage();  
342
+    do {
343
+      draw();
344
+    } while( u8g.nextPage() );
345
+  }
346
+  
347
+}
348
+

+ 335
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/Touch4WTest/Touch4WTest.ino Просмотреть файл

@@ -0,0 +1,335 @@
1
+/*
2
+
3
+  Touch4WTest.pde
4
+  
5
+  >>> Before compiling: Please remove comment from the constructor of the 
6
+  >>> connected graphics display (see below).
7
+  
8
+  Universal 8bit Graphics Library, http://code.google.com/p/u8glib/
9
+  
10
+  Copyright (c) 2012, olikraus@gmail.com
11
+  All rights reserved.
12
+
13
+  Redistribution and use in source and binary forms, with or without modification, 
14
+  are permitted provided that the following conditions are met:
15
+
16
+  * Redistributions of source code must retain the above copyright notice, this list 
17
+    of conditions and the following disclaimer.
18
+    
19
+  * Redistributions in binary form must reproduce the above copyright notice, this 
20
+    list of conditions and the following disclaimer in the documentation and/or other 
21
+    materials provided with the distribution.
22
+
23
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
24
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
25
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
26
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
27
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
28
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
30
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
33
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
34
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
35
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
36
+  
37
+*/
38
+
39
+
40
+#include "U8glib.h"
41
+
42
+// setup u8g object, please remove comment from one of the following constructor calls
43
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
44
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
45
+//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
46
+//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
47
+//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48
+//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49
+//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
50
+//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
51
+//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
52
+//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54
+//U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57
+//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
58
+//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59
+//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
60
+//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
61
+//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
62
+//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
63
+//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
64
+//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
65
+//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10);	// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
66
+//U8GLIB_ST7920_192X32_4X u8g(10);		// SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
67
+//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
68
+//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
69
+//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
70
+//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
71
+//U8GLIB_LM6059 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
72
+//U8GLIB_LM6063 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
73
+//U8GLIB_DOGXL160_BW u8g(10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
74
+//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
75
+//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
76
+//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
77
+//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
78
+//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
79
+//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); 		// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
80
+//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
81
+//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
82
+//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7,  18, 14, 15, 17, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
83
+//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
84
+//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
85
+//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
86
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87
+//U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
89
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
91
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
92
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
93
+//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
96
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
97
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
98
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
99
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
101
+//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
102
+//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
103
+//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
104
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
105
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
106
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
107
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
108
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
109
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
110
+//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
111
+//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
112
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
113
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
114
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
116
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
123
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
124
+//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
126
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
127
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
128
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
129
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
133
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
134
+
135
+//================================================================
136
+// Setup 4-Wire Resistive Touch Panel
137
+
138
+uint8_t tp_left = A3;
139
+uint8_t tp_right = A5;
140
+uint8_t tp_top = A4;
141
+uint8_t tp_bottom = A2;
142
+
143
+/* Run "Touch4WSetup" and enter values here */
144
+#define X_START 64
145
+#define X_END 200
146
+#define Y_START 105
147
+#define Y_END 160  
148
+
149
+//================================================================
150
+// Touch Panel Code
151
+
152
+/* touch panel dimension */
153
+struct tpd_struct
154
+{
155
+  /* raw value */
156
+  uint8_t raw;
157
+  
158
+  /* calibration values  */
159
+  uint8_t start;
160
+  uint8_t end;		
161
+  
162
+  /* user values */
163
+  uint8_t range;	/* result will have range fron 0..range  (including the value of range) */
164
+  
165
+  uint8_t result;	/* output value: position [0...range] */
166
+  uint8_t is_pressed;	/* output value: pressed (=1) or not pressed (=0) */
167
+  uint8_t is_update;	/* will be set to 1 if result or is_pressed has been updated */
168
+};
169
+
170
+struct tp_struct
171
+{
172
+  struct tpd_struct x;
173
+  struct tpd_struct y;
174
+  uint8_t is_pressed; /* combination of x.is_pressed && y.is_pressed */
175
+  uint8_t is_update;
176
+};
177
+
178
+struct tp_struct tp;
179
+
180
+/* map raw value to 0...range (result) */
181
+void tpd_map_touch_position(struct tpd_struct *d, uint8_t raw)
182
+{
183
+  uint8_t is_pressed;
184
+  uint16_t p;
185
+  uint8_t start, end;
186
+  
187
+  d->raw = raw;
188
+  
189
+  start = d->start;
190
+  end = d->end;
191
+
192
+  /* check if position is within active area; store result in "is_pressed" */
193
+  is_pressed = 1;  
194
+  if ( raw < start )
195
+  {
196
+    d->result = 0;
197
+    is_pressed = 0;
198
+  }
199
+  if ( raw >= end )
200
+  {
201
+    d->result = d->range;
202
+    is_pressed = 0;
203
+  }
204
+  
205
+  /* store "is_pressed" in the global structure, set update flag */
206
+  if ( d->is_pressed != is_pressed )
207
+    d->is_update = 1;
208
+  d->is_pressed = is_pressed;
209
+    
210
+  /* map "raw" value into target range */
211
+  if ( is_pressed != 0 )
212
+  {    
213
+    p = raw;
214
+    p -= start;
215
+    p *= d->range;
216
+    end -= start;
217
+    p /= end;
218
+
219
+    if ( d->result != p )
220
+      d->is_update = 1;
221
+    d->result = p;
222
+  }
223
+}
224
+
225
+void tp_Init(uint8_t width, uint8_t height)
226
+{
227
+  tp.x.start = X_START;
228
+  tp.x.end = X_END;
229
+  tp.x.range = width-1;
230
+  
231
+  tp.y.start = Y_START;
232
+  tp.y.end = Y_END;
233
+  tp.y.range = height-1;
234
+  
235
+  tp.is_update = 1;
236
+}
237
+
238
+void setTouchRawValues(uint8_t x, uint8_t y)
239
+{
240
+      tpd_map_touch_position(&(tp.x), x);
241
+      tpd_map_touch_position(&(tp.y), y);
242
+      
243
+      tp.is_pressed = tp.x.is_pressed && tp.y.is_pressed;
244
+      if ( tp.x.is_update || tp.y.is_update )
245
+	tp.is_update = 1;
246
+}
247
+
248
+
249
+uint8_t getTouchPos(uint8_t hiPin, uint8_t lowPin, uint8_t sensePin, uint8_t dcPin)
250
+{
251
+  uint8_t val;
252
+  pinMode(dcPin, INPUT);
253
+  pinMode(sensePin, INPUT_PULLUP);
254
+  pinMode(hiPin, OUTPUT);
255
+  pinMode(lowPin, OUTPUT);  
256
+  
257
+  digitalWrite(hiPin, HIGH);
258
+  digitalWrite(lowPin, LOW);
259
+  delay(10);
260
+  val = analogRead(sensePin) >> 2;
261
+  pinMode(hiPin, INPUT);
262
+  pinMode(lowPin, INPUT);  
263
+  delay(10);
264
+  return val;
265
+}
266
+
267
+void updateTouchPanel(void)
268
+{
269
+  uint8_t tp_raw_x;
270
+  uint8_t tp_raw_y;
271
+
272
+  tp_raw_x = getTouchPos(tp_right, tp_left, tp_bottom, tp_top);
273
+  tp_raw_y = getTouchPos(tp_top, tp_bottom, tp_left, tp_right);
274
+  
275
+  setTouchRawValues(tp_raw_x, tp_raw_y);  
276
+}
277
+
278
+//================================================================
279
+// graphics output and picture loop
280
+
281
+void center(u8g_uint_t y, const char *str)
282
+{
283
+  u8g_uint_t x;
284
+  x = u8g.getWidth();
285
+  x -= u8g.getStrWidth(str);
286
+  x /= 2;
287
+  u8g.drawStr(x, y, str);
288
+}
289
+
290
+
291
+void draw(void) {
292
+  u8g.setFont(u8g_font_6x10);
293
+  center( 10, "Touch Panel Test");
294
+  if ( tp.is_pressed != 0 )
295
+  {
296
+    u8g.setPrintPos(0, 20); u8g.print("x=");u8g.print((int)tp.x.result);
297
+    u8g.setPrintPos(0, 30); u8g.print("y=");u8g.print((int)(u8g.getHeight()-tp.y.result-1));
298
+    //u8g.setPrintPos(0, 40); u8g.print("x: ");u8g.print((int)tp.x.start);u8g.print("..");u8g.print((int)tp.x.end);
299
+    //u8g.setPrintPos(0, 50); u8g.print("y: ");u8g.print((int)tp.y.start);u8g.print("..");u8g.print((int)tp.y.end);
300
+  }
301
+}
302
+
303
+void setup(void) {
304
+  
305
+  // flip screen, if required
306
+  // u8g.setRot180();
307
+  u8g.setCursorFont(u8g_font_cursor);
308
+  u8g.setCursorStyle(32);
309
+  
310
+  tp_Init(u8g.getWidth(), u8g.getHeight());  
311
+}
312
+
313
+void loop(void) {
314
+  
315
+  // update touch panel and handle return values
316
+  updateTouchPanel();
317
+  
318
+  if ( tp.is_pressed != 0 )
319
+    u8g.enableCursor();
320
+  else
321
+    u8g.disableCursor();
322
+  
323
+  u8g.setCursorPos(tp.x.result, u8g.getHeight()-tp.y.result-1);
324
+  
325
+  // picture loop
326
+  if ( tp.is_update != 0 ) {
327
+    tp.is_update = 0;
328
+    u8g.firstPage();  
329
+    do {
330
+      draw();
331
+    } while( u8g.nextPage() );
332
+  }
333
+  
334
+}
335
+

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/U8gLogo/U8gLogo.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/U8gLogo/U8gLogo.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,20 +85,56 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
137
+//#define MINI_LOGO
101 138
 
102 139
 void drawColorBox(void)
103 140
 {
@@ -117,19 +154,32 @@ void drawColorBox(void)
117 154
 
118 155
 void drawLogo(uint8_t d)
119 156
 {
120
-  u8g.setFont(u8g_font_gdr25r);
121
-  u8g.drawStr(0+d, 30+d, "U");
122
-  u8g.setFont(u8g_font_gdr30n);
123
-  u8g.drawStr90(23+d,10+d,"8");
124
-  u8g.setFont(u8g_font_gdr25r);
125
-  u8g.drawStr(53+d,30+d,"g");
126
-  
127
-  u8g.drawHLine(2+d, 35+d, 47);
128
-  u8g.drawVLine(45+d, 32+d, 12);
157
+#ifdef MINI_LOGO
158
+    u8g.setFont(u8g_font_gdr17r);
159
+    u8g.drawStr(0+d, 22+d, "U");
160
+    u8g.setFont(u8g_font_gdr20n);
161
+    u8g.drawStr90(17+d,8+d,"8");
162
+    u8g.setFont(u8g_font_gdr17r);
163
+    u8g.drawStr(39+d,22+d,"g");
164
+    
165
+    u8g.drawHLine(2+d, 25+d, 34);
166
+    u8g.drawVLine(32+d, 22+d, 12);
167
+#else
168
+    u8g.setFont(u8g_font_gdr25r);
169
+    u8g.drawStr(0+d, 30+d, "U");
170
+    u8g.setFont(u8g_font_gdr30n);
171
+    u8g.drawStr90(23+d,10+d,"8");
172
+    u8g.setFont(u8g_font_gdr25r);
173
+    u8g.drawStr(53+d,30+d,"g");
174
+    
175
+    u8g.drawHLine(2+d, 35+d, 47);
176
+    u8g.drawVLine(45+d, 32+d, 12);
177
+#endif
129 178
 }
130 179
 
131 180
 void drawURL(void)
132 181
 {
182
+#ifndef MINI_LOGO
133 183
   u8g.setFont(u8g_font_4x6);
134 184
   if ( u8g.getHeight() < 59 )
135 185
   {
@@ -140,6 +190,7 @@ void drawURL(void)
140 190
   {
141 191
     u8g.drawStr(1,54,"code.google.com/p/u8glib");
142 192
   }
193
+#endif
143 194
 }
144 195
 
145 196
 

ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/XBM/XBM.pde → ArduinoAddons/Arduino_1.0.x/libraries/U8glib/examples/XBM/XBM.ino Просмотреть файл

@@ -42,8 +42,8 @@
42 42
 #include "U8glib.h"
43 43
 
44 44
 // setup u8g object, please remove comment from one of the following constructor calls
45
-// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
46
-
45
+// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
46
+// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device
47 47
 //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
48 48
 //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
49 49
 //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
@@ -52,9 +52,10 @@
52 52
 //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 53
 //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 54
 //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
-//U8GLIB_DOGS102 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55
+//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 56
 //U8GLIB_DOGM132 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 57
 //U8GLIB_DOGM128 u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58
+//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9);		// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 59
 //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
59 60
 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
60 61
 //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
@@ -84,19 +85,54 @@
84 85
 //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 );  			// 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
85 86
 //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); 	// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
86 87
 //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
88
+//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
87 89
 //U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
88
-//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
90
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);	// I2C / TWI 
91
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);	// Fast I2C / TWI 
92
+//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send AC
93
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
94
+//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
89 95
 //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
90 96
 //U8GLIB_SSD1306_128X32 u8g(10, 9);             // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
91
-//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
97
+//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
98
+//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
99
+//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
100
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
101
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
102
+//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK
92 103
 //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
93 104
 //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);	// I2C
94 105
 //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE);	// I2C
106
+//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE);	// I2C
107
+//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108
+//U8GLIB_UC1611_DOGM240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
109
+//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE);	// I2C
110
+//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111
+//U8GLIB_UC1611_DOGXL240 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
95 112
 //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
96 113
 //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
114
+//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
115
+//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)
116
+//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
117
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
118
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
119
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
120
+//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
121
+//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
122
+//U8GLIB_UC1608_240X64 u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
123
+//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8);	// HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
97 124
 //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
125
+//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
98 126
 //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
99 127
 //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
128
+//U8GLIB_HT1632_24X16 u8g(3, 2, 4);		// WR = 3, DATA = 2, CS = 4
129
+//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
130
+//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
131
+//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
132
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
133
+//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
134
+//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
135
+//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
100 136
 
101 137
 #define u8g_logo_width 38
102 138
 #define u8g_logo_height 24

+ 1
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/license.txt Просмотреть файл

@@ -78,3 +78,4 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
78 78
 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
79 79
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
80 80
 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
81
+

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/chessengine.c Просмотреть файл

@@ -72,7 +72,7 @@
72 72
 	- Castling: Need to check for fields under attack
73 73
 	    --> done
74 74
 	
75
-	- Check for WIN / LOSE situation, perhaps call ce_Eval() once on the top-level board setup
75
+	- Check for WIN / LOOSE situation, perhaps call ce_Eval() once on the top-level board setup
76 76
 	    just after the real move
77 77
 	- cleanup cu_Move
78 78
 	    --> almost done

+ 812
- 442
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 4
- 4
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_clip.c Просмотреть файл

@@ -50,7 +50,7 @@
50 50
   uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
51 51
   However, this is slower than a decision tree version:  
52 52
   static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 
53
-  Also suprising is, that he the macro implementation is slower than the inlined version.
53
+  Also suprising is, that the macro implementation is slower than the inlined version.
54 54
   
55 55
   The decision tree is based on the expansion of the truth table.
56 56
   
@@ -59,7 +59,7 @@
59 59
 #include "u8g.h"
60 60
 
61 61
 #ifdef __GNUC__
62
-#define U8G_ALWAYS_INLINE __attribute__((always_inline))
62
+#define U8G_ALWAYS_INLINE __inline__ __attribute__((always_inline))
63 63
 #else
64 64
 #define U8G_ALWAYS_INLINE
65 65
  #endif 
@@ -94,8 +94,8 @@ static uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uin
94 94
 
95 95
 #define U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1) ((uint8_t)( (v0) <= (a1) ) ? ( ( (v1) >= (a0) ) ? ( 1 ) : ( (v0) > (v1) ) ) : ( ( (v1) >= (a0) ) ? ( (v0) > (v1) ) : ( 0 ) ))
96 96
 
97
-static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)  U8G_ALWAYS_INLINE;
98
-static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 
97
+//static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) U8G_ALWAYS_INLINE;
98
+static uint8_t U8G_ALWAYS_INLINE u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 
99 99
 {
100 100
   /* surprisingly the macro leads to larger code */
101 101
   /* return U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1); */

+ 2
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_api.c Просмотреть файл

@@ -36,9 +36,9 @@
36 36
 
37 37
 #include "u8g.h"
38 38
 
39
-uint8_t u8g_InitCom(u8g_t *u8g, u8g_dev_t *dev)
39
+uint8_t u8g_InitCom(u8g_t *u8g, u8g_dev_t *dev, uint8_t clk_cycle_time)
40 40
 {
41
-  return dev->com_fn(u8g, U8G_COM_MSG_INIT, 0, NULL);
41
+  return dev->com_fn(u8g, U8G_COM_MSG_INIT, clk_cycle_time, NULL);
42 42
 }
43 43
 
44 44
 void u8g_StopCom(u8g_t *u8g, u8g_dev_t *dev)

+ 160
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_attiny85_hw_spi.c Просмотреть файл

@@ -0,0 +1,160 @@
1
+/*
2
+  
3
+  u8g_arduino_ATtiny85_std_hw_spi.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2011, olikraus@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+  
34
+*/
35
+
36
+// Uses code from tinySPI Written by Nick Gammon
37
+// March 2013
38
+
39
+// ATMEL ATTINY45 / ARDUINO pin mappings
40
+//
41
+//                         +-\/-+
42
+// RESET  Ain0 (D 5) PB5  1|    |8  Vcc
43
+// CLK1   Ain3 (D 3) PB3  2|    |7  PB2 (D 2) Ain1  SCK  / USCK / SCL
44
+// CLK0   Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1  MISO / DO
45
+//                   GND  4|    |5  PB0 (D 0) pwm0  MOSI / DI / SDA
46
+//                         +----+
47
+
48
+
49
+#include "u8g.h"
50
+
51
+
52
+#if defined(ARDUINO) && defined(__AVR_ATtiny85__)
53
+
54
+#if ARDUINO < 100 
55
+#include <WProgram.h>
56
+#else 
57
+#include <Arduino.h> 
58
+#endif
59
+
60
+const byte DI   = 0;  // D0, pin 5  Data In
61
+const byte DO   = 1;  // D1, pin 6  Data Out (this is *not* MOSI)
62
+const byte USCK = 2;  // D2, pin 7  Universal Serial Interface clock
63
+
64
+uint8_t u8g_arduino_ATtiny85_spi_out(uint8_t val)
65
+{
66
+  USIDR = val;  // byte to output
67
+  USISR = _BV (USIOIF);  // clear Counter Overflow Interrupt Flag, set count to zero 
68
+  do
69
+  {
70
+    USICR = _BV (USIWM0)   // 3-wire mode
71
+          | _BV (USICS1) | _BV (USICLK)  // Software clock strobe
72
+          | _BV (USITC);   // Toggle Clock Port Pin
73
+  }
74
+  while ((USISR & _BV (USIOIF)) == 0);  // until Counter Overflow Interrupt Flag set
75
+  
76
+  return USIDR;  // return read data
77
+}
78
+
79
+uint8_t u8g_com_arduino_ATtiny85_std_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
80
+{
81
+  switch(msg)
82
+  {
83
+    case U8G_COM_MSG_INIT:
84
+      u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);  // ensure SS stays high until needed
85
+      pinMode (USCK, OUTPUT);
86
+      pinMode (DO, OUTPUT);
87
+      pinMode (u8g->pin_list[U8G_PI_CS], OUTPUT);
88
+      pinMode (u8g->pin_list[U8G_PI_A0], OUTPUT);
89
+      USICR = _BV (USIWM0);  // 3-wire mode
90
+      u8g_MicroDelay();
91
+      break;
92
+    
93
+    case U8G_COM_MSG_STOP:
94
+      break;
95
+
96
+    case U8G_COM_MSG_RESET:
97
+      if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
98
+        u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
99
+      break;
100
+      
101
+    case U8G_COM_MSG_CHIP_SELECT:
102
+      if ( arg_val == 0 )
103
+      {
104
+        /* disable */
105
+        u8g_MicroDelay();
106
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
107
+        u8g_MicroDelay();
108
+      }
109
+      else
110
+      {
111
+        /* enable */
112
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
113
+        u8g_MicroDelay();
114
+      }
115
+      break;
116
+
117
+    case U8G_COM_MSG_WRITE_BYTE:
118
+      u8g_arduino_ATtiny85_spi_out(arg_val);
119
+      u8g_MicroDelay();
120
+      break;
121
+    
122
+    case U8G_COM_MSG_WRITE_SEQ:
123
+      {
124
+        register uint8_t *ptr = arg_ptr;
125
+        while( arg_val > 0 )
126
+        {
127
+          u8g_arduino_ATtiny85_spi_out(*ptr++);
128
+          arg_val--;
129
+        }
130
+      }
131
+      break;
132
+
133
+      case U8G_COM_MSG_WRITE_SEQ_P:
134
+      {
135
+        register uint8_t *ptr = arg_ptr;
136
+        while( arg_val > 0 )
137
+        {
138
+          u8g_arduino_ATtiny85_spi_out(u8g_pgm_read(ptr));
139
+          ptr++;
140
+          arg_val--;
141
+        }
142
+      }
143
+      break;
144
+      
145
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
146
+      u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
147
+      u8g_MicroDelay();
148
+      break;
149
+  }
150
+  return 1;
151
+}
152
+
153
+#else /* ARDUINO */
154
+
155
+uint8_t u8g_com_arduino_ATtiny85_std_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
156
+{
157
+  return 1;
158
+}
159
+
160
+#endif /* ARDUINO */

+ 10
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_fast_parallel.c Просмотреть файл

@@ -49,6 +49,12 @@
49 49
   u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
50 50
   u8g_Init8Bit(u8g, dev,  8,    9, 10, 11,   4,   5,   6,   7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
51 51
 
52
+  Update for ATOMIC operation done (01 Jun 2013)
53
+    U8G_ATOMIC_OR(ptr, val)
54
+    U8G_ATOMIC_AND(ptr, val)
55
+    U8G_ATOMIC_START();
56
+    U8G_ATOMIC_END();
57
+
52 58
 */
53 59
 
54 60
 #include "u8g.h"
@@ -114,7 +120,8 @@ static void u8g_com_arduino_fast_parallel_init(u8g_t *u8g)
114 120
   u8g_data_mask[7] =  digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);  
115 121
 }
116 122
 
117
-void u8g_com_arduino_fast_write_data_pin(uint8_t pin, uint8_t val)
123
+/* atomic protection must be done by calling function */
124
+static void u8g_com_arduino_fast_write_data_pin(uint8_t pin, uint8_t val)
118 125
 {
119 126
   if ( val != 0 )
120 127
     *u8g_data_port[pin] |= u8g_data_mask[pin];
@@ -125,6 +132,7 @@ void u8g_com_arduino_fast_write_data_pin(uint8_t pin, uint8_t val)
125 132
 
126 133
 void u8g_com_arduino_fast_parallel_write(u8g_t *u8g, uint8_t val)
127 134
 {
135
+  U8G_ATOMIC_START();
128 136
   u8g_com_arduino_fast_write_data_pin( 0, val&1 );
129 137
   val >>= 1;
130 138
   u8g_com_arduino_fast_write_data_pin( 1, val&1 );
@@ -142,6 +150,7 @@ void u8g_com_arduino_fast_parallel_write(u8g_t *u8g, uint8_t val)
142 150
   val >>= 1;
143 151
   u8g_com_arduino_fast_write_data_pin( 7, val&1 );
144 152
   val >>= 1;
153
+  U8G_ATOMIC_END();
145 154
   
146 155
   /* EN cycle time must be 1 micro second */
147 156
   u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);

+ 250
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_hw_spi.c Просмотреть файл

@@ -30,7 +30,99 @@
30 30
   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31 31
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32 32
   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+
34
+  SPI Clock Cycle Type
35
+  
36
+  SSD1351	  50ns		20 MHz
37
+  SSD1322	300ns		  3.3 MHz
38
+  SSD1327	300ns
39
+  SSD1306	300ns
40
+  ST7565		400ns 		  2.5 MHz
41
+  ST7920		400ns
42
+
43
+  Arduino DUE
44
+  
45
+  PA25	MISO
46
+  PA26	MOSI	75
47
+  PA27	SCLK	76
48
+  
49
+  
50
+typedef struct {
51
+  WoReg SPI_CR;        (Spi Offset: 0x00) Control Register 
52
+  RwReg SPI_MR;        (Spi Offset: 0x04) Mode Register 
53
+  RoReg SPI_RDR;       (Spi Offset: 0x08) Receive Data Register 
54
+  WoReg SPI_TDR;       (Spi Offset: 0x0C) Transmit Data Register 
55
+  RoReg SPI_SR;        (Spi Offset: 0x10) Status Register 
56
+  WoReg SPI_IER;       (Spi Offset: 0x14) Interrupt Enable Register 
57
+  WoReg SPI_IDR;       (Spi Offset: 0x18) Interrupt Disable Register 
58
+  RoReg SPI_IMR;       (Spi Offset: 0x1C) Interrupt Mask Register 
59
+  RoReg Reserved1[4];
60
+  RwReg SPI_CSR[4];    (Spi Offset: 0x30) Chip Select Register 
61
+  RoReg Reserved2[41];
62
+  RwReg SPI_WPMR;      (Spi Offset: 0xE4) Write Protection Control Register 
63
+  RoReg SPI_WPSR;      (Spi Offset: 0xE8) Write Protection Status Register 
64
+} Spi;
65
+  
66
+  Power Management Controller (PMC)
67
+  arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/include/instance/instance_pmc.h
68
+    - enable PIO
69
+      
70
+      REG_PMC_PCER0 = 1UL << ID_PIOA
71
+    - enable SPI
72
+      REG_PMC_PCER0 = 1UL << ID_SPI0
73
+
74
+
75
+    - enable PIOA and SPI0
76
+      REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
77
+
78
+  Parallel Input/Output Controller (PIO)
79
+  arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/include/instance/instance_pioa.h
80
+    - enable special function of the pin: disable PIO on A26 and A27:
81
+	REG_PIOA_PDR = 0x0c000000
82
+	PIOA->PIO_PDR = 0x0c000000
83
+
84
+  SPI
85
+    SPI0->SPI_CR = SPI_CR_SPIDIS
86
+    SPI0->SPI_CR = SPI_CR_SWRST ;
87
+    SPI0->SPI_CR = SPI_CR_SWRST ;
88
+    SPI0->SPI_CR = SPI_CR_SPIEN
33 89
   
90
+    Bit 0: Master Mode = 1 (active)
91
+    Bit 1: Peripheral Select = 0 (fixed)
92
+    Bit 2: Chip Select Decode Mode = 1 (4 to 16)
93
+    Bit 4: Mode Fault Detection = 1 (disabled)
94
+    Bit 5: Wait Data Read = 0 (disabled) 
95
+    Bit 7: Loop Back Mode = 0 (disabled)
96
+    Bit 16-19: Peripheral Chip Select = 0 (chip select 0)    
97
+    SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PCSDEC | SPI_MR_MODFDIS
98
+    
99
+    Bit 0: Clock Polarity = 0
100
+    Bit 1: Clock Phase = 0
101
+    Bit 4-7: Bits = 0 (8 Bit)
102
+    Bit 8-15: SCBR = 1
103
+    SPI0->SPI_CSR[0] = SPI_CSR_SCBR(x)	Serial Baud Rate
104
+	SCBR / 84000000 > 50 / 1000000000 
105
+	SCBR / 84 > 5 / 100 
106
+	SCBR  > 50 *84 / 1000 --> SCBR=5
107
+	SCBR  > 300*84 / 1000 --> SCBR=26
108
+	SCBR  > 400*84 / 1000 --> SCBR=34
109
+
110
+  Arduino Due test code:
111
+    REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
112
+    REG_PIOA_PDR = 0x0c000000;
113
+    SPI0->SPI_CR = SPI_CR_SPIDIS;
114
+    SPI0->SPI_CR = SPI_CR_SWRST;
115
+    SPI0->SPI_CR = SPI_CR_SWRST;
116
+    SPI0->SPI_CR = SPI_CR_SPIEN;
117
+    SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PCSDEC | SPI_MR_MODFDIS;
118
+    SPI0->SPI_CSR[0] = SPI_CSR_SCBR(30);
119
+
120
+    for(;;)
121
+    {
122
+      while( (SPI0->SPI_SR & SPI_SR_TDRE) == 0 )
123
+	;
124
+      SPI0->SPI_TDR = 0x050;
125
+    }
34 126
 
35 127
 */
36 128
 
@@ -39,6 +131,17 @@
39 131
 #if defined(ARDUINO)
40 132
 
41 133
 #if defined(__AVR__)
134
+#define U8G_ARDUINO_ATMEGA_HW_SPI
135
+/* remove the definition for attiny */
136
+#if __AVR_ARCH__ == 2
137
+#undef U8G_ARDUINO_ATMEGA_HW_SPI
138
+#endif
139
+#if __AVR_ARCH__ == 25
140
+#undef U8G_ARDUINO_ATMEGA_HW_SPI
141
+#endif
142
+#endif
143
+
144
+#if defined(U8G_ARDUINO_ATMEGA_HW_SPI)
42 145
 
43 146
 #include <avr/interrupt.h>
44 147
 #include <avr/io.h>
@@ -115,11 +218,17 @@ uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
115 218
             1	1		fclk/128
116 219
       */
117 220
       SPCR = 0;
118
-      SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(1<<SPR0)|(0<<CPOL)|(0<<CPHA);
221
+      SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);
119 222
 #ifdef U8G_HW_SPI_2X
120 223
       SPSR = (1 << SPI2X);  /* double speed, issue 89 */
224
+#else
225
+      if ( arg_val  <= U8G_SPI_CLK_CYCLE_50NS )
226
+      {
227
+	SPSR = (1 << SPI2X);  /* double speed, issue 89 */
228
+      }
121 229
 #endif
122 230
       
231
+      
123 232
       break;
124 233
     
125 234
     case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
@@ -176,9 +285,147 @@ uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
176 285
 
177 286
 /* #elif defined(__18CXX) || defined(__PIC32MX) */
178 287
 
179
-#else /* __AVR__ */
288
+#elif defined(__SAM3X8E__)		// Arduino Due, maybe we should better check for __SAM3X8E__
289
+
290
+#include <Arduino.h> 
291
+
292
+/* use Arduino pin definitions */
293
+#define PIN_SCK SCK
294
+#define PIN_MISO  MISO
295
+#define PIN_MOSI MOSI
296
+#define PIN_CS SS
297
+
298
+
299
+static uint8_t u8g_spi_out(uint8_t data)
300
+{
301
+  /* wait until tx register is empty */
302
+  while( (SPI0->SPI_SR & SPI_SR_TDRE) == 0 )
303
+    ;
304
+  /* send data */
305
+  SPI0->SPI_TDR = (uint32_t)data;
306
+  return  data;
307
+}
308
+
309
+
310
+uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
311
+{
312
+  switch(msg)
313
+  {
314
+    case U8G_COM_MSG_STOP:
315
+      break;
316
+    
317
+    case U8G_COM_MSG_INIT:
318
+      u8g_com_arduino_assign_pin_output_high(u8g);
319
+      u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
320
+    
321
+      /* Arduino Due specific code */
322
+      
323
+      /* enable PIOA and SPI0 */
324
+      REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
325
+
326
+      /* disable PIO on A26 and A27 */
327
+      REG_PIOA_PDR = 0x0c000000;
328
+
329
+      /* reset SPI0 (from sam lib) */
330
+      SPI0->SPI_CR = SPI_CR_SPIDIS;
331
+      SPI0->SPI_CR = SPI_CR_SWRST;
332
+      SPI0->SPI_CR = SPI_CR_SWRST;
333
+      SPI0->SPI_CR = SPI_CR_SPIEN;
334
+      u8g_MicroDelay();
335
+      
336
+      /* master mode, no fault detection, chip select 0 */
337
+      SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PCSDEC | SPI_MR_MODFDIS;
338
+      
339
+      /* Polarity, Phase, 8 Bit data transfer, baud rate */
340
+      /* x * 1000 / 84 --> clock cycle in ns 
341
+        5 * 1000 / 84 = 58 ns       
342
+	SCBR  > 50 *84 / 1000 --> SCBR=5
343
+	SCBR  > 300*84 / 1000 --> SCBR=26
344
+	SCBR  > 400*84 / 1000 --> SCBR=34
345
+      */
346
+      
347
+      if ( arg_val <= U8G_SPI_CLK_CYCLE_50NS )
348
+      {
349
+	SPI0->SPI_CSR[0] = SPI_CSR_SCBR(5) | 1;
350
+      }
351
+      else if ( arg_val <= U8G_SPI_CLK_CYCLE_300NS )
352
+      {
353
+	SPI0->SPI_CSR[0] = SPI_CSR_SCBR(26) | 1;
354
+      }
355
+      else if ( arg_val <= U8G_SPI_CLK_CYCLE_400NS )
356
+      {
357
+	SPI0->SPI_CSR[0] = SPI_CSR_SCBR(34) | 1;
358
+      }
359
+      else
360
+      {
361
+	SPI0->SPI_CSR[0] = SPI_CSR_SCBR(84) | 1;
362
+      }
363
+      
364
+      u8g_MicroDelay();      
365
+      break;
366
+    
367
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
368
+      u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
369
+      u8g_MicroDelay();
370
+      break;
371
+
372
+    case U8G_COM_MSG_CHIP_SELECT:
373
+      if ( arg_val == 0 )
374
+      {
375
+        /* disable */
376
+	u8g_MicroDelay();		/* this delay is required to avoid that the display is switched off too early --> DOGS102 with DUE */
377
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
378
+	u8g_MicroDelay();
379
+      }
380
+      else
381
+      {
382
+        /* enable */
383
+        //u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
384
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
385
+	u8g_MicroDelay();
386
+      }
387
+      break;
388
+      
389
+    case U8G_COM_MSG_RESET:
390
+      if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
391
+        u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
392
+      break;
393
+    
394
+    case U8G_COM_MSG_WRITE_BYTE:
395
+      u8g_spi_out(arg_val);
396
+      u8g_MicroDelay();
397
+      break;
398
+    
399
+    case U8G_COM_MSG_WRITE_SEQ:
400
+      {
401
+        register uint8_t *ptr = arg_ptr;
402
+        while( arg_val > 0 )
403
+        {
404
+          u8g_spi_out(*ptr++);
405
+          arg_val--;
406
+        }
407
+      }
408
+      break;
409
+    case U8G_COM_MSG_WRITE_SEQ_P:
410
+      {
411
+        register uint8_t *ptr = arg_ptr;
412
+        while( arg_val > 0 )
413
+        {
414
+          u8g_spi_out(u8g_pgm_read(ptr));
415
+          ptr++;
416
+          arg_val--;
417
+        }
418
+      }
419
+      break;
420
+  }
421
+  return 1;
422
+}
423
+
424
+
425
+
426
+#else /* U8G_ARDUINO_ATMEGA_HW_SPI */
180 427
 
181
-#endif /* __AVR__ */
428
+#endif /* U8G_ARDUINO_ATMEGA_HW_SPI */
182 429
 
183 430
 #else /* ARDUINO */
184 431
 

+ 159
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_hw_usart_spi.c Просмотреть файл

@@ -0,0 +1,159 @@
1
+/*
2
+  
3
+  u8g_com_arduino_hw_usart_spi.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2011, olikraus@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+
34
+  SPI Clock Cycle Type
35
+  
36
+  SSD1351	  50ns		20 MHz
37
+  SSD1322	300ns		  3.3 MHz
38
+  SSD1327	300ns
39
+  SSD1306	300ns
40
+  ST7565		400ns 		  2.5 MHz
41
+  ST7920		400ns
42
+
43
+*/
44
+
45
+#include "u8g.h"
46
+
47
+#if defined(ARDUINO)
48
+
49
+#if defined(__AVR_ATmega32U4__ )
50
+
51
+#include <avr/interrupt.h>
52
+#include <avr/io.h>
53
+
54
+#if ARDUINO < 100 
55
+#include <WProgram.h> 
56
+#else 
57
+#include <Arduino.h> 
58
+#endif
59
+
60
+
61
+
62
+static uint8_t u8g_usart_spi_out(uint8_t data)
63
+{
64
+  /* send data */
65
+  UDR1 = data;
66
+  /* wait for empty transmit buffer */
67
+  while(!(UCSR1A & (1 << UDRE1)));
68
+
69
+  return  UDR1;
70
+}
71
+
72
+
73
+uint8_t u8g_com_arduino_hw_usart_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
74
+{
75
+  switch(msg)
76
+  {
77
+    case U8G_COM_MSG_STOP:
78
+      break;
79
+    
80
+    case U8G_COM_MSG_INIT:
81
+      /* SCK is already an output as we overwrite TXLED */
82
+      u8g_com_arduino_assign_pin_output_high(u8g);
83
+	  u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
84
+    
85
+	  // Init interface at 2MHz
86
+	  UBRR1 = 0x00;
87
+	  UCSR1C = (1 << UMSEL11) | (1 << UMSEL10);
88
+      UCSR1B = (1 << TXEN1);
89
+      UBRR1 = 3;
90
+           
91
+      break;
92
+    
93
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
94
+      u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
95
+      break;
96
+
97
+    case U8G_COM_MSG_CHIP_SELECT:
98
+      if ( arg_val == 0 )
99
+      {
100
+        /* disable */
101
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
102
+      }
103
+      else
104
+      {
105
+        /* enable */
106
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
107
+      }
108
+      break;
109
+      
110
+    case U8G_COM_MSG_RESET:
111
+      if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
112
+        u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
113
+      break;
114
+    
115
+    case U8G_COM_MSG_WRITE_BYTE:
116
+      u8g_usart_spi_out(arg_val);
117
+      break;
118
+    
119
+    case U8G_COM_MSG_WRITE_SEQ:
120
+      {
121
+        register uint8_t *ptr = arg_ptr;
122
+        while( arg_val > 0 )
123
+        {
124
+          u8g_usart_spi_out(*ptr++);
125
+          arg_val--;
126
+        }
127
+      }
128
+      break;
129
+    case U8G_COM_MSG_WRITE_SEQ_P:
130
+      {
131
+        register uint8_t *ptr = arg_ptr;
132
+        while( arg_val > 0 )
133
+        {
134
+          u8g_usart_spi_out(u8g_pgm_read(ptr));
135
+          ptr++;
136
+          arg_val--;
137
+        }
138
+      }
139
+      break;
140
+  }
141
+  return 1;
142
+}
143
+
144
+/* #elif defined(__18CXX) || defined(__PIC32MX) */
145
+/* #elif defined(__arm__)		// Arduino Due, maybe we should better check for __SAM3X8E__ */
146
+
147
+#else /* __AVR_ATmega32U4__ */
148
+
149
+#endif /* __AVR_ATmega32U4__ */
150
+
151
+#else /* ARDUINO */
152
+
153
+uint8_t u8g_com_arduino_hw_usart_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
154
+{
155
+  return 1;
156
+}
157
+
158
+#endif /* ARDUINO */
159
+

+ 15
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_no_en_parallel.c Просмотреть файл

@@ -48,6 +48,12 @@
48 48
   
49 49
   u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
50 50
   u8g_Init8Bit(u8g, dev,  8,    9, 10, 11,   4,   5,   6,   7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
51
+  Update for ATOMIC operation done (01 Jun 2013)
52
+  
53
+    U8G_ATOMIC_OR(ptr, val)
54
+    U8G_ATOMIC_AND(ptr, val)
55
+    U8G_ATOMIC_START();
56
+    U8G_ATOMIC_END();
51 57
 
52 58
 */
53 59
 
@@ -97,17 +103,23 @@ static void u8g_com_arduino_no_en_parallel_init(u8g_t *u8g)
97 103
   u8g_data_mask[7] =  digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);  
98 104
 }
99 105
 
100
-void u8g_com_arduino_no_en_write_data_pin(uint8_t pin, uint8_t val)
106
+/* No atomic protcetion. This is done by caller */
107
+static void u8g_com_arduino_no_en_write_data_pin(uint8_t pin, uint8_t val)
101 108
 {
102 109
   if ( val != 0 )
103
-    *u8g_data_port[pin] |= u8g_data_mask[pin];
110
+  {
111
+   *u8g_data_port[pin] |= u8g_data_mask[pin];
112
+  }
104 113
   else
114
+  {
105 115
     *u8g_data_port[pin] &= ~u8g_data_mask[pin];
116
+  }
106 117
 }
107 118
 
108 119
 
109 120
 void u8g_com_arduino_no_en_parallel_write(u8g_t *u8g, uint8_t val)
110 121
 {
122
+  U8G_ATOMIC_START();
111 123
   u8g_com_arduino_no_en_write_data_pin( 0, val&1 );
112 124
   val >>= 1;
113 125
   u8g_com_arduino_no_en_write_data_pin( 1, val&1 );
@@ -125,6 +137,7 @@ void u8g_com_arduino_no_en_parallel_write(u8g_t *u8g, uint8_t val)
125 137
   val >>= 1;
126 138
   u8g_com_arduino_no_en_write_data_pin( 7, val&1 );
127 139
   val >>= 1;
140
+  U8G_ATOMIC_END();
128 141
   
129 142
   /* EN cycle time must be 1 micro second, digitalWrite is slow enough to do this */
130 143
   if ( u8g->pin_list[U8G_PI_CS_STATE] == 1 )

+ 1
- 4
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_parallel.c Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 /*
2 2
   
3
-  u8g_arduino_parallel.c
3
+  u8g_com_arduino_parallel.c
4 4
 
5 5
   Universal 8bit Graphics Library
6 6
   
@@ -87,13 +87,10 @@ void u8g_com_arduino_parallel_write(u8g_t *u8g, uint8_t val)
87 87
   u8g_com_arduino_digital_write(u8g, U8G_PI_D7, val&1);
88 88
   
89 89
   /* EN cycle time must be 1 micro second, digitalWrite is slow enough to do this */
90
-  //u8g_Delay(1);
91 90
   u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
92
-  //u8g_Delay(1);
93 91
   u8g_MicroDelay(); /* delay by 1000ns, reference: ST7920: 140ns, SBN1661: 100ns */
94 92
   u8g_com_arduino_digital_write(u8g, U8G_PI_EN, LOW);
95 93
   u8g_10MicroDelay(); /* ST7920 commands: 72us */
96
-  //u8g_Delay(2);
97 94
 }
98 95
 
99 96
 

+ 9
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_port_d_wr.c Просмотреть файл

@@ -42,6 +42,13 @@
42 42
   u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
43 43
   u8g_Init8Bit(u8g, dev,  8,    9, 10, 11,   4,   5,   6,   7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
44 44
 
45
+
46
+  Update for ATOMIC operation done (01 Jun 2013)
47
+    U8G_ATOMIC_OR(ptr, val)
48
+    U8G_ATOMIC_AND(ptr, val)
49
+    U8G_ATOMIC_START();
50
+    U8G_ATOMIC_END();
51
+
45 52
 */
46 53
 
47 54
 #include "u8g.h"
@@ -80,8 +87,10 @@ uint8_t u8g_com_arduino_port_d_wr_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, v
80 87
 #ifdef UCSR0B
81 88
       UCSR0B = 0;  // disable USART 0
82 89
 #endif
90
+      U8G_ATOMIC_START();
83 91
       DDRD = 0x0ff;
84 92
       PORTD = 0x0ff;
93
+      U8G_ATOMIC_END();
85 94
 
86 95
       /* setup the RW pin as output and force it to low */
87 96
       if ( u8g->pin_list[U8G_PI_RW] != U8G_PIN_NONE )

+ 19
- 8
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_ssd_i2c.c Просмотреть файл

@@ -54,18 +54,20 @@
54 54
 
55 55
 #include "u8g.h"
56 56
 
57
-#define I2C_SLA		(0x3c*2)
58
-//#define I2C_CMD_MODE	0x080
59
-#define I2C_CMD_MODE	0x000
60
-#define I2C_DATA_MODE	0x040
57
+#if defined(U8G_WITH_PINLIST)
61 58
 
62 59
 
60
+#define I2C_SLA         (0x3c*2)
61
+//#define I2C_CMD_MODE  0x080
62
+#define I2C_CMD_MODE    0x000
63
+#define I2C_DATA_MODE   0x040
64
+
63 65
 uint8_t u8g_com_arduino_ssd_start_sequence(u8g_t *u8g)
64 66
 {
65 67
   /* are we requested to set the a0 state? */
66 68
   if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
67
-    return 1;	
68
-  
69
+    return 1;
70
+
69 71
   /* setup bus, might be a repeated start */
70 72
   if ( u8g_i2c_start(I2C_SLA) == 0 )
71 73
     return 0;
@@ -79,8 +81,7 @@ uint8_t u8g_com_arduino_ssd_start_sequence(u8g_t *u8g)
79 81
     if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
80 82
       return 0;
81 83
   }
82
-  
83
-  
84
+
84 85
   u8g->pin_list[U8G_PI_SET_A0] = 0;
85 86
   return 1;
86 87
 }
@@ -199,3 +200,13 @@ uint8_t u8g_com_arduino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
199 200
   }
200 201
   return 1;
201 202
 }
203
+
204
+#else  /* defined(U8G_WITH_PINLIST) */
205
+
206
+uint8_t u8g_com_arduino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
207
+{
208
+  return 1;
209
+}
210
+
211
+#endif /* defined(U8G_WITH_PINLIST) */
212
+

+ 330
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_st7920_custom.c Просмотреть файл

@@ -0,0 +1,330 @@
1
+/*
2
+  
3
+  u8g_com_arduino_st7920_custom.c
4
+  
5
+  Additional COM device, initially introduced for 3D Printer community
6
+  Implements a fast SW SPI com subsystem
7
+
8
+  Universal 8bit Graphics Library
9
+  
10
+  Copyright (c) 2011, olikraus@gmail.com
11
+  All rights reserved.
12
+
13
+  Redistribution and use in source and binary forms, with or without modification, 
14
+  are permitted provided that the following conditions are met:
15
+
16
+  * Redistributions of source code must retain the above copyright notice, this list 
17
+    of conditions and the following disclaimer.
18
+    
19
+  * Redistributions in binary form must reproduce the above copyright notice, this 
20
+    list of conditions and the following disclaimer in the documentation and/or other 
21
+    materials provided with the distribution.
22
+
23
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
24
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
25
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
26
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
27
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
28
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
30
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
33
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
34
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
35
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
36
+
37
+  A special SPI interface for ST7920 controller
38
+
39
+  Update for ATOMIC operation done (01 Jun 2013)
40
+    U8G_ATOMIC_OR(ptr, val)
41
+    U8G_ATOMIC_AND(ptr, val)
42
+    U8G_ATOMIC_START();
43
+    U8G_ATOMIC_END();
44
+
45
+
46
+*/
47
+
48
+#include "u8g.h"
49
+
50
+#if defined(ARDUINO)
51
+
52
+#if ARDUINO < 100 
53
+#include <WProgram.h>    
54
+#include "wiring_private.h"
55
+#include "pins_arduino.h"
56
+
57
+#else 
58
+#include <Arduino.h> 
59
+#include "wiring_private.h"
60
+#endif
61
+
62
+#if defined(__AVR__)
63
+
64
+static uint8_t u8g_bitData, u8g_bitNotData;
65
+static uint8_t u8g_bitClock, u8g_bitNotClock;
66
+static volatile uint8_t *u8g_outData;
67
+static volatile uint8_t *u8g_outClock;
68
+
69
+static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
70
+{
71
+  u8g_outData = portOutputRegister(digitalPinToPort(dataPin));
72
+  u8g_outClock = portOutputRegister(digitalPinToPort(clockPin));
73
+  u8g_bitData = digitalPinToBitMask(dataPin);
74
+  u8g_bitClock = digitalPinToBitMask(clockPin);
75
+
76
+  u8g_bitNotClock = u8g_bitClock;
77
+  u8g_bitNotClock ^= 0x0ff;
78
+
79
+  u8g_bitNotData = u8g_bitData;
80
+  u8g_bitNotData ^= 0x0ff;
81
+}
82
+
83
+static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val) U8G_NOINLINE;
84
+static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
85
+{
86
+  uint8_t cnt = 8;
87
+  uint8_t bitData = u8g_bitData;
88
+  uint8_t bitNotData = u8g_bitNotData;
89
+  uint8_t bitClock = u8g_bitClock;
90
+  uint8_t bitNotClock = u8g_bitNotClock;
91
+  volatile uint8_t *outData = u8g_outData;
92
+  volatile uint8_t *outClock = u8g_outClock;
93
+  
94
+  
95
+  U8G_ATOMIC_START();
96
+  bitData |= *outData;
97
+  bitNotData &= *outData;
98
+  do
99
+  {
100
+    if ( val & 128 )
101
+      *outData = bitData;
102
+    else
103
+      *outData = bitNotData;
104
+
105
+    /*
106
+    *outClock |= bitClock;
107
+    val <<= 1;
108
+    cnt--;
109
+    *outClock &= bitNotClock;
110
+    */
111
+
112
+    val <<= 1;
113
+    *outClock &= bitNotClock;
114
+    cnt--;
115
+    // removed micro delays, because AVRs are too slow and the delay is not required
116
+    //u8g_MicroDelay();
117
+    *outClock |= bitClock;
118
+    //u8g_MicroDelay();
119
+  } while( cnt != 0 );
120
+  U8G_ATOMIC_END();
121
+}
122
+
123
+#elif defined(__18CXX) || defined(__PIC32MX)
124
+
125
+uint16_t dog_bitData, dog_bitNotData;
126
+uint16_t dog_bitClock, dog_bitNotClock;
127
+volatile uint32_t *dog_outData;
128
+volatile uint32_t *dog_outClock;
129
+volatile uint32_t dog_pic32_spi_tmp;
130
+
131
+static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
132
+{
133
+  dog_outData = portOutputRegister(digitalPinToPort(dataPin));
134
+  dog_outClock = portOutputRegister(digitalPinToPort(clockPin));
135
+  dog_bitData = digitalPinToBitMask(dataPin);
136
+  dog_bitClock = digitalPinToBitMask(clockPin);
137
+
138
+  dog_bitNotClock = dog_bitClock;
139
+  dog_bitNotClock ^= 0x0ffff;
140
+
141
+  dog_bitNotData = dog_bitData;
142
+  dog_bitNotData ^= 0x0ffff;
143
+}
144
+
145
+static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
146
+{
147
+  uint8_t cnt = 8;
148
+  U8G_ATOMIC_START();
149
+  do
150
+  {
151
+    if ( val & 128 )
152
+	*dog_outData |= dog_bitData;
153
+    else
154
+	*dog_outData &= dog_bitNotData;    
155
+    val <<= 1;
156
+    //u8g_MicroDelay();
157
+    //*dog_outClock |= dog_bitClock;
158
+    *dog_outClock &= dog_bitNotClock;
159
+    cnt--;
160
+    u8g_MicroDelay();
161
+    //*dog_outClock &= dog_bitNotClock;
162
+    *dog_outClock |= dog_bitClock;
163
+    u8g_MicroDelay();
164
+    
165
+  } while( cnt != 0 );
166
+  U8G_ATOMIC_END();
167
+}
168
+
169
+#else
170
+
171
+/* default interface, Arduino DUE (__arm__) */
172
+
173
+uint8_t u8g_data_custom_pin;
174
+uint8_t u8g_clock_custom_pin;
175
+
176
+static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
177
+{
178
+  u8g_data_custom_pin = dataPin;
179
+  u8g_clock_custom_pin = clockPin;
180
+}
181
+
182
+static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
183
+{
184
+  uint8_t cnt = 8;
185
+  do
186
+  {
187
+    if ( val & 128 )
188
+	digitalWrite(u8g_data_custom_pin, HIGH);
189
+    else
190
+	digitalWrite(u8g_data_custom_pin, LOW);
191
+    val <<= 1;
192
+    //u8g_MicroDelay();
193
+    digitalWrite(u8g_clock_custom_pin, LOW);
194
+    cnt--;
195
+    u8g_MicroDelay();
196
+    digitalWrite(u8g_clock_custom_pin, HIGH);
197
+    u8g_MicroDelay();    
198
+  } while( cnt != 0 );
199
+}
200
+
201
+#endif 
202
+
203
+
204
+static void u8g_com_arduino_st7920_write_byte_seq(uint8_t rs, uint8_t *ptr, uint8_t len)
205
+{
206
+  uint8_t i;
207
+
208
+  if ( rs == 0 )
209
+  {
210
+    /* command */
211
+    u8g_com_arduino_do_shift_out_msb_first(0x0f8);
212
+  }
213
+  else if ( rs == 1 )
214
+  {
215
+    /* data */
216
+    u8g_com_arduino_do_shift_out_msb_first(0x0fa);
217
+  }
218
+
219
+  while( len > 0 )
220
+  {
221
+    u8g_com_arduino_do_shift_out_msb_first(*ptr & 0x0f0);
222
+    u8g_com_arduino_do_shift_out_msb_first(*ptr << 4);
223
+    ptr++;
224
+    len--;
225
+    u8g_10MicroDelay();
226
+  }
227
+  
228
+  for( i = 0; i < 4; i++ )
229
+    u8g_10MicroDelay();
230
+}
231
+
232
+static void u8g_com_arduino_st7920_write_byte(uint8_t rs, uint8_t val)
233
+{
234
+  uint8_t i;
235
+
236
+  if ( rs == 0 )
237
+  {
238
+    /* command */
239
+    u8g_com_arduino_do_shift_out_msb_first(0x0f8);
240
+  }
241
+  else if ( rs == 1 )
242
+  {
243
+    /* data */
244
+    u8g_com_arduino_do_shift_out_msb_first(0x0fa);
245
+  }
246
+  
247
+  u8g_com_arduino_do_shift_out_msb_first(val & 0x0f0);
248
+  u8g_com_arduino_do_shift_out_msb_first(val << 4);
249
+  
250
+  for( i = 0; i < 4; i++ )
251
+    u8g_10MicroDelay();
252
+    
253
+}
254
+
255
+
256
+uint8_t u8g_com_arduino_st7920_custom_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
257
+{
258
+  switch(msg)
259
+  {
260
+    case U8G_COM_MSG_INIT:
261
+      u8g_com_arduino_assign_pin_output_high(u8g);
262
+      u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
263
+      // u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
264
+      u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
265
+      u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, LOW);
266
+      u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
267
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
268
+      break;
269
+    
270
+    case U8G_COM_MSG_STOP:
271
+      break;
272
+
273
+    case U8G_COM_MSG_RESET:
274
+      if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
275
+	u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
276
+      break;
277
+      
278
+    case U8G_COM_MSG_CHIP_SELECT:
279
+      if ( arg_val == 0 )
280
+      {
281
+        /* disable, note: the st7920 has an active high chip select */
282
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
283
+      }
284
+      else
285
+      {
286
+        /* enable */
287
+        //u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
288
+        u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
289
+      }
290
+      break;
291
+
292
+    case U8G_COM_MSG_WRITE_BYTE:
293
+      u8g_com_arduino_st7920_write_byte( u8g->pin_list[U8G_PI_A0_STATE], arg_val);
294
+      //u8g->pin_list[U8G_PI_A0_STATE] = 2; 
295
+      //u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
296
+      break;
297
+    
298
+    case U8G_COM_MSG_WRITE_SEQ:
299
+      u8g_com_arduino_st7920_write_byte_seq(u8g->pin_list[U8G_PI_A0_STATE], (uint8_t *)arg_ptr, arg_val);
300
+      break;
301
+
302
+      case U8G_COM_MSG_WRITE_SEQ_P:
303
+      {
304
+        register uint8_t *ptr = arg_ptr;
305
+        while( arg_val > 0 )
306
+        {
307
+          u8g_com_arduino_st7920_write_byte(u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr) );
308
+          //u8g->pin_list[U8G_PI_A0_STATE] = 2; 
309
+          ptr++;
310
+          arg_val--;
311
+        }
312
+      }
313
+      break;
314
+      
315
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
316
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
317
+      break;
318
+  }
319
+  return 1;
320
+}
321
+
322
+#else /* ARDUINO */
323
+
324
+uint8_t u8g_com_arduino_st7920_custom_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
325
+{
326
+  return 1;
327
+}
328
+
329
+#endif /* ARDUINO */
330
+

+ 77
- 4
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_st7920_hw_spi.c Просмотреть файл

@@ -54,10 +54,10 @@
54 54
 
55 55
 /* remove the definition for attiny */
56 56
 #if __AVR_ARCH__ == 2
57
-#undef U8G_ATMEGA_HW_SPI
57
+#undef U8G_ARDUINO_ATMEGA_HW_SPI
58 58
 #endif
59 59
 #if __AVR_ARCH__ == 25
60
-#undef U8G_ATMEGA_HW_SPI
60
+#undef U8G_ARDUINO_ATMEGA_HW_SPI
61 61
 #endif
62 62
 
63 63
 #endif
@@ -68,6 +68,33 @@
68 68
 #include <avr/interrupt.h>
69 69
 #include <avr/io.h>
70 70
 
71
+
72
+#if ARDUINO < 100 
73
+
74
+/* fixed pins */
75
+#if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__) // Sanguino.cc board
76
+#define PIN_SCK         7
77
+#define PIN_MISO        6
78
+#define PIN_MOSI        5
79
+#define PIN_CS          4
80
+#else                                   // Arduino Board
81
+#define PIN_SCK 13
82
+#define PIN_MISO  12
83
+#define PIN_MOSI 11
84
+#define PIN_CS 10
85
+#endif // (__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
86
+
87
+#else 
88
+
89
+/* use Arduino pin definitions */
90
+#define PIN_SCK SCK
91
+#define PIN_MISO  MISO
92
+#define PIN_MOSI MOSI
93
+#define PIN_CS SS
94
+
95
+#endif
96
+
97
+
71 98
 static uint8_t u8g_arduino_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
72 99
 static uint8_t u8g_arduino_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val)
73 100
 {
@@ -81,6 +108,34 @@ static uint8_t u8g_arduino_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val)
81 108
 }
82 109
 
83 110
 
111
+static void u8g_com_arduino_st7920_write_byte_hw_spi_seq(u8g_t *u8g, uint8_t rs, uint8_t *ptr, uint8_t len)
112
+{
113
+  uint8_t i;
114
+
115
+  if ( rs == 0 )
116
+  {
117
+    /* command */
118
+    u8g_arduino_st7920_hw_spi_shift_out(u8g, 0x0f8);
119
+  }
120
+  else if ( rs == 1 )
121
+  {
122
+    /* data */
123
+    u8g_arduino_st7920_hw_spi_shift_out(u8g, 0x0fa);
124
+  }
125
+
126
+  while( len > 0 )
127
+  {
128
+    u8g_arduino_st7920_hw_spi_shift_out(u8g, *ptr & 0x0f0);
129
+    u8g_arduino_st7920_hw_spi_shift_out(u8g, *ptr << 4);
130
+    ptr++;
131
+    len--;
132
+    u8g_10MicroDelay();
133
+  }
134
+  
135
+  for( i = 0; i < 4; i++ )
136
+    u8g_10MicroDelay();
137
+}
138
+
84 139
 static void u8g_com_arduino_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val) U8G_NOINLINE;
85 140
 static void u8g_com_arduino_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val)
86 141
 {
@@ -115,14 +170,29 @@ uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
115 170
   {
116 171
     case U8G_COM_MSG_INIT:
117 172
       u8g_com_arduino_assign_pin_output_high(u8g);
118
-      u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
119 173
       
174
+      
175
+      /* code from u8g_com-arduino_hw_spi.c */
176
+      pinMode(PIN_SCK, OUTPUT);
177
+      digitalWrite(PIN_SCK, LOW);
178
+      pinMode(PIN_MOSI, OUTPUT);
179
+      digitalWrite(PIN_MOSI, LOW);
180
+      /* pinMode(PIN_MISO, INPUT); */
181
+
182
+      pinMode(PIN_CS, OUTPUT);			/* system chip select for the atmega board */
183
+      digitalWrite(PIN_CS, HIGH);
184
+      
185
+      
186
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
187
+      
188
+#ifdef OBSOLETE      
120 189
       DDRB |= _BV(3);          /* D0, MOSI */
121 190
       DDRB |= _BV(5);          /* SCK */
122 191
       DDRB |= _BV(2);		/* slave select */
123 192
     
124 193
       PORTB &= ~_BV(3);        /* D0, MOSI = 0 */
125 194
       PORTB &= ~_BV(5);        /* SCK = 0 */
195
+#endif
126 196
 
127 197
       /*
128 198
         SPR1 SPR0
@@ -170,15 +240,18 @@ uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
170 240
       break;
171 241
     
172 242
     case U8G_COM_MSG_WRITE_SEQ:
243
+      u8g_com_arduino_st7920_write_byte_hw_spi_seq(u8g, u8g->pin_list[U8G_PI_A0_STATE], (uint8_t *)arg_ptr, arg_val);
244
+      /*
173 245
       {
174 246
         register uint8_t *ptr = arg_ptr;
175 247
         while( arg_val > 0 )
176 248
         {
177 249
           u8g_com_arduino_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
178
-          // u8g->pin_list[U8G_PI_A0_STATE] = 2; 
179 250
           arg_val--;
180 251
         }
181 252
       }
253
+      */
254
+      
182 255
       break;
183 256
 
184 257
       case U8G_COM_MSG_WRITE_SEQ_P:

+ 51
- 16
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_st7920_spi.c Просмотреть файл

@@ -33,6 +33,13 @@
33 33
 
34 34
   A special SPI interface for ST7920 controller
35 35
 
36
+  Update for ATOMIC operation done (01 Jun 2013)
37
+    U8G_ATOMIC_OR(ptr, val)
38
+    U8G_ATOMIC_AND(ptr, val)
39
+    U8G_ATOMIC_START();
40
+    U8G_ATOMIC_END();
41
+
42
+
36 43
 */
37 44
 
38 45
 #include "u8g.h"
@@ -51,10 +58,10 @@
51 58
 
52 59
 #if defined(__AVR__)
53 60
 
54
-uint8_t u8g_bitData, u8g_bitNotData;
55
-uint8_t u8g_bitClock, u8g_bitNotClock;
56
-volatile uint8_t *u8g_outData;
57
-volatile uint8_t *u8g_outClock;
61
+static uint8_t u8g_bitData, u8g_bitNotData;
62
+static uint8_t u8g_bitClock, u8g_bitNotClock;
63
+static volatile uint8_t *u8g_outData;
64
+static volatile uint8_t *u8g_outClock;
58 65
 
59 66
 static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
60 67
 {
@@ -80,12 +87,17 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
80 87
   uint8_t bitNotClock = u8g_bitNotClock;
81 88
   volatile uint8_t *outData = u8g_outData;
82 89
   volatile uint8_t *outClock = u8g_outClock;
90
+  
91
+  
92
+  U8G_ATOMIC_START();
93
+  bitData |= *outData;
94
+  bitNotData &= *outData;
83 95
   do
84 96
   {
85 97
     if ( val & 128 )
86
-      *outData |= bitData;
98
+      *outData = bitData;
87 99
     else
88
-      *outData &= bitNotData;
100
+      *outData = bitNotData;
89 101
 
90 102
     /*
91 103
     *outClock |= bitClock;
@@ -102,6 +114,7 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
102 114
     *outClock |= bitClock;
103 115
     //u8g_MicroDelay();
104 116
   } while( cnt != 0 );
117
+  U8G_ATOMIC_END();
105 118
 }
106 119
 
107 120
 #elif defined(__18CXX) || defined(__PIC32MX)
@@ -129,6 +142,7 @@ static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
129 142
 static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
130 143
 {
131 144
   uint8_t cnt = 8;
145
+  U8G_ATOMIC_START();
132 146
   do
133 147
   {
134 148
     if ( val & 128 )
@@ -146,6 +160,7 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
146 160
     u8g_MicroDelay();
147 161
     
148 162
   } while( cnt != 0 );
163
+  U8G_ATOMIC_END();
149 164
 }
150 165
 
151 166
 #else
@@ -183,7 +198,33 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
183 198
 #endif 
184 199
 
185 200
 
201
+static void u8g_com_arduino_st7920_write_byte_seq(uint8_t rs, uint8_t *ptr, uint8_t len)
202
+{
203
+  uint8_t i;
186 204
 
205
+  if ( rs == 0 )
206
+  {
207
+    /* command */
208
+    u8g_com_arduino_do_shift_out_msb_first(0x0f8);
209
+  }
210
+  else if ( rs == 1 )
211
+  {
212
+    /* data */
213
+    u8g_com_arduino_do_shift_out_msb_first(0x0fa);
214
+  }
215
+
216
+  while( len > 0 )
217
+  {
218
+    u8g_com_arduino_do_shift_out_msb_first(*ptr & 0x0f0);
219
+    u8g_com_arduino_do_shift_out_msb_first(*ptr << 4);
220
+    ptr++;
221
+    len--;
222
+    u8g_10MicroDelay();
223
+  }
224
+  
225
+  for( i = 0; i < 4; i++ )
226
+    u8g_10MicroDelay();
227
+}
187 228
 
188 229
 static void u8g_com_arduino_st7920_write_byte(uint8_t rs, uint8_t val)
189 230
 {
@@ -209,7 +250,6 @@ static void u8g_com_arduino_st7920_write_byte(uint8_t rs, uint8_t val)
209 250
 }
210 251
 
211 252
 
212
-
213 253
 uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
214 254
 {
215 255
   switch(msg)
@@ -243,6 +283,9 @@ uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
243 283
         /* enable */
244 284
         //u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
245 285
         u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
286
+	/* 28 Dec 2013 reassign pins, fixes issue with more than one display */
287
+	/* issue 227 */
288
+	u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
246 289
       }
247 290
       break;
248 291
 
@@ -253,15 +296,7 @@ uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
253 296
       break;
254 297
     
255 298
     case U8G_COM_MSG_WRITE_SEQ:
256
-      {
257
-        register uint8_t *ptr = arg_ptr;
258
-        while( arg_val > 0 )
259
-        {
260
-          u8g_com_arduino_st7920_write_byte(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
261
-          //u8g->pin_list[U8G_PI_A0_STATE] = 2; 
262
-          arg_val--;
263
-        }
264
-      }
299
+      u8g_com_arduino_st7920_write_byte_seq(u8g->pin_list[U8G_PI_A0_STATE], (uint8_t *)arg_ptr, arg_val);
265 300
       break;
266 301
 
267 302
       case U8G_COM_MSG_WRITE_SEQ_P:

+ 0
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_std_sw_spi.c Просмотреть файл

@@ -31,7 +31,6 @@
31 31
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32 32
   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33 33
   
34
-
35 34
 */
36 35
 
37 36
 #include "u8g.h"

+ 62
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_sw_spi.c Просмотреть файл

@@ -31,6 +31,12 @@
31 31
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32 32
   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33 33
   
34
+  Update for ATOMIC operation done (01 Jun 2013)
35
+    U8G_ATOMIC_OR(ptr, val)
36
+    U8G_ATOMIC_AND(ptr, val)
37
+    U8G_ATOMIC_START();
38
+    U8G_ATOMIC_END();
39
+ 
34 40
 
35 41
 */
36 42
 
@@ -48,6 +54,9 @@
48 54
 #include "wiring_private.h"
49 55
 #endif
50 56
 
57
+/*=========================================================*/
58
+/* Arduino, AVR */
59
+
51 60
 #if defined(__AVR__)
52 61
 
53 62
 uint8_t u8g_bitData, u8g_bitNotData;
@@ -79,6 +88,7 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
79 88
   uint8_t bitNotClock = u8g_bitNotClock;
80 89
   volatile uint8_t *outData = u8g_outData;
81 90
   volatile uint8_t *outClock = u8g_outClock;
91
+  U8G_ATOMIC_START();
82 92
   do
83 93
   {
84 94
     if ( val & 128 )
@@ -91,8 +101,11 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
91 101
     cnt--;
92 102
     *outClock &= bitNotClock;
93 103
   } while( cnt != 0 );
104
+  U8G_ATOMIC_END();
94 105
 }
95 106
 
107
+/*=========================================================*/
108
+/* Arduino, Chipkit */
96 109
 #elif defined(__18CXX) || defined(__PIC32MX)
97 110
 
98 111
 uint16_t dog_bitData, dog_bitNotData;
@@ -118,6 +131,7 @@ static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
118 131
 static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
119 132
 {
120 133
   uint8_t cnt = 8;
134
+  U8G_ATOMIC_START();
121 135
   do
122 136
   {
123 137
     if ( val & 128 )
@@ -142,8 +156,54 @@ static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
142 156
     dog_pic32_spi_tmp = *dog_outClock;
143 157
     dog_pic32_spi_tmp = *dog_outClock;
144 158
   } while( cnt != 0 );
159
+  U8G_ATOMIC_END();
160
+}
161
+
162
+/*=========================================================*/
163
+/* Arduino Due */
164
+#elif defined(__SAM3X8E__)
165
+
166
+/* Due */
167
+
168
+void u8g_digital_write_sam_high(uint8_t pin)
169
+{
170
+    PIO_Set( g_APinDescription[pin].pPort, g_APinDescription[pin].ulPin) ;
171
+}
172
+
173
+void u8g_digital_write_sam_low(uint8_t pin)
174
+{
175
+    PIO_Clear( g_APinDescription[pin].pPort, g_APinDescription[pin].ulPin) ;
176
+}
177
+
178
+static uint8_t u8g_sam_data_pin;
179
+static uint8_t u8g_sam_clock_pin;
180
+
181
+static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
182
+{
183
+  u8g_sam_data_pin = dataPin;
184
+  u8g_sam_clock_pin = clockPin;
185
+}
186
+
187
+static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
188
+{
189
+  uint8_t i = 8;
190
+  do
191
+  {
192
+    if ( val & 128 )
193
+      u8g_digital_write_sam_high(u8g_sam_data_pin);
194
+    else
195
+      u8g_digital_write_sam_low(u8g_sam_data_pin);
196
+    val <<= 1;
197
+    //u8g_MicroDelay();	
198
+    u8g_digital_write_sam_high(u8g_sam_clock_pin);
199
+    u8g_MicroDelay();	
200
+    u8g_digital_write_sam_low(u8g_sam_clock_pin);
201
+    u8g_MicroDelay();	
202
+    i--;
203
+  } while( i != 0 );
145 204
 }
146 205
 
206
+
147 207
 #else
148 208
 /* empty interface */
149 209
 
@@ -188,6 +248,8 @@ uint8_t u8g_com_arduino_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
188 248
         /* enable */
189 249
         u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
190 250
         u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
251
+	/* issue 227 */
252
+	u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
191 253
       }
192 254
       break;
193 255
 

+ 19
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_t6963.c Просмотреть файл

@@ -50,6 +50,13 @@
50 50
   u8g_InitRW8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset)
51 51
   u8g_InitRW8Bit(u8g, dev,  8,  9, 10, 11,  4,  5,  6,  7, 14, 15, 17, 18, 16)
52 52
 
53
+  Update for ATOMIC operation done (01 Jun 2013)
54
+    U8G_ATOMIC_OR(ptr, val)
55
+    U8G_ATOMIC_AND(ptr, val)
56
+    U8G_ATOMIC_START();
57
+    U8G_ATOMIC_END();
58
+ 
59
+
53 60
 */
54 61
 
55 62
 #include "u8g.h"
@@ -123,8 +130,10 @@ static void u8g_com_arduino_t6963_init(u8g_t *u8g)
123 130
   u8g_data_mask[7] =  digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);  
124 131
 }
125 132
 
133
+
126 134
 static void u8g_com_arduino_t6963_write_data_pin(uint8_t pin, uint8_t val)
127 135
 {
136
+  /* no ATOMIC protection required here, this is done by calling procedure */
128 137
   if ( val != 0 )
129 138
     *u8g_output_data_port[pin] |= u8g_data_mask[pin];
130 139
   else
@@ -134,6 +143,7 @@ static void u8g_com_arduino_t6963_write_data_pin(uint8_t pin, uint8_t val)
134 143
 static void u8g_com_arduino_t6963_set_port_output(void)
135 144
 {
136 145
   uint8_t i;
146
+  U8G_ATOMIC_START();
137 147
   for( i = 0; i < 8; i++ )
138 148
   {
139 149
 #if defined(__PIC32MX)
@@ -147,11 +157,13 @@ static void u8g_com_arduino_t6963_set_port_output(void)
147 157
 #endif
148 158
 
149 159
   }
160
+  U8G_ATOMIC_END();
150 161
 }
151 162
 
152 163
 static void u8g_com_arduino_t6963_set_port_input(void)
153 164
 {
154 165
   uint8_t i;
166
+  U8G_ATOMIC_START();
155 167
   for( i = 0; i < 8; i++ )
156 168
   {
157 169
 #if defined(__PIC32MX)
@@ -167,11 +179,14 @@ static void u8g_com_arduino_t6963_set_port_input(void)
167 179
       *u8g_output_data_port[i] &= ~u8g_data_mask[i]; 	// no pullup
168 180
 #endif
169 181
   }
182
+  U8G_ATOMIC_END();
170 183
 }
171 184
 
172 185
 
173 186
 static void u8g_com_arduino_t6963_write(u8g_t *u8g, uint8_t val)
174 187
 {
188
+  U8G_ATOMIC_START();
189
+
175 190
   u8g_com_arduino_t6963_write_data_pin( 0, val&1 );
176 191
   val >>= 1;
177 192
   u8g_com_arduino_t6963_write_data_pin( 1, val&1 );
@@ -189,6 +204,7 @@ static void u8g_com_arduino_t6963_write(u8g_t *u8g, uint8_t val)
189 204
   val >>= 1;
190 205
   u8g_com_arduino_t6963_write_data_pin( 7, val&1 );
191 206
   val >>= 1;
207
+  U8G_ATOMIC_END();
192 208
   
193 209
   u8g_com_arduino_digital_write(u8g, U8G_PI_WR, 0);
194 210
   u8g_MicroDelay(); /* 80ns, reference: t6963 datasheet */
@@ -203,6 +219,7 @@ static uint8_t u8g_com_arduino_t6963_read(u8g_t *u8g)
203 219
   u8g_com_arduino_digital_write(u8g, U8G_PI_RD, 0);
204 220
   u8g_MicroDelay(); /* 150ns, reference: t6963 datasheet */
205 221
   
222
+  U8G_ATOMIC_START();
206 223
   /* only read bits 0, 1 and 3 */
207 224
   if ( (*u8g_input_data_port[3] & u8g_data_mask[3]) != 0 )
208 225
     val++;
@@ -213,7 +230,8 @@ static uint8_t u8g_com_arduino_t6963_read(u8g_t *u8g)
213 230
   val <<= 1;
214 231
   if ( (*u8g_input_data_port[0] & u8g_data_mask[0]) != 0 )
215 232
     val++;
216
-    
233
+  U8G_ATOMIC_END();
234
+
217 235
   u8g_com_arduino_digital_write(u8g, U8G_PI_RD, 1);
218 236
   u8g_MicroDelay(); /* 10ns, reference: t6963 datasheet */
219 237
   

+ 206
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_arduino_uc_i2c.c Просмотреть файл

@@ -0,0 +1,206 @@
1
+/*
2
+  
3
+  u8g_com_arduino_uc_i2c.c
4
+
5
+  com interface for arduino (AND atmega) and the SSDxxxx chip (SOLOMON) variant 
6
+  I2C protocol 
7
+  
8
+  ToDo: Rename this to u8g_com_avr_ssd_i2c.c
9
+
10
+  Universal 8bit Graphics Library
11
+  
12
+  Copyright (c) 2012, olikraus@gmail.com
13
+  All rights reserved.
14
+
15
+  Redistribution and use in source and binary forms, with or without modification, 
16
+  are permitted provided that the following conditions are met:
17
+
18
+  * Redistributions of source code must retain the above copyright notice, this list 
19
+    of conditions and the following disclaimer.
20
+    
21
+  * Redistributions in binary form must reproduce the above copyright notice, this 
22
+    list of conditions and the following disclaimer in the documentation and/or other 
23
+    materials provided with the distribution.
24
+
25
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
26
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
27
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
28
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
29
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
30
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
31
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
32
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
33
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
34
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
35
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
36
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
37
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
38
+  
39
+  Special pin usage:
40
+    U8G_PI_I2C_OPTION	additional options
41
+    U8G_PI_A0_STATE	used to store the last value of the command/data register selection
42
+    U8G_PI_SET_A0		1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
43
+    U8G_PI_SCL		clock line (NOT USED)
44
+    U8G_PI_SDA		data line (NOT USED)
45
+    
46
+    U8G_PI_RESET		reset line (currently disabled, see below)
47
+
48
+  Protocol:
49
+    SLA, Cmd/Data Selection, Arguments
50
+    The command/data register is selected by a special instruction byte, which is sent after SLA
51
+    
52
+    The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
53
+*/
54
+
55
+#include "u8g.h"
56
+
57
+#if defined(U8G_WITH_PINLIST)
58
+
59
+#define DOGM240_SLA_CMD  (0x38*2)
60
+#define DOGM240_SLA_DATA (0x39*2)
61
+
62
+uint8_t u8g_com_arduino_uc_start_sequence(u8g_t *u8g)
63
+{
64
+  /* are we requested to set the a0 state? */
65
+  if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
66
+    return 1;
67
+
68
+  if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
69
+  {
70
+    if ( u8g_i2c_start(DOGM240_SLA_CMD) == 0 )
71
+      return 0;
72
+  }
73
+  else
74
+  {
75
+    if ( u8g_i2c_start(DOGM240_SLA_DATA) == 0 )
76
+      return 0;
77
+  }
78
+
79
+  u8g->pin_list[U8G_PI_SET_A0] = 0;
80
+  return 1;
81
+}
82
+
83
+uint8_t u8g_com_arduino_uc_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
84
+{
85
+  switch(msg)
86
+  {
87
+    case U8G_COM_MSG_INIT:
88
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
89
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
90
+      //u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: unknown mode */
91
+    
92
+      u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
93
+
94
+      break;
95
+    
96
+    case U8G_COM_MSG_STOP:
97
+      break;
98
+
99
+    case U8G_COM_MSG_RESET:
100
+      /* Currently disabled, but it could be enable. Previous restrictions have been removed */
101
+      /* u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); */
102
+      break;
103
+      
104
+    case U8G_COM_MSG_CHIP_SELECT:
105
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;
106
+      u8g->pin_list[U8G_PI_SET_A0] = 1;		/* force a0 to set again, also forces start condition */
107
+      if ( arg_val == 0 )
108
+      {
109
+        /* disable chip, send stop condition */
110
+	u8g_i2c_stop();
111
+     }
112
+      else
113
+      {
114
+        /* enable, do nothing: any byte writing will trigger the i2c start */
115
+      }
116
+      break;
117
+
118
+    case U8G_COM_MSG_WRITE_BYTE:
119
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
120
+      if ( u8g_com_arduino_uc_start_sequence(u8g) == 0 )
121
+	return u8g_i2c_stop(), 0;
122
+      if ( u8g_i2c_send_byte(arg_val) == 0 )
123
+	return u8g_i2c_stop(), 0;
124
+      // u8g_i2c_stop();
125
+      break;
126
+    
127
+    case U8G_COM_MSG_WRITE_SEQ:
128
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
129
+      if ( u8g_com_arduino_uc_start_sequence(u8g) == 0 )
130
+	return u8g_i2c_stop(), 0;
131
+      {
132
+        register uint8_t *ptr = arg_ptr;
133
+        while( arg_val > 0 )
134
+        {
135
+	  if ( u8g_i2c_send_byte(*ptr++) == 0 )
136
+	    return u8g_i2c_stop(), 0;
137
+          arg_val--;
138
+        }
139
+      }
140
+      // u8g_i2c_stop();
141
+      break;
142
+
143
+    case U8G_COM_MSG_WRITE_SEQ_P:
144
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
145
+      if ( u8g_com_arduino_uc_start_sequence(u8g) == 0 )
146
+	return u8g_i2c_stop(), 0;
147
+      {
148
+        register uint8_t *ptr = arg_ptr;
149
+        while( arg_val > 0 )
150
+        {
151
+	  if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 )
152
+	    return 0;
153
+          ptr++;
154
+          arg_val--;
155
+        }
156
+      }
157
+      // u8g_i2c_stop();
158
+      break;
159
+      
160
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
161
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
162
+      u8g->pin_list[U8G_PI_SET_A0] = 1;		/* force a0 to set again */
163
+    
164
+#ifdef OLD_CODE    
165
+      if ( i2c_state != 0 )
166
+      {
167
+	u8g_i2c_stop();
168
+	i2c_state = 0;
169
+      }
170
+
171
+      if ( u8g_com_arduino_uc_start_sequence(arg_val) == 0 )
172
+	return 0;
173
+    
174
+      /* setup bus, might be a repeated start */
175
+      /*
176
+      if ( u8g_i2c_start(I2C_SLA) == 0 )
177
+	return 0;
178
+      if ( arg_val == 0 )
179
+      {
180
+	i2c_state = 1;
181
+	
182
+	if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
183
+	  return 0;
184
+      }
185
+      else
186
+      {
187
+	i2c_state = 2;
188
+	if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
189
+	  return 0;
190
+      }
191
+      */
192
+#endif
193
+      break;
194
+  }
195
+  return 1;
196
+}
197
+
198
+#else  /* defined(U8G_WITH_PINLIST) */
199
+
200
+uint8_t u8g_com_arduino_uc_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
201
+{
202
+  return 1;
203
+}
204
+
205
+#endif /* defined(U8G_WITH_PINLIST) */
206
+

+ 14
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_atmega_hw_spi.c Просмотреть файл

@@ -37,6 +37,14 @@
37 37
   and
38 38
     SCK is at PORTB, Pin 5
39 39
 
40
+  Update for ATOMIC operation done (01 Jun 2013)
41
+    U8G_ATOMIC_OR(ptr, val)
42
+    U8G_ATOMIC_AND(ptr, val)
43
+    U8G_ATOMIC_START()
44
+    U8G_ATOMIC_END()
45
+ 
46
+
47
+
40 48
 */
41 49
 
42 50
 #include "u8g.h"
@@ -85,6 +93,9 @@ uint8_t u8g_com_atmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
85 93
 
86 94
       u8g_SetPIOutput(u8g, U8G_PI_CS);
87 95
       u8g_SetPIOutput(u8g, U8G_PI_A0);
96
+      u8g_SetPIOutput(u8g, U8G_PI_RESET);
97
+      
98
+      U8G_ATOMIC_START();
88 99
       
89 100
       DDRB |= _BV(3);          /* D0, MOSI */
90 101
       DDRB |= _BV(5);          /* SCK */
@@ -92,6 +103,9 @@ uint8_t u8g_com_atmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
92 103
     
93 104
       PORTB &= ~_BV(3);        /* D0, MOSI = 0 */
94 105
       PORTB &= ~_BV(5);        /* SCK = 0 */
106
+      
107
+      U8G_ATOMIC_END();
108
+      
95 109
       u8g_SetPILevel(u8g, U8G_PI_CS, 1);
96 110
 
97 111
       /*

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_atmega_parallel.c Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 /*
2 2
   
3
-  u8g_atmega_parallel.c
3
+  u8g_com_atmega_parallel.c
4 4
 
5 5
   Universal 8bit Graphics Library
6 6
   

+ 12
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_atmega_st7920_hw_spi.c Просмотреть файл

@@ -38,6 +38,12 @@
38 38
   and
39 39
     SCK is at PORTB, Pin 5
40 40
 
41
+  Update for ATOMIC operation done (01 Jun 2013)
42
+    U8G_ATOMIC_OR(ptr, val)
43
+    U8G_ATOMIC_AND(ptr, val)
44
+    U8G_ATOMIC_START()
45
+    U8G_ATOMIC_END()
46
+ 
41 47
 
42 48
 */
43 49
 
@@ -106,12 +112,16 @@ uint8_t u8g_com_atmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val
106 112
       u8g_SetPIOutput(u8g, U8G_PI_CS);
107 113
       //u8g_SetPIOutput(u8g, U8G_PI_A0);
108 114
       
115
+      U8G_ATOMIC_START();
116
+      
109 117
       DDRB |= _BV(3);          /* D0, MOSI */
110 118
       DDRB |= _BV(5);          /* SCK */
111 119
       DDRB |= _BV(2);		/* slave select */
112 120
     
113 121
       PORTB &= ~_BV(3);        /* D0, MOSI = 0 */
114 122
       PORTB &= ~_BV(5);        /* SCK = 0 */
123
+      U8G_ATOMIC_END();
124
+      
115 125
       u8g_SetPILevel(u8g, U8G_PI_CS, 1);
116 126
 
117 127
       /*
@@ -125,7 +135,8 @@ uint8_t u8g_com_atmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val
125 135
       
126 136
       /* maybe set CPOL and CPHA to 1 */
127 137
       /* 20 Dez 2012: did set CPOL and CPHA to 1 in Arduino variant! */
128
-      SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);
138
+      /* 24 Jan 2014: implemented, see also issue 221 */
139
+      SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);
129 140
 #ifdef U8G_HW_SPI_2X
130 141
       SPSR = (1 << SPI2X);  /* double speed, issue 89 */
131 142
 #endif

+ 408
- 15
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_i2c.c Просмотреть файл

@@ -35,10 +35,13 @@
35 35
   
36 36
 */
37 37
 
38
+
38 39
 #include "u8g.h"
39 40
 
40
-static uint8_t u8g_i2c_err_code;
41
+//#define U8G_I2C_WITH_NO_ACK
41 42
 
43
+static uint8_t u8g_i2c_err_code;
44
+static uint8_t u8g_i2c_opt;		/* U8G_I2C_OPT_NO_ACK, SAM: U8G_I2C_OPT_DEV_1 */
42 45
 /*
43 46
   position values
44 47
     1: start condition
@@ -115,10 +118,22 @@ void u8g_i2c_init(uint8_t options)
115 118
     TWSR = 0;
116 119
 	--> 100KHz
117 120
 
121
+    TWBR = 12;
122
+    TWSR = 0;
123
+	--> 400KHz
124
+
118 125
     F_CPU/(2*100000)-8  --> calculate TWBR value for 100KHz
119 126
 */
127
+  u8g_i2c_opt = options;
120 128
   TWSR = 0;
121
-  TWBR = F_CPU/(2*100000)-8;
129
+  if ( options & U8G_I2C_OPT_FAST )
130
+  {
131
+    TWBR = F_CPU/(2*400000)-8;
132
+  }
133
+  else
134
+  {  
135
+    TWBR = F_CPU/(2*100000)-8;
136
+  }
122 137
   u8g_i2c_clear_error();
123 138
 }
124 139
 
@@ -129,8 +144,15 @@ uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos)
129 144
   {
130 145
       if ( cnt == 0 )
131 146
       {
132
-	u8g_i2c_set_error(U8G_I2C_ERR_TIMEOUT, pos);
133
-	return 0; /* error */
147
+	if ( u8g_i2c_opt & U8G_I2C_OPT_NO_ACK )
148
+	{
149
+	  return 1;	/* all ok */
150
+	}
151
+	else
152
+	{
153
+	  u8g_i2c_set_error(U8G_I2C_ERR_TIMEOUT, pos);
154
+	  return 0; /* error */
155
+	}
134 156
       }
135 157
       cnt--;
136 158
     }
@@ -167,13 +189,20 @@ uint8_t u8g_i2c_start(uint8_t sla)
167 189
   /* wait */
168 190
   if ( u8g_i2c_wait(_BV(TWINT), 2) == 0 )
169 191
     return 0;
170
-  status = TW_STATUS;
171 192
 
172
-  /* check status after sla */  
173
-  if ( status != TW_MT_SLA_ACK )
193
+  if ( u8g_i2c_opt & U8G_I2C_OPT_NO_ACK )
174 194
   {
175
-    u8g_i2c_set_error(U8G_I2C_ERR_BUS, 2);
176
-    return 0;
195
+    /* do not check for ACK */
196
+  }
197
+  else
198
+  {
199
+    status = TW_STATUS;
200
+    /* check status after sla */  
201
+    if ( status != TW_MT_SLA_ACK )
202
+    {
203
+      u8g_i2c_set_error(U8G_I2C_ERR_BUS, 2);
204
+      return 0;
205
+    }
177 206
   }
178 207
 
179 208
    return 1;
@@ -186,14 +215,21 @@ uint8_t u8g_i2c_send_byte(uint8_t data)
186 215
   TWCR = _BV(TWINT)  |  _BV(TWEN);
187 216
   if ( u8g_i2c_wait(_BV(TWINT), 3) == 0 )
188 217
     return 0;
189
-  status = TW_STATUS;
190
-  
191
-  if ( status != TW_MT_DATA_ACK )
218
+    
219
+  if ( u8g_i2c_opt & U8G_I2C_OPT_NO_ACK )
192 220
   {
193
-    u8g_i2c_set_error(U8G_I2C_ERR_BUS, 3);
194
-    return 0;
221
+    /* do not check for ACK */
195 222
   }
196
-  
223
+  else
224
+  {
225
+    status = TW_STATUS;  
226
+    if ( status != TW_MT_DATA_ACK )
227
+    {
228
+      u8g_i2c_set_error(U8G_I2C_ERR_BUS, 3);
229
+      return 0;
230
+    }
231
+  }
232
+
197 233
   return 1;  
198 234
 }
199 235
 
@@ -217,6 +253,363 @@ void twi_send(uint8_t adr, uint8_t data1, uint8_t data2)
217 253
 }
218 254
 */
219 255
 
256
+#elif defined(ARDUINO) && defined(__SAM3X8E__)
257
+/* Arduino Due */
258
+#include "Arduino.h"
259
+#include "sam.h"
260
+
261
+/*
262
+
263
+Controller
264
+
265
+TWI0 TWCK0 PA18 A			DUE PCB: SCL1
266
+TWI0 TWD0 PA17 A			DUE PCB: SDA1 
267
+TWI1 TWCK1 PB13 A			DUE PCB: SCL 21
268
+TWI1 TWD1 PB12 A			DUE PCB: SDA 20
269
+
270
+Arduino definitions
271
+
272
+#define PIN_WIRE_SDA         (20u)
273
+#define PIN_WIRE_SCL         (21u)
274
+#define WIRE_INTERFACE       TWI1
275
+#define WIRE_INTERFACE_ID    ID_TWI1
276
+#define WIRE_ISR_HANDLER     TWI1_Handler
277
+
278
+#define PIN_WIRE1_SDA        (70u)
279
+#define PIN_WIRE1_SCL        (71u)
280
+#define WIRE1_INTERFACE      TWI0
281
+#define WIRE1_INTERFACE_ID   ID_TWI0
282
+#define WIRE1_ISR_HANDLER    TWI0_Handler
283
+
284
+
285
+*/
286
+
287
+static void i2c_400KHz_delay(void)
288
+{
289
+  /* should be at least 4 */
290
+  /* should be 5 for 100KHz transfer speed */
291
+ 
292
+  
293
+  /*
294
+    Arduino Due
295
+    0x NOP: 470KHz
296
+    4x NOP: 450KHz
297
+    8x NOP: 430KHz
298
+    16x NOP: 400KHz
299
+  */
300
+  
301
+  __NOP();
302
+  __NOP();
303
+  __NOP();
304
+  __NOP();
305
+  
306
+  __NOP();
307
+  __NOP();
308
+  __NOP();
309
+  __NOP();
310
+
311
+  __NOP();
312
+  __NOP();
313
+  __NOP();
314
+  __NOP();
315
+
316
+  __NOP();
317
+  __NOP();
318
+  __NOP();
319
+  __NOP();
320
+}
321
+
322
+static void i2c_100KHz_delay(void)
323
+{
324
+  /* 
325
+    1x u8g_MicroDelay()	ca. 130KHz
326
+    2x u8g_MicroDelay()	ca. 80KHz 
327
+  */
328
+  u8g_MicroDelay();
329
+  u8g_MicroDelay();  
330
+}
331
+
332
+
333
+uint32_t i2c_started = 0;
334
+uint32_t i2c_scl_pin = 0;
335
+uint32_t i2c_sda_pin = 0;
336
+void (*i2c_delay)(void) = i2c_100KHz_delay;
337
+
338
+const PinDescription *i2c_scl_pin_desc;
339
+const PinDescription *i2c_sda_pin_desc;
340
+
341
+
342
+/* maybe this can be optimized */
343
+static void i2c_init(void)
344
+{
345
+  i2c_sda_pin_desc = &(g_APinDescription[i2c_sda_pin]);
346
+  i2c_scl_pin_desc = &(g_APinDescription[i2c_scl_pin]);
347
+  pinMode(i2c_sda_pin, OUTPUT);
348
+  digitalWrite(i2c_sda_pin, HIGH);
349
+  pinMode(i2c_scl_pin, OUTPUT);
350
+  digitalWrite(i2c_scl_pin, HIGH);
351
+  PIO_Configure( i2c_sda_pin_desc->pPort, PIO_OUTPUT_0, i2c_sda_pin_desc->ulPin, PIO_OPENDRAIN );
352
+  PIO_Configure( i2c_scl_pin_desc->pPort, PIO_OUTPUT_0, i2c_scl_pin_desc->ulPin, PIO_OPENDRAIN );
353
+  PIO_Clear( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin) ;
354
+  PIO_Clear( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin) ;
355
+  PIO_Configure( i2c_sda_pin_desc->pPort, PIO_INPUT, i2c_sda_pin_desc->ulPin, PIO_DEFAULT ) ;
356
+  PIO_Configure( i2c_scl_pin_desc->pPort, PIO_INPUT, i2c_scl_pin_desc->ulPin, PIO_DEFAULT ) ;
357
+  i2c_delay();
358
+}
359
+
360
+/* actually, the scl line is not observed, so this procedure does not return a value */
361
+static void i2c_read_scl_and_delay(void)
362
+{
363
+  uint32_t dwMask = i2c_scl_pin_desc->ulPin;
364
+  //PIO_Configure( i2c_scl_pin_desc->pPort, PIO_INPUT, i2c_scl_pin_desc->ulPin, PIO_DEFAULT ) ;
365
+  //PIO_SetInput( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin, PIO_DEFAULT ) ;
366
+
367
+  /* set as input */
368
+  i2c_scl_pin_desc->pPort->PIO_ODR = dwMask ;
369
+  i2c_scl_pin_desc->pPort->PIO_PER = dwMask ;
370
+
371
+  i2c_delay();
372
+}
373
+
374
+static void i2c_clear_scl(void)
375
+{
376
+  uint32_t dwMask = i2c_scl_pin_desc->ulPin;
377
+  
378
+  /* set open collector and drive low */
379
+  //PIO_Configure( i2c_scl_pin_desc->pPort, PIO_OUTPUT_0, i2c_scl_pin_desc->ulPin, PIO_OPENDRAIN );
380
+  //PIO_SetOutput( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin, 0, 1, 0);
381
+
382
+  /* open drain, zero default output */
383
+  i2c_scl_pin_desc->pPort->PIO_MDER = dwMask;
384
+  i2c_scl_pin_desc->pPort->PIO_CODR = dwMask;
385
+  i2c_scl_pin_desc->pPort->PIO_OER = dwMask;
386
+  i2c_scl_pin_desc->pPort->PIO_PER = dwMask;
387
+
388
+  //PIO_Clear( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin) ;
389
+}
390
+
391
+static uint8_t i2c_read_sda(void)
392
+{
393
+  uint32_t dwMask = i2c_sda_pin_desc->ulPin;
394
+  //PIO_Configure( i2c_sda_pin_desc->pPort, PIO_INPUT, i2c_sda_pin_desc->ulPin, PIO_DEFAULT ) ;
395
+  //PIO_SetInput( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin, PIO_DEFAULT ) ;
396
+
397
+  /* set as input */
398
+  i2c_sda_pin_desc->pPort->PIO_ODR = dwMask ;
399
+  i2c_sda_pin_desc->pPort->PIO_PER = dwMask ;
400
+
401
+
402
+  return 1;
403
+}
404
+
405
+static void i2c_clear_sda(void)
406
+{
407
+  uint32_t dwMask = i2c_sda_pin_desc->ulPin;
408
+  
409
+  /* set open collector and drive low */
410
+  //PIO_Configure( i2c_sda_pin_desc->pPort, PIO_OUTPUT_0, i2c_sda_pin_desc->ulPin, PIO_OPENDRAIN );
411
+  //PIO_SetOutput( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin, 0, 1, 0);
412
+  
413
+  /* open drain, zero default output */
414
+  i2c_sda_pin_desc->pPort->PIO_MDER = dwMask ;
415
+  i2c_sda_pin_desc->pPort->PIO_CODR = dwMask ;
416
+  i2c_sda_pin_desc->pPort->PIO_OER = dwMask ;
417
+  i2c_sda_pin_desc->pPort->PIO_PER = dwMask ;
418
+  
419
+  //PIO_Clear( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin) ;
420
+}
421
+
422
+static void i2c_start(void)
423
+{
424
+  if ( i2c_started != 0 )
425
+  {
426
+    /* if already started: do restart */
427
+    i2c_read_sda();     /* SDA = 1 */
428
+    i2c_delay();
429
+    i2c_read_scl_and_delay();
430
+  }
431
+  i2c_read_sda();
432
+  /*
433
+  if (i2c_read_sda() == 0)
434
+  {
435
+    // do something because arbitration is lost
436
+  }
437
+  */
438
+  /* send the start condition, both lines go from 1 to 0 */
439
+  i2c_clear_sda();
440
+  i2c_delay();
441
+  i2c_clear_scl();
442
+  i2c_started = 1;
443
+}
444
+
445
+
446
+static void i2c_stop(void)
447
+{
448
+  /* set SDA to 0 */
449
+  i2c_clear_sda();  
450
+  i2c_delay();
451
+ 
452
+  /* now release all lines */
453
+  i2c_read_scl_and_delay();
454
+ 
455
+  /* set SDA to 1 */
456
+  i2c_read_sda();
457
+  i2c_delay();
458
+  i2c_started = 0;
459
+}
460
+
461
+static void i2c_write_bit(uint8_t val)
462
+{
463
+  if (val)
464
+    i2c_read_sda();
465
+  else
466
+    i2c_clear_sda();
467
+ 
468
+  i2c_delay();
469
+  i2c_read_scl_and_delay();
470
+  i2c_clear_scl();
471
+}
472
+
473
+static uint8_t i2c_read_bit(void)
474
+{
475
+  uint8_t val;
476
+  /* do not drive SDA */
477
+  i2c_read_sda();
478
+  i2c_delay();
479
+  i2c_read_scl_and_delay();
480
+  val = i2c_read_sda();
481
+  i2c_delay();
482
+  i2c_clear_scl();
483
+  return val;
484
+}
485
+
486
+static uint8_t i2c_write_byte(uint8_t b)
487
+{
488
+  i2c_write_bit(b & 128);
489
+  i2c_write_bit(b & 64);
490
+  i2c_write_bit(b & 32);
491
+  i2c_write_bit(b & 16);
492
+  i2c_write_bit(b & 8);
493
+  i2c_write_bit(b & 4);
494
+  i2c_write_bit(b & 2);
495
+  i2c_write_bit(b & 1);
496
+    
497
+  /* read ack from client */
498
+  /* 0: ack was given by client */
499
+  /* 1: nothing happend during ack cycle */  
500
+  return i2c_read_bit();
501
+}
502
+
503
+
504
+
505
+void u8g_i2c_init(uint8_t options)
506
+{
507
+  u8g_i2c_opt = options;
508
+  u8g_i2c_clear_error();
509
+
510
+  if ( u8g_i2c_opt & U8G_I2C_OPT_FAST )
511
+  {
512
+    i2c_delay = i2c_400KHz_delay;
513
+  }
514
+  else
515
+  {
516
+    i2c_delay = i2c_100KHz_delay;
517
+  }
518
+
519
+
520
+  if ( u8g_i2c_opt & U8G_I2C_OPT_DEV_1 )
521
+  {
522
+    i2c_scl_pin = PIN_WIRE1_SCL;
523
+    i2c_sda_pin = PIN_WIRE1_SDA;
524
+    
525
+    //REG_PIOA_PDR = PIO_PB12A_TWD1 | PIO_PB13A_TWCK1;
526
+  }
527
+  else
528
+  {    
529
+    
530
+    i2c_scl_pin = PIN_WIRE_SCL;
531
+    i2c_sda_pin = PIN_WIRE_SDA;
532
+    
533
+    //REG_PIOA_PDR = PIO_PA17A_TWD0 | PIO_PA18A_TWCK0;
534
+  }
535
+  
536
+  i2c_init();
537
+
538
+}
539
+
540
+/* sla includes also the r/w bit */
541
+uint8_t u8g_i2c_start(uint8_t sla)
542
+{  
543
+  i2c_start();
544
+  i2c_write_byte(sla);
545
+  return 1;
546
+}
547
+
548
+uint8_t u8g_i2c_send_byte(uint8_t data)
549
+{
550
+  return i2c_write_byte(data);
551
+}
552
+
553
+void u8g_i2c_stop(void)
554
+{
555
+  i2c_stop();
556
+}
557
+
558
+
559
+#elif defined(U8G_RASPBERRY_PI)
560
+
561
+#include <wiringPi.h>
562
+#include <wiringPiI2C.h>
563
+#include <stdio.h>
564
+#include <stdlib.h>
565
+#include <errno.h>
566
+
567
+#define I2C_SLA         0x3c
568
+
569
+static int fd=-1;
570
+static uint8_t i2cMode = 0;
571
+
572
+void u8g_i2c_init(uint8_t options) {
573
+   u8g_i2c_clear_error();
574
+   u8g_i2c_opt = options;
575
+
576
+   if (wiringPiSetup() == -1) {
577
+      printf("wiringPi-Error\n");
578
+      exit(1);
579
+   }
580
+
581
+   fd = wiringPiI2CSetup(I2C_SLA);
582
+   if (fd < 0) {
583
+      printf ("Unable to open I2C device 0: %s\n", strerror (errno)) ;
584
+      exit (1) ;
585
+   }
586
+   //u8g_SetPIOutput(u8g, U8G_PI_RESET);
587
+   //u8g_SetPIOutput(u8g, U8G_PI_A0);
588
+}
589
+uint8_t u8g_i2c_start(uint8_t sla) {
590
+   u8g_i2c_send_mode(0);
591
+
592
+   return 1;
593
+}
594
+
595
+void u8g_i2c_stop(void) {
596
+}
597
+
598
+uint8_t u8g_i2c_send_mode(uint8_t mode) {
599
+   i2cMode = mode;
600
+} 
601
+
602
+uint8_t u8g_i2c_send_byte(uint8_t data) {
603
+   wiringPiI2CWriteReg8(fd, i2cMode, data);
604
+
605
+   return 1;
606
+}
607
+
608
+uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos)
609
+{
610
+  return 1;
611
+}
612
+
220 613
 #else
221 614
 
222 615
 /* empty interface */

+ 58
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_io.c Просмотреть файл

@@ -32,7 +32,19 @@
32 32
   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
33 33
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
34 34
   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
35
-  
35
+
36
+  Update for ATOMIC operation done (01 Jun 2013)
37
+    U8G_ATOMIC_OR(ptr, val)
38
+    U8G_ATOMIC_AND(ptr, val)
39
+    U8G_ATOMIC_START();
40
+    U8G_ATOMIC_END();
41
+
42
+  uint8_t u8g_Pin(uint8_t port, uint8_t bitpos)						Convert to internal number: AVR: port*8+bitpos, ARM: port*16+bitpos
43
+  void u8g_SetPinOutput(uint8_t internal_pin_number)
44
+  void u8g_SetPinInput(uint8_t internal_pin_number)
45
+  void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level)
46
+  uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
47
+
36 48
 
37 49
 */
38 50
 
@@ -159,9 +171,16 @@ void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level)
159 171
   volatile uint8_t * tmp = u8g_get_avr_io_ptr(u8g_avr_port_P, internal_pin_number>>3);
160 172
   
161 173
   if ( level == 0 )
162
-    *tmp &= ~_BV(internal_pin_number&7);
174
+  {
175
+    U8G_ATOMIC_AND(tmp, ~_BV(internal_pin_number&7));
176
+   // *tmp &= ~_BV(internal_pin_number&7);
177
+  }
163 178
   else
164
-    *tmp |= _BV(internal_pin_number&7);
179
+  {
180
+    U8G_ATOMIC_OR(tmp, _BV(internal_pin_number&7));
181
+    //*tmp |= _BV(internal_pin_number&7);
182
+  }
183
+  
165 184
 }
166 185
 
167 186
 uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
@@ -172,8 +191,31 @@ uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
172 191
   return 0;
173 192
 }
174 193
 
194
+#elif defined(U8G_RASPBERRY_PI)
195
+
196
+#include <wiringPi.h>
197
+//#include "/usr/local/include/wiringPi.h"
198
+
199
+void u8g_SetPinOutput(uint8_t internal_pin_number) {
200
+   pinMode(internal_pin_number, OUTPUT);
201
+}
202
+
203
+void u8g_SetPinInput(uint8_t internal_pin_number) {
204
+   pinMode(internal_pin_number, INPUT);
205
+}
206
+
207
+void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level) {
208
+   digitalWrite(internal_pin_number, level);
209
+}
210
+
211
+uint8_t u8g_GetPinLevel(uint8_t internal_pin_number) {
212
+   return digitalRead(internal_pin_number);
213
+}
214
+
215
+
175 216
 #else
176 217
 
218
+/* convert "port" and "bitpos" to internal pin number */
177 219
 uint8_t u8g_Pin(uint8_t port, uint8_t bitpos)
178 220
 {
179 221
   port <<= 3;
@@ -201,6 +243,8 @@ uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
201 243
 #endif
202 244
 
203 245
 
246
+#if defined(U8G_WITH_PINLIST)
247
+
204 248
 void u8g_SetPIOutput(u8g_t *u8g, uint8_t pi)
205 249
 {
206 250
   uint8_t pin;
@@ -216,3 +260,14 @@ void u8g_SetPILevel(u8g_t *u8g, uint8_t pi, uint8_t level)
216 260
   if ( pin != U8G_PIN_NONE )
217 261
     u8g_SetPinLevel(pin, level);
218 262
 }
263
+
264
+#else  /* defined(U8G_WITH_PINLIST) */
265
+void u8g_SetPIOutput(u8g_t *u8g, uint8_t pi)
266
+{
267
+}
268
+
269
+void u8g_SetPILevel(u8g_t *u8g, uint8_t pi, uint8_t level)
270
+{
271
+}
272
+
273
+#endif /* defined(U8G_WITH_PINLIST) */

+ 124
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_raspberrypi_hw_spi.c Просмотреть файл

@@ -0,0 +1,124 @@
1
+/*
2
+  
3
+  u8g_com_raspberrypi_hw_spi.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2012, olikraus@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+  
34
+  
35
+  Assumes, that 
36
+    MOSI is at PORTB, Pin 3
37
+  and
38
+    SCK is at PORTB, Pin 5
39
+
40
+  Update for ATOMIC operation done (01 Jun 2013)
41
+    U8G_ATOMIC_OR(ptr, val)
42
+    U8G_ATOMIC_AND(ptr, val)
43
+    U8G_ATOMIC_START()
44
+    U8G_ATOMIC_END()
45
+ 
46
+
47
+
48
+*/
49
+
50
+#include "u8g.h"
51
+
52
+
53
+
54
+#if defined(U8G_RASPBERRY_PI)
55
+
56
+#include <wiringPiSPI.h>
57
+#include <wiringPi.h>
58
+#include <stdio.h>
59
+#include <stdlib.h>
60
+#include <errno.h>
61
+
62
+uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
63
+{
64
+  switch(msg)
65
+  {
66
+    case U8G_COM_MSG_STOP:
67
+      break;
68
+    
69
+    case U8G_COM_MSG_INIT:
70
+		// check wiringPi setup
71
+		if (wiringPiSetup() == -1)
72
+		{
73
+			printf("wiringPi-Error\n");
74
+			exit(1);
75
+		}
76
+
77
+		if (wiringPiSPISetup (0, 100000) < 0)
78
+		{
79
+			printf ("Unable to open SPI device 0: %s\n", strerror (errno)) ;
80
+			exit (1) ;
81
+		}
82
+		
83
+		u8g_SetPIOutput(u8g, U8G_PI_RESET);
84
+		u8g_SetPIOutput(u8g, U8G_PI_A0);
85
+
86
+      break;
87
+    
88
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
89
+	  u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
90
+      break;
91
+
92
+    case U8G_COM_MSG_CHIP_SELECT:
93
+		/* Done by the SPI hardware */
94
+      break;
95
+      
96
+    case U8G_COM_MSG_RESET:
97
+      u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
98
+      break;
99
+    
100
+    case U8G_COM_MSG_WRITE_BYTE:
101
+		wiringPiSPIDataRW (0, &arg_val, 1) ;
102
+      break;
103
+    
104
+    case U8G_COM_MSG_WRITE_SEQ:
105
+		wiringPiSPIDataRW (0, arg_ptr, arg_val);
106
+      break;
107
+
108
+	case U8G_COM_MSG_WRITE_SEQ_P:
109
+		wiringPiSPIDataRW (0, arg_ptr, arg_val);		
110
+      break;
111
+  }
112
+  return 1;
113
+}
114
+
115
+#else
116
+
117
+uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
118
+{
119
+  return 1;
120
+}
121
+
122
+#endif
123
+
124
+

+ 176
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_com_raspberrypi_ssd_i2c.c Просмотреть файл

@@ -0,0 +1,176 @@
1
+/*  
2
+  Special pin usage:
3
+    U8G_PI_I2C_OPTION	additional options
4
+    U8G_PI_A0_STATE	used to store the last value of the command/data register selection
5
+    U8G_PI_SET_A0		1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
6
+    U8G_PI_SCL		clock line (NOT USED)
7
+    U8G_PI_SDA		data line (NOT USED)
8
+    
9
+    U8G_PI_RESET		reset line (currently disabled, see below)
10
+
11
+  Protocol:
12
+    SLA, Cmd/Data Selection, Arguments
13
+    The command/data register is selected by a special instruction byte, which is sent after SLA
14
+    
15
+    The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
16
+*/
17
+
18
+#include "u8g.h"
19
+
20
+#if defined(U8G_RASPBERRY_PI)
21
+
22
+#include <wiringPi.h>
23
+#include <wiringPiI2C.h>
24
+#include <stdio.h>
25
+#include <stdlib.h>
26
+#include <errno.h>
27
+
28
+#define I2C_SLA		0x3c
29
+#define I2C_CMD_MODE	0x000
30
+#define I2C_DATA_MODE	0x040
31
+
32
+#if defined(U8G_WITH_PINLIST)
33
+
34
+uint8_t u8g_com_raspberrypi_ssd_start_sequence(u8g_t *u8g)
35
+{
36
+  /* are we requested to set the a0 state? */
37
+  if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
38
+    return 1;	
39
+  
40
+  /* setup bus, might be a repeated start */
41
+  if ( u8g_i2c_start(I2C_SLA) == 0 )
42
+    return 0;
43
+  if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
44
+  {
45
+    if ( u8g_i2c_send_mode(I2C_CMD_MODE) == 0 )
46
+      return 0;
47
+  }
48
+  else
49
+  {
50
+    if ( u8g_i2c_send_mode(I2C_DATA_MODE) == 0 )
51
+      return 0;
52
+  }
53
+  
54
+  
55
+  u8g->pin_list[U8G_PI_SET_A0] = 0;
56
+  return 1;
57
+}
58
+
59
+uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
60
+{
61
+  switch(msg)
62
+  {
63
+    case U8G_COM_MSG_INIT:
64
+      u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
65
+      u8g_SetPIOutput(u8g, U8G_PI_RESET);
66
+      u8g_SetPIOutput(u8g, U8G_PI_A0);
67
+      break;
68
+    
69
+    case U8G_COM_MSG_STOP:
70
+      break;
71
+
72
+    case U8G_COM_MSG_RESET:
73
+      break;
74
+      
75
+    case U8G_COM_MSG_CHIP_SELECT:
76
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;
77
+      u8g->pin_list[U8G_PI_SET_A0] = 1;		/* force a0 to set again, also forces start condition */
78
+      if ( arg_val == 0 )
79
+      {
80
+        /* disable chip, send stop condition */
81
+	u8g_i2c_stop();
82
+     }
83
+      else
84
+      {
85
+        /* enable, do nothing: any byte writing will trigger the i2c start */
86
+      }
87
+      break;
88
+
89
+    case U8G_COM_MSG_WRITE_BYTE:
90
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
91
+      if ( u8g_com_raspberrypi_ssd_start_sequence(u8g) == 0 )
92
+	return u8g_i2c_stop(), 0;
93
+      if ( u8g_i2c_send_byte(arg_val) == 0 )
94
+	return u8g_i2c_stop(), 0;
95
+      // u8g_i2c_stop();
96
+      break;
97
+    
98
+    case U8G_COM_MSG_WRITE_SEQ:
99
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
100
+      if ( u8g_com_raspberrypi_ssd_start_sequence(u8g) == 0 )
101
+	return u8g_i2c_stop(), 0;
102
+      {
103
+        register uint8_t *ptr = (uint8_t *)arg_ptr;
104
+        while( arg_val > 0 )
105
+        {
106
+	  if ( u8g_i2c_send_byte(*ptr++) == 0 )
107
+	    return u8g_i2c_stop(), 0;
108
+          arg_val--;
109
+        }
110
+      }
111
+      // u8g_i2c_stop();
112
+      break;
113
+
114
+    case U8G_COM_MSG_WRITE_SEQ_P:
115
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
116
+      if ( u8g_com_raspberrypi_ssd_start_sequence(u8g) == 0 )
117
+	return u8g_i2c_stop(), 0;
118
+      {
119
+        register uint8_t *ptr = (uint8_t *)arg_ptr;
120
+        while( arg_val > 0 )
121
+        {
122
+	  if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 )
123
+	    return 0;
124
+          ptr++;
125
+          arg_val--;
126
+        }
127
+      }
128
+      // u8g_i2c_stop();
129
+      break;
130
+      
131
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
132
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
133
+      u8g->pin_list[U8G_PI_SET_A0] = 1;		/* force a0 to set again */
134
+    
135
+#ifdef OLD_CODE    
136
+      if ( i2c_state != 0 )
137
+      {
138
+	u8g_i2c_stop();
139
+	i2c_state = 0;
140
+      }
141
+
142
+      if ( u8g_com_raspberrypi_ssd_start_sequence(arg_val) == 0 )
143
+	return 0;
144
+    
145
+      /* setup bus, might be a repeated start */
146
+      /*
147
+      if ( u8g_i2c_start(I2C_SLA) == 0 )
148
+	return 0;
149
+      if ( arg_val == 0 )
150
+      {
151
+	i2c_state = 1;
152
+	
153
+	if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
154
+	  return 0;
155
+      }
156
+      else
157
+      {
158
+	i2c_state = 2;
159
+	if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
160
+	  return 0;
161
+      }
162
+      */
163
+#endif
164
+      break;
165
+  }
166
+  return 1;
167
+}
168
+
169
+#else	/* defined(U8G_WITH_PINLIST) */
170
+
171
+uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
172
+   return 1;
173
+}
174
+
175
+#endif	/* defined(U8G_WITH_PINLIST) */
176
+#endif

+ 49
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_delay.c Просмотреть файл

@@ -30,7 +30,12 @@
30 30
   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31 31
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32 32
   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
-  
33
+
34
+
35
+  void u8g_Delay(uint16_t val)		Delay by "val" milliseconds
36
+  void u8g_MicroDelay(void)		Delay be one microsecond
37
+  void u8g_10MicroDelay(void)	Delay by 10 microseconds
38
+
34 39
   
35 40
 */
36 41
 
@@ -40,19 +45,37 @@
40 45
 /*==== Part 1: Derive suitable delay procedure ====*/
41 46
 
42 47
 #if defined(ARDUINO)
48
+
49
+#  if ARDUINO < 100 
50
+#    include <WProgram.h> 
51
+#  else 
52
+#    include <Arduino.h> 
53
+#  endif
54
+
43 55
 #  if defined(__AVR__)
44 56
 #    define USE_AVR_DELAY
45 57
 #  elif defined(__PIC32MX)
46 58
 #    define USE_PIC32_DELAY
47
-#  elif defined(__arm__)		/* Arduino Due */
59
+#  elif defined(__arm__)		/* Arduino Due & Teensy */
48 60
 #    define USE_ARDUINO_DELAY
49 61
 #  else
50 62
 #    define USE_ARDUINO_DELAY
51 63
 #  endif
64
+#elif defined(U8G_RASPBERRY_PI)
65
+#  define USE_RASPBERRYPI_DELAY
52 66
 #elif defined(__AVR__)
53 67
 #  define USE_AVR_DELAY
54 68
 #elif defined(__18CXX)
55 69
 #  define USE_PIC18_DELAY
70
+#elif defined(__arm__)
71
+/* do not define anything, all procedures are expected to be defined outside u8glib */
72
+
73
+/*
74
+void u8g_Delay(uint16_t val);
75
+void u8g_MicroDelay(void);
76
+void u8g_10MicroDelay(void);
77
+*/
78
+
56 79
 #else
57 80
 #  define USE_DUMMY_DELAY
58 81
 #endif
@@ -61,6 +84,26 @@
61 84
 
62 85
 /*==== Part 2: Definition of the delay procedures ====*/
63 86
 
87
+/*== Raspberry Pi Delay ==*/
88
+#if defined (USE_RASPBERRYPI_DELAY)
89
+#include <wiringPi.h>
90
+//#include "/usr/local/include/wiringPi.h"
91
+void u8g_Delay(uint16_t val) {
92
+   //delay(val);
93
+   //usleep((uint32_t)val*(uint32_t)1000);
94
+   delayMicroseconds((uint32_t)val*(uint32_t)1000);
95
+}
96
+void u8g_MicroDelay(void)
97
+{
98
+   usleep(1);
99
+}
100
+void u8g_10MicroDelay(void)
101
+{
102
+   usleep(10);
103
+}
104
+#endif
105
+
106
+
64 107
 /*== AVR Delay ==*/
65 108
 
66 109
 #if defined(USE_AVR_DELAY)
@@ -144,7 +187,11 @@ void u8g_10MicroDelay(void)
144 187
 #if defined(USE_ARDUINO_DELAY)
145 188
 void u8g_Delay(uint16_t val)
146 189
 {
190
+#if defined(__arm__)
191
+	delayMicroseconds((uint32_t)val*(uint32_t)1000);
192
+#else
147 193
 	delay(val);
194
+#endif
148 195
 }
149 196
 void u8g_MicroDelay(void)
150 197
 {

+ 199
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_a2_micro_printer.c Просмотреть файл

@@ -0,0 +1,199 @@
1
+/*
2
+
3
+  u8g_dev_a2_micro_printer_ds.c
4
+
5
+  Use DC2 bitmap command of the A2 Micro panel termal printer
6
+  double stroke
7
+
8
+  Universal 8bit Graphics Library
9
+  
10
+  Copyright (c) 2013, olikraus@gmail.com
11
+  All rights reserved.
12
+
13
+  Redistribution and use in source and binary forms, with or without modification, 
14
+  are permitted provided that the following conditions are met:
15
+
16
+  * Redistributions of source code must retain the above copyright notice, this list 
17
+    of conditions and the following disclaimer.
18
+    
19
+  * Redistributions in binary form must reproduce the above copyright notice, this 
20
+    list of conditions and the following disclaimer in the documentation and/or other 
21
+    materials provided with the distribution.
22
+
23
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
24
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
25
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
26
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
27
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
28
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
30
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
33
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
34
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
35
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
36
+  
37
+  
38
+*/
39
+
40
+#include "u8g.h"
41
+
42
+#define LINE_DELAY 40
43
+
44
+
45
+uint8_t u8g_dev_a2_micro_printer_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
46
+{
47
+  switch(msg)
48
+  {
49
+    case U8G_DEV_MSG_INIT:
50
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
51
+      break;
52
+    case U8G_DEV_MSG_STOP:
53
+      break;
54
+    case U8G_DEV_MSG_PAGE_NEXT:
55
+      {
56
+        uint8_t y, i, j;
57
+        uint8_t *ptr;
58
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
59
+        
60
+        y = pb->p.page_y0;
61
+        ptr = pb->buf;
62
+
63
+	u8g_WriteByte(u8g, dev, 27);      /* ESC */
64
+	u8g_WriteByte(u8g, dev, 55 );      /* parameter command */
65
+	u8g_WriteByte(u8g, dev, 7);      /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
66
+	u8g_WriteByte(u8g, dev, 160);      /* 3-255 Heating time,Unit(10us),Default:80(800us) */
67
+	u8g_WriteByte(u8g, dev, 20);      /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
68
+	
69
+	u8g_WriteByte(u8g, dev, 18);      /* DC2 */
70
+	u8g_WriteByte(u8g, dev, 42 );      /* *  */
71
+	u8g_WriteByte(u8g, dev, pb->p.page_height ); 
72
+	u8g_WriteByte(u8g, dev, pb->width/8 ); 
73
+	
74
+        for( i = 0; i < pb->p.page_height; i ++ )
75
+        {
76
+	  for( j = 0; j < pb->width/8; j++ )
77
+	  {
78
+	    u8g_WriteByte(u8g, dev, *ptr);
79
+	    ptr++;
80
+	  }
81
+	  u8g_Delay(LINE_DELAY);
82
+          y++;
83
+        }
84
+
85
+	/* set parameters back to their default values */
86
+	u8g_WriteByte(u8g, dev, 27);      /* ESC */
87
+	u8g_WriteByte(u8g, dev, 55 );      /* parameter command */
88
+	u8g_WriteByte(u8g, dev, 7);      /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
89
+	u8g_WriteByte(u8g, dev, 80);      /* 3-255 Heating time,Unit(10us),Default:80(800us) */
90
+	u8g_WriteByte(u8g, dev, 2);      /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
91
+	
92
+      }
93
+      break;
94
+  }
95
+  return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
96
+}
97
+
98
+static uint8_t u8g_dev_expand4(uint8_t val)
99
+{
100
+  uint8_t a,b,c,d;
101
+  a = val&1;
102
+  b = (val&2)<<1;
103
+  c = (val&4)<<2;
104
+  d = (val&8)<<3;
105
+  a |=b;
106
+  a |=c;
107
+  a |=d;
108
+  a |= a<<1;
109
+  return a;
110
+}
111
+
112
+uint8_t u8g_dev_a2_micro_printer_double_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
113
+{
114
+  switch(msg)
115
+  {
116
+    case U8G_DEV_MSG_INIT:
117
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
118
+      break;
119
+    case U8G_DEV_MSG_STOP:
120
+      break;
121
+    case U8G_DEV_MSG_PAGE_FIRST:
122
+      {
123
+        //u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
124
+	//u8g_WriteByte(u8g, dev, 18);      /* DC2 */
125
+	//u8g_WriteByte(u8g, dev, 42 );      /* *  */
126
+	//u8g_WriteByte(u8g, dev, pb->p.total_height*2 ); 
127
+	//u8g_WriteByte(u8g, dev, pb->width/8*2 ); 
128
+      }
129
+      break;
130
+    case U8G_DEV_MSG_PAGE_NEXT:
131
+      {
132
+        uint8_t y, i, j;
133
+        uint8_t *ptr;
134
+        uint8_t *p2;
135
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
136
+        
137
+        y = pb->p.page_y0;
138
+        ptr = pb->buf;
139
+	//u8g_WriteByte(u8g, dev, 18);      /* DC2 */
140
+	//u8g_WriteByte(u8g, dev, 35 );      /* #  */
141
+	//u8g_WriteByte(u8g, dev, 0x0ff );      /* max  */
142
+
143
+	u8g_WriteByte(u8g, dev, 27);      /* ESC */
144
+	u8g_WriteByte(u8g, dev, 55 );      /* parameter command */
145
+	u8g_WriteByte(u8g, dev, 7);      /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
146
+	u8g_WriteByte(u8g, dev, 160);      /* 3-255 Heating time,Unit(10us),Default:80(800us) */
147
+	u8g_WriteByte(u8g, dev, 20);      /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
148
+	
149
+	u8g_WriteByte(u8g, dev, 18);      /* DC2 */
150
+	u8g_WriteByte(u8g, dev, 42 );      /* *  */
151
+	u8g_WriteByte(u8g, dev, pb->p.page_height*2 ); 
152
+	u8g_WriteByte(u8g, dev, pb->width/8*2 ); 
153
+	
154
+        for( i = 0; i < pb->p.page_height; i ++ )
155
+        {
156
+	  p2 = ptr;
157
+	  for( j = 0; j < pb->width/8; j++ )
158
+	  {
159
+	    u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 >> 4));
160
+	    u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 & 15));
161
+	    p2++;
162
+	  }
163
+	  u8g_Delay(LINE_DELAY);
164
+	  p2 = ptr;
165
+	  for( j = 0; j < pb->width/8; j++ )
166
+	  {
167
+	    u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 >> 4));
168
+	    u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 & 15));
169
+	    p2++;
170
+	  }
171
+	  u8g_Delay(LINE_DELAY);
172
+	  ptr += pb->width/8;
173
+          y++;
174
+        }
175
+	
176
+	/* set parameters back to their default values */
177
+	u8g_WriteByte(u8g, dev, 27);      /* ESC */
178
+	u8g_WriteByte(u8g, dev, 55 );      /* parameter command */
179
+	u8g_WriteByte(u8g, dev, 7);      /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
180
+	u8g_WriteByte(u8g, dev, 80);      /* 3-255 Heating time,Unit(10us),Default:80(800us) */
181
+	u8g_WriteByte(u8g, dev, 2);      /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
182
+	
183
+      }
184
+      break;
185
+  }
186
+  return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
187
+}
188
+
189
+#if defined(U8G_16BIT)
190
+U8G_PB_DEV(u8g_dev_a2_micro_printer_384x240, 384, 240, 8, u8g_dev_a2_micro_printer_fn, u8g_com_null_fn);
191
+U8G_PB_DEV(u8g_dev_a2_micro_printer_192x360_ds, 192, 360, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
192
+U8G_PB_DEV(u8g_dev_a2_micro_printer_192x720_ds, 192, 720, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
193
+#else
194
+U8G_PB_DEV(u8g_dev_a2_micro_printer_384x240, 240, 240, 8, u8g_dev_a2_micro_printer_fn, u8g_com_null_fn);
195
+U8G_PB_DEV(u8g_dev_a2_micro_printer_192x360_ds, 192, 240, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
196
+U8G_PB_DEV(u8g_dev_a2_micro_printer_192x720_ds, 192, 240, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
197
+#endif
198
+
199
+U8G_PB_DEV(u8g_dev_a2_micro_printer_192x120_ds, 192, 120, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_flipdisc_2x7.c Просмотреть файл

@@ -78,7 +78,7 @@ uint8_t u8g_dev_flipdisc_2x7_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
78 78
 	/* current page: pb->p.page */
79 79
 	/* ptr to the buffer: pb->buf */
80 80
 	
81
-	(*u8g_write_flip_disc_matrix)(0, pb->p.page, WIDTH, pb->buf, pb->buf+WIDTH);
81
+	(*u8g_write_flip_disc_matrix)(0, pb->p.page, WIDTH, pb->buf, (uint8_t *)(pb->buf)+WIDTH);
82 82
       }
83 83
       break;
84 84
     case U8G_DEV_MSG_CONTRAST:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_gprof.c Просмотреть файл

@@ -121,7 +121,7 @@ uint8_t u8g_dev_gprof_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
121 121
     case U8G_DEV_MSG_GET_PAGE_BOX:
122 122
       u8g_pb_GetPageBox(pb, (u8g_box_t *)arg);
123 123
       break;
124
-    case U8G_DEV_MSG_SET_COLOR_INDEX:
124
+    case U8G_DEV_MSG_SET_COLOR_ENTRY:
125 125
       break;
126 126
     case U8G_DEV_MSG_SET_XY_CB:
127 127
       break;

+ 281
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ht1632.c Просмотреть файл

@@ -0,0 +1,281 @@
1
+/*
2
+ 
3
+  u8g_dev_ht1632.c
4
+ 
5
+  1-Bit (BW) Driver for HT1632 controller
6
+ 
7
+  Universal 8bit Graphics Library
8
+ 
9
+  Copyright (c) 2013, olikraus@gmail.com
10
+  All rights reserved.
11
+ 
12
+  Redistribution and use in source and binary forms, with or without modification,
13
+  are permitted provided that the following conditions are met:
14
+ 
15
+  * Redistributions of source code must retain the above copyright notice, this list
16
+    of conditions and the following disclaimer.
17
+   
18
+  * Redistributions in binary form must reproduce the above copyright notice, this
19
+    list of conditions and the following disclaimer in the documentation and/or other
20
+    materials provided with the distribution.
21
+ 
22
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
+
36
+
37
+
38
+    U8G_PIN_NONE can be used as argument
39
+   
40
+    uint8_t u8g_InitSPI(u8g_t *u8g, u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset)
41
+    {
42
+      ...      
43
+      u8g->pin_list[U8G_PI_SCK] = sck;
44
+      u8g->pin_list[U8G_PI_MOSI] = mosi;
45
+      u8g->pin_list[U8G_PI_CS] = cs;
46
+      u8g->pin_list[U8G_PI_A0] = a0;
47
+      u8g->pin_list[U8G_PI_RESET] = reset;
48
+
49
+mapping  
50
+
51
+#define DATA_PIN --> U8G_PI_MOSI
52
+#define WR_PIN    --> U8G_PI_SCK
53
+#define CS_PIN      --> U8G_PI_CS
54
+				    U8G_PI_A0 --> not used
55
+				    U8G_PI_RESET --> not used
56
+
57
+Usage:
58
+
59
+    u8g_InitSPI(&u8g, &u8g_dev_ht1632_24x16, WR_PIN, DATA_IN, CS_PIN, U8G_PIN_NONE, U8G_PIN_NONE)
60
+
61
+*/
62
+ 
63
+#include "u8g.h"
64
+ 
65
+#define WIDTH 24
66
+#define HEIGHT 16
67
+#define PAGE_HEIGHT 16
68
+ 
69
+/* http://forum.arduino.cc/index.php?topic=168537.0 */
70
+ 
71
+#define HT1632_CMD_SYSDIS       0x00    // CMD= 0000-0000-x Turn off oscil
72
+#define HT1632_CMD_SYSON        0x01    // CMD= 0000-0001-x Enable system oscil
73
+#define HT1632_CMD_LEDOFF       0x02    // CMD= 0000-0010-x LED duty cycle gen off
74
+#define HT1632_CMD_LEDON        0x03    // CMD= 0000-0011-x LEDs ON
75
+#define HT1632_CMD_BLOFF        0x08    // CMD= 0000-1000-x Blink OFF
76
+#define HT1632_CMD_BLON         0x09    // CMD= 0000-1001-x Blink On
77
+#define HT1632_CMD_SLVMD        0x10    // CMD= 0001-00xx-x Slave Mode
78
+#define HT1632_CMD_MSTMD        0x14    // CMD= 0001-01xx-x Master Mode
79
+#define HT1632_CMD_RCCLK        0x18    // CMD= 0001-10xx-x Use on-chip clock
80
+#define HT1632_CMD_EXTCLK       0x1C    // CMD= 0001-11xx-x Use external clock
81
+#define HT1632_CMD_COMS00       0x20    // CMD= 0010-ABxx-x commons options
82
+#define HT1632_CMD_COMS01       0x24    // CMD= 0010-ABxx-x commons options
83
+#define HT1632_CMD_COMS10       0x28    // CMD= 0010-ABxx-x commons options
84
+#define HT1632_CMD_COMS11       0x2C    // P-MOS OUTPUT AND 16COMMON OPTION
85
+#define HT1632_CMD_PWM          0xA0    // CMD= 101x-PPPP-x PWM duty cycle
86
+ 
87
+#define HT1632_ID_CMD   4       /* ID = 100 - Commands */
88
+#define HT1632_ID_RD    6       /* ID = 110 - Read RAM */
89
+#define HT1632_ID_WR    5       /* ID = 101 - Write RAM */
90
+ 
91
+#define HT1632_ID_LEN           3               // IDs are 3 bits
92
+#define HT1632_CMD_LEN          8               // CMDs are 8 bits
93
+#define HT1632_DATA_LEN         8               // Data are 4*2 bits
94
+#define HT1632_ADDR_LEN         7               // Address are 7 bits
95
+ 
96
+#if defined(ARDUINO)
97
+ 
98
+#if ARDUINO < 100
99
+#include <WProgram.h>
100
+#else
101
+#include <Arduino.h>
102
+#endif
103
+ 
104
+//#define WR_PIN 3
105
+//#define DATA_PIN 2
106
+//#define CS_PIN 4
107
+ 
108
+void ht1632_write_data_MSB(u8g_t *u8g, uint8_t cnt, uint8_t data, uint8_t extra)
109
+{
110
+  int8_t i;
111
+  uint8_t data_pin = u8g->pin_list[U8G_PI_MOSI];
112
+  uint8_t wr_pin = u8g->pin_list[U8G_PI_SCK];
113
+ 
114
+  for(i = cnt - 1; i >= 0; i--)
115
+  {
116
+    if ((data >> i) & 1)
117
+    {  
118
+      digitalWrite(data_pin, HIGH);
119
+    }
120
+    else
121
+    {
122
+      digitalWrite(data_pin, LOW);
123
+    }
124
+ 
125
+    digitalWrite(wr_pin, LOW);
126
+    u8g_MicroDelay();
127
+    digitalWrite(wr_pin, HIGH);
128
+    u8g_MicroDelay();
129
+  }
130
+ 
131
+  // Send an extra bit
132
+  if (extra)
133
+  {
134
+    digitalWrite(data_pin, HIGH);
135
+    digitalWrite(wr_pin, LOW);
136
+    u8g_MicroDelay();
137
+    digitalWrite(wr_pin, HIGH);
138
+    u8g_MicroDelay();
139
+  }
140
+}
141
+ 
142
+void ht1632_write_data(u8g_t *u8g, uint8_t cnt, uint8_t data)
143
+{
144
+  uint8_t i;
145
+  uint8_t data_pin = u8g->pin_list[U8G_PI_MOSI];
146
+  uint8_t wr_pin = u8g->pin_list[U8G_PI_SCK];
147
+  for (i = 0; i < cnt; i++)
148
+  {
149
+ 
150
+    if ((data >> i) & 1) {
151
+      digitalWrite(data_pin, HIGH);
152
+    }
153
+    else {
154
+      digitalWrite(data_pin, LOW);
155
+    }
156
+ 
157
+    digitalWrite(wr_pin, LOW);
158
+    u8g_MicroDelay();
159
+    digitalWrite(wr_pin, HIGH);
160
+    u8g_MicroDelay();
161
+  }
162
+}
163
+ 
164
+ 
165
+void ht1632_init(u8g_t *u8g)
166
+{
167
+  //uint8_t i;
168
+  uint8_t data_pin = u8g->pin_list[U8G_PI_MOSI];
169
+  uint8_t wr_pin = u8g->pin_list[U8G_PI_SCK];
170
+  uint8_t cs_pin = u8g->pin_list[U8G_PI_CS];
171
+  pinMode(data_pin, OUTPUT);
172
+  pinMode(wr_pin, OUTPUT);
173
+  pinMode(cs_pin, OUTPUT);
174
+ 
175
+  digitalWrite(data_pin, HIGH);
176
+  digitalWrite(wr_pin, HIGH);
177
+  digitalWrite(cs_pin, HIGH);
178
+ 
179
+  digitalWrite(cs_pin, LOW);
180
+  /* init display once after startup */
181
+  ht1632_write_data_MSB(u8g, 3, HT1632_ID_CMD, false); // IDs are 3 bits
182
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_SYSDIS, true); // 8 bits
183
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_SYSON, true); // 8 bits
184
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_COMS11, true); // 8 bits
185
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_LEDON, true); // 8 bits
186
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_BLOFF, true); // 8 bits
187
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_PWM+15, true); // 8 bits  
188
+  digitalWrite(cs_pin, HIGH);
189
+ 
190
+  /* removed following (debug) code */
191
+  /*
192
+  digitalWrite(cs_pin, LOW);
193
+  ht1632_write_data_MSB(u8g, 3, HT1632_ID_WR, false); // Send "write to display" command
194
+  ht1632_write_data_MSB(u8g, 7, 0, false);
195
+  for(i = 0; i<48; ++i)
196
+  {
197
+    ht1632_write_data(u8g, 8, 0xFF);
198
+  }
199
+  digitalWrite(cs_pin, HIGH);
200
+  */
201
+}
202
+ 
203
+/*
204
+  page: 0=data contain lines 0..16, 1=data contain lines 16..32  (a 24x16 display will only have page 0)
205
+  cnt: width of the display
206
+  data: pointer to a buffer with 2*cnt bytes.
207
+*/
208
+void ht1632_transfer_data(u8g_t *u8g, uint8_t page, uint8_t cnt, uint8_t *data)
209
+{
210
+  uint8_t addr;
211
+  uint8_t cs_pin = u8g->pin_list[U8G_PI_CS];
212
+  /* send data to the ht1632 */
213
+  digitalWrite(cs_pin, LOW);
214
+  ht1632_write_data_MSB(u8g, 3, HT1632_ID_WR, false); // Send "write to display" command
215
+  ht1632_write_data_MSB(u8g, 7, page*2*cnt, false); 
216
+  
217
+  // Operating in progressive addressing mode
218
+  for (addr = 0; addr < cnt; addr++)
219
+  {
220
+    ht1632_write_data(u8g, 8, data[addr]);  
221
+    ht1632_write_data(u8g, 8, data[addr+cnt]);
222
+  }  
223
+  digitalWrite(cs_pin, HIGH);
224
+}
225
+
226
+/* value is between 0...15 */
227
+void ht1632_set_contrast(u8g_t *u8g, uint8_t value)
228
+{
229
+  uint8_t cs_pin = u8g->pin_list[U8G_PI_CS];
230
+  digitalWrite(cs_pin, LOW);
231
+  ht1632_write_data_MSB(u8g, 3, HT1632_ID_CMD, false);
232
+  ht1632_write_data_MSB(u8g, 8, HT1632_CMD_PWM + value, false);
233
+  digitalWrite(cs_pin, HIGH);
234
+}
235
+ 
236
+#else
237
+void ht1632_init(u8g_t *u8g)
238
+{
239
+}
240
+ 
241
+void ht1632_transfer_data(u8g_t *u8g, uint8_t page, uint8_t cnt, uint8_t *data)
242
+{
243
+}
244
+
245
+void ht1632_set_contrast(u8g_t *u8g, uint8_t value)
246
+{
247
+}
248
+
249
+#endif /* ARDUINO */
250
+ 
251
+ 
252
+uint8_t u8g_dev_ht1632_24x16_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
253
+{
254
+  switch(msg)
255
+  {
256
+    case U8G_DEV_MSG_INIT:
257
+      ht1632_init(u8g);
258
+      break;
259
+    case U8G_DEV_MSG_STOP:
260
+      break;
261
+    case U8G_DEV_MSG_PAGE_NEXT:
262
+      {
263
+	u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
264
+       
265
+	/* current page: pb->p.page */
266
+	/* ptr to the buffer: pb->buf */
267
+	ht1632_transfer_data(u8g, pb->p.page, WIDTH, pb->buf);
268
+      }
269
+      break;
270
+    case U8G_DEV_MSG_CONTRAST:
271
+      /* values passed to SetContrast() are between 0 and 255, scale down to 0...15 */
272
+      ht1632_set_contrast(u8g, (*(uint8_t *)arg) >> 4);
273
+    return 1;
274
+  }
275
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
276
+}
277
+ 
278
+uint8_t u8g_dev_ht1632_24x16_buf[WIDTH*2] U8G_NOCOMMON ; 
279
+u8g_pb_t u8g_dev_ht1632_24x16_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ht1632_24x16_buf}; 
280
+u8g_dev_t u8g_dev_ht1632_24x16 = { u8g_dev_ht1632_24x16_fn, &u8g_dev_ht1632_24x16_pb, u8g_com_null_fn };
281
+

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ili9325d_320x240.c Просмотреть файл

@@ -272,7 +272,7 @@ uint8_t u8g_dev_ili9325d_320x240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
272 272
   switch(msg)
273 273
   {
274 274
     case U8G_DEV_MSG_INIT:
275
-      u8g_InitCom(u8g, dev);
275
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
276 276
       //for(;;)
277 277
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_ili9325d_320x240_init_seq);
278 278
     

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ks0108_128x64.c Просмотреть файл

@@ -73,7 +73,7 @@ uint8_t u8g_dev_ks0108_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
73 73
   switch(msg)
74 74
   {
75 75
     case U8G_DEV_MSG_INIT:
76
-      u8g_InitCom(u8g, dev);
76
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
77 77
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ks0108_128x64_init_seq);
78 78
       break;
79 79
     case U8G_DEV_MSG_STOP:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_160x80.c Просмотреть файл

@@ -98,7 +98,7 @@ uint8_t u8g_dev_lc7981_160x80_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
98 98
   switch(msg)
99 99
   {
100 100
     case U8G_DEV_MSG_INIT:
101
-      u8g_InitCom(u8g, dev);
101
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
102 102
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_160x80_init_seq);
103 103
       break;
104 104
     case U8G_DEV_MSG_STOP:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_240x128.c Просмотреть файл

@@ -96,7 +96,7 @@ uint8_t u8g_dev_lc7981_240x128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
96 96
   switch(msg)
97 97
   {
98 98
     case U8G_DEV_MSG_INIT:
99
-      u8g_InitCom(u8g, dev);
99
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
100 100
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_240x128_init_seq);
101 101
       break;
102 102
     case U8G_DEV_MSG_STOP:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_240x64.c Просмотреть файл

@@ -96,7 +96,7 @@ uint8_t u8g_dev_lc7981_240x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
96 96
   switch(msg)
97 97
   {
98 98
     case U8G_DEV_MSG_INIT:
99
-      u8g_InitCom(u8g, dev);
99
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
100 100
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_240x64_init_seq);
101 101
       break;
102 102
     case U8G_DEV_MSG_STOP:

+ 7
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_lc7981_320x64.c Просмотреть файл

@@ -40,7 +40,12 @@
40 40
 
41 41
 #include "u8g.h"
42 42
 
43
+#ifdef U8G_16BIT
43 44
 #define WIDTH 320
45
+#else
46
+#define WIDTH 240
47
+#endif
48
+
44 49
 #define HEIGHT 64
45 50
 #define PAGE_HEIGHT 8
46 51
 
@@ -98,7 +103,7 @@ uint8_t u8g_dev_lc7981_320x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
98 103
   switch(msg)
99 104
   {
100 105
     case U8G_DEV_MSG_INIT:
101
-      u8g_InitCom(u8g, dev);
106
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
102 107
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_320x64_init_seq);
103 108
       break;
104 109
     case U8G_DEV_MSG_STOP:
@@ -143,3 +148,4 @@ uint8_t u8g_dev_lc7981_320x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
143 148
 }
144 149
 
145 150
 U8G_PB_DEV(u8g_dev_lc7981_320x64_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_lc7981_320x64_fn, U8G_COM_FAST_PARALLEL);
151
+

+ 232
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ld7032_60x32.c Просмотреть файл

@@ -0,0 +1,232 @@
1
+/*
2
+
3
+  u8g_dev_ld7032_60x32.c
4
+  
5
+  60x32 OLED display
6
+
7
+  Universal 8bit Graphics Library
8
+  
9
+  Copyright (c) 2011, olikraus@gmail.com
10
+  All rights reserved.
11
+
12
+  Redistribution and use in source and binary forms, with or without modification, 
13
+  are permitted provided that the following conditions are met:
14
+
15
+  * Redistributions of source code must retain the above copyright notice, this list 
16
+    of conditions and the following disclaimer.
17
+    
18
+  * Redistributions in binary form must reproduce the above copyright notice, this 
19
+    list of conditions and the following disclaimer in the documentation and/or other 
20
+    materials provided with the distribution.
21
+
22
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
23
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
24
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
25
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
26
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
27
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
28
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
29
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
30
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
31
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
32
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
33
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
34
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
35
+  
36
+  
37
+*/
38
+
39
+#include "u8g.h"
40
+
41
+/* define width as 64, so that it is a multiple of 8 */
42
+#define WIDTH 64
43
+#define HEIGHT 32
44
+#define PAGE_HEIGHT 8
45
+
46
+static const uint8_t u8g_dev_ld7032_60x32_init_seq[] PROGMEM = {
47
+  U8G_ESC_CS(0),             /* disable chip */
48
+  U8G_ESC_ADR(0),           /* instruction mode */
49
+  U8G_ESC_DLY(1),       	/* delay 1 ms */
50
+  U8G_ESC_RST(1),           /* do reset low pulse with (1*16)+2 milliseconds */
51
+  U8G_ESC_CS(1),             /* enable chip */
52
+  
53
+  
54
+  U8G_ESC_ADR(0),           /* instruction mode */
55
+  0x002,				/* Dot Matrix Display ON/OFF */
56
+  U8G_ESC_ADR(1),           /* data mode */
57
+  0x001,				/* ON */
58
+  
59
+  U8G_ESC_ADR(0),           /* instruction mode */
60
+  0x014,				/* Dot Matrix Display Stand-by ON/OFF */
61
+  U8G_ESC_ADR(1),           /* data mode */
62
+  0x000,				/* ON */
63
+
64
+  U8G_ESC_ADR(0),           /* instruction mode */
65
+  0x01a,				/* Dot Matrix Frame Rate */
66
+  U8G_ESC_ADR(1),           /* data mode */
67
+  0x004,				/* special value for this OLED from manual */
68
+
69
+  U8G_ESC_ADR(0),           /* instruction mode */
70
+  0x01d,				/* Graphics Memory Writing Direction */
71
+  U8G_ESC_ADR(1),           /* data mode */
72
+  0x000,				/* reset default (right down, horizontal) */
73
+
74
+  U8G_ESC_ADR(0),           /* instruction mode */
75
+  0x009,				/* Display Direction */
76
+  U8G_ESC_ADR(1),           /* data mode */
77
+  0x000,				/* reset default (x,y: min --> max) */
78
+  
79
+  U8G_ESC_ADR(0),           /* instruction mode */
80
+  0x030,				/* Display Size X */
81
+  U8G_ESC_ADR(1),           /* data mode */
82
+  0x000,				/* Column Start Output */
83
+  0x03b,				/* Column End Output */
84
+
85
+  U8G_ESC_ADR(0),           /* instruction mode */
86
+  0x032,				/* Display Size Y */
87
+  U8G_ESC_ADR(1),           /* data mode */
88
+  0x000,				/* Row Start Output */
89
+  0x01f,				/* Row End Output */
90
+  
91
+  U8G_ESC_ADR(0),           /* instruction mode */
92
+  0x010,				/* Peak Pulse Width Set */
93
+  U8G_ESC_ADR(1),           /* data mode */
94
+  0x000,				/* 0 SCLK */
95
+  
96
+  U8G_ESC_ADR(0),           /* instruction mode */
97
+  0x016,				/* Peak Pulse Delay Set */
98
+  U8G_ESC_ADR(1),           /* data mode */
99
+  0x000,				/* 0 SCLK */
100
+  
101
+  U8G_ESC_ADR(0),           /* instruction mode */
102
+  0x012,				/* Dot Matrix Current Level Set */
103
+  U8G_ESC_ADR(1),           /* data mode */
104
+  0x050,				/* 0x050 * 1 uA = 80 uA */
105
+
106
+  U8G_ESC_ADR(0),           /* instruction mode */
107
+  0x018,				/* Pre-Charge Pulse Width */
108
+  U8G_ESC_ADR(1),           /* data mode */
109
+  0x003,				/* 3 SCLK */
110
+
111
+  U8G_ESC_ADR(0),           /* instruction mode */
112
+  0x044,				/* Pre-Charge Mode */
113
+  U8G_ESC_ADR(1),           /* data mode */
114
+  0x002,				/* Every Time */
115
+
116
+  U8G_ESC_ADR(0),           /* instruction mode */
117
+  0x048,				/* Row overlap timing */
118
+  U8G_ESC_ADR(1),           /* data mode */
119
+  0x003,				/* Pre-Charge + Peak Delay + Peak boot Timing */
120
+
121
+  U8G_ESC_ADR(0),           /* instruction mode */
122
+  0x03f,				/* VCC_R_SEL */
123
+  U8G_ESC_ADR(1),           /* data mode */
124
+  0x011,				/* ??? */
125
+
126
+  U8G_ESC_ADR(0),           /* instruction mode */
127
+  0x03d,				/* VSS selection */
128
+  U8G_ESC_ADR(1),           /* data mode */
129
+  0x000,				/* 2.8V */
130
+
131
+  U8G_ESC_ADR(0),           /* instruction mode */
132
+  0x002,				/* Dot Matrix Display ON/OFF */
133
+  U8G_ESC_ADR(1),           /* data mode */
134
+  0x001,				/* ON */
135
+
136
+  U8G_ESC_ADR(0),           /* instruction mode */
137
+  0x008,				/* write data */
138
+
139
+  U8G_ESC_CS(0),             /* disable chip */
140
+  U8G_ESC_END                /* end of sequence */
141
+};
142
+
143
+/* use box commands to set start adr */
144
+static const uint8_t u8g_dev_ld7032_60x32_data_start[] PROGMEM = {
145
+  U8G_ESC_ADR(0),           /* instruction mode */
146
+  U8G_ESC_CS(1),             /* enable chip */
147
+  
148
+  
149
+  U8G_ESC_ADR(0),           /* instruction mode */
150
+  0x034,				/* box x start */
151
+  U8G_ESC_ADR(1),           /* data mode */
152
+  0x000,				/* 0 */
153
+
154
+  U8G_ESC_ADR(0),           /* instruction mode */
155
+  0x035,				/* box x end */
156
+  U8G_ESC_ADR(1),           /* data mode */
157
+  0x007,				/*  */
158
+
159
+  U8G_ESC_ADR(0),           /* instruction mode */
160
+  0x037,				/* box y end */
161
+  U8G_ESC_ADR(1),           /* data mode */
162
+  0x01f,				/*  */
163
+
164
+  U8G_ESC_ADR(0),           /* instruction mode */
165
+  0x036,				/* box y start */
166
+  U8G_ESC_ADR(1),           /* data mode */
167
+
168
+  U8G_ESC_END                /* end of sequence */
169
+};
170
+
171
+static const uint8_t u8g_dev_ld7032_60x32_sleep_on[] PROGMEM = {
172
+  U8G_ESC_ADR(0),           /* instruction mode */
173
+  U8G_ESC_CS(1),             /* enable chip */
174
+  /* ... */
175
+  U8G_ESC_CS(0),             /* disable chip */
176
+  U8G_ESC_END                /* end of sequence */
177
+};
178
+
179
+static const uint8_t u8g_dev_ld7032_60x32_sleep_off[] PROGMEM = {
180
+  U8G_ESC_ADR(0),           /* instruction mode */
181
+  U8G_ESC_CS(1),             /* enable chip */
182
+  /* ... */
183
+  U8G_ESC_DLY(50),       /* delay 50 ms */
184
+  U8G_ESC_CS(0),             /* disable chip */
185
+  U8G_ESC_END                /* end of sequence */
186
+};
187
+
188
+uint8_t u8g_dev_ld7032_60x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
189
+{
190
+  switch(msg)
191
+  {
192
+    case U8G_DEV_MSG_INIT:
193
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
194
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_init_seq);
195
+      break;
196
+    case U8G_DEV_MSG_STOP:
197
+      break;
198
+    case U8G_DEV_MSG_PAGE_NEXT:
199
+      {
200
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
201
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_data_start);    
202
+        u8g_WriteByte(u8g, dev, pb->p.page_y0); /* y start */
203
+	u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
204
+	u8g_WriteByte(u8g, dev, 0x008);
205
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
206
+        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
207
+          return 0;
208
+        u8g_SetChipSelect(u8g, dev, 0);
209
+      }
210
+      break;
211
+    case U8G_DEV_MSG_CONTRAST:
212
+      u8g_SetChipSelect(u8g, dev, 1);
213
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
214
+      u8g_WriteByte(u8g, dev, 0x081);
215
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
216
+      u8g_SetChipSelect(u8g, dev, 0);      
217
+      return 1;
218
+    case U8G_DEV_MSG_SLEEP_ON:
219
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_sleep_on);    
220
+      return 1;
221
+    case U8G_DEV_MSG_SLEEP_OFF:
222
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_sleep_off);    
223
+      return 1;
224
+  }
225
+  return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
226
+}
227
+
228
+U8G_PB_DEV(u8g_dev_ld7032_60x32_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_SW_SPI);
229
+U8G_PB_DEV(u8g_dev_ld7032_60x32_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_HW_SPI);
230
+U8G_PB_DEV(u8g_dev_ld7032_60x32_parallel, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_PARALLEL);
231
+U8G_PB_DEV(u8g_dev_ld7032_60x32_hw_usart_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_HW_USART_SPI);
232
+

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_null.c Просмотреть файл

@@ -58,7 +58,7 @@ uint8_t u8g_dev_null(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
58 58
 #endif
59 59
     case U8G_DEV_MSG_GET_PAGE_BOX:
60 60
       break;
61
-    case U8G_DEV_MSG_SET_COLOR_INDEX:
61
+    case U8G_DEV_MSG_SET_COLOR_ENTRY:
62 62
       break;
63 63
     case U8G_DEV_MSG_SET_XY_CB:
64 64
       break;

+ 32
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_pcd8544_84x48.c Просмотреть файл

@@ -69,12 +69,36 @@ static const uint8_t u8g_dev_pcd8544_init_seq[] PROGMEM = {
69 69
   U8G_ESC_END                /* end of sequence */
70 70
 };
71 71
 
72
+
73
+static const uint8_t u8g_dev_pcd8544_sleep_on[] PROGMEM = {
74
+  U8G_ESC_ADR(0),           	/* instruction mode */
75
+  U8G_ESC_CS(1),             	/* enable chip */
76
+  
77
+  0x020,		                /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
78
+  0x00c,		                /* display on, normal */
79
+  U8G_ESC_CS(0),             	/* disable chip, bugfix 12 nov 2014 */
80
+  U8G_ESC_END                	/* end of sequence */
81
+};
82
+
83
+static const uint8_t u8g_dev_pcd8544_sleep_off[] PROGMEM = {
84
+  U8G_ESC_ADR(0),           	/* instruction mode */
85
+  U8G_ESC_CS(1),             	/* enable chip */
86
+  0x020,		                /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
87
+  0x008,		                /* display blank */
88
+  0x024,		                /* power down (PD=1), horizontal increment (V=0), enter normal command set (H=0) */
89
+  
90
+  U8G_ESC_DLY(50),       	/* delay 50 ms */
91
+  U8G_ESC_CS(0),             	/* disable chip, bugfix 12 nov 2014 */
92
+  U8G_ESC_END                	/* end of sequence */
93
+};
94
+
95
+
72 96
 uint8_t u8g_dev_pcd8544_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
73 97
 {
74 98
   switch(msg)
75 99
   {
76 100
     case U8G_DEV_MSG_INIT:
77
-      u8g_InitCom(u8g, dev);
101
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
78 102
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcd8544_init_seq);
79 103
       break;
80 104
     case U8G_DEV_MSG_STOP:
@@ -101,10 +125,17 @@ uint8_t u8g_dev_pcd8544_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
101 125
       u8g_WriteByte(u8g, dev, 0x080 | ( (*(uint8_t *)arg) >> 1 ) );
102 126
       u8g_SetChipSelect(u8g, dev, 0);
103 127
       return 1;
128
+    case U8G_DEV_MSG_SLEEP_ON:
129
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcd8544_sleep_on);    
130
+      return 1;
131
+    case U8G_DEV_MSG_SLEEP_OFF:
132
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcd8544_sleep_off);    
133
+      return 1;
104 134
   }
105 135
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
106 136
 }
107 137
 
108 138
 
109 139
 U8G_PB_DEV(u8g_dev_pcd8544_84x48_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcd8544_fn, U8G_COM_SW_SPI);
140
+U8G_PB_DEV(u8g_dev_pcd8544_84x48_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcd8544_fn, U8G_COM_HW_SPI);
110 141
 

+ 16
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_pcf8812_96x65.c Просмотреть файл

@@ -88,7 +88,7 @@ uint8_t u8g_dev_pcf8812_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
88 88
   switch(msg)
89 89
   {
90 90
     case U8G_DEV_MSG_INIT:
91
-      u8g_InitCom(u8g, dev);
91
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
92 92
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcf8812_init_seq);
93 93
       break;
94 94
     case U8G_DEV_MSG_STOP:
@@ -104,6 +104,20 @@ uint8_t u8g_dev_pcf8812_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
104 104
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
105 105
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
106 106
           return 0;
107
+
108
+	  /*  mirrored output, not tested*/
109
+	/*
110
+	{
111
+	  uint8_t i = pb->width;
112
+	  while( i > 0 )
113
+	  {
114
+	    i--;
115
+	    u8g_WriteByte(u8g, dev, ((unsigned char *)pb->buf)[i] );
116
+	  }
117
+	}
118
+	*/
119
+	
120
+	
107 121
         u8g_SetChipSelect(u8g, dev, 0);
108 122
       }
109 123
       break;
@@ -121,3 +135,4 @@ uint8_t u8g_dev_pcf8812_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
121 135
 
122 136
 /* u8g_com_arduino_sw_spi_fn does not work, too fast??? */
123 137
 U8G_PB_DEV(u8g_dev_pcf8812_96x65_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcf8812_fn, U8G_COM_SW_SPI);
138
+U8G_PB_DEV(u8g_dev_pcf8812_96x65_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcf8812_fn, U8G_COM_HW_SPI);

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_sbn1661_122x32.c Просмотреть файл

@@ -70,7 +70,7 @@ uint8_t u8g_dev_sbn1661_122x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
70 70
   switch(msg)
71 71
   {
72 72
     case U8G_DEV_MSG_INIT:
73
-      u8g_InitCom(u8g, dev);
73
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
74 74
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_sbn1661_122x32_init_seq);
75 75
       break;
76 76
     case U8G_DEV_MSG_STOP:

+ 47
- 5
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1306_128x32.c Просмотреть файл

@@ -123,7 +123,7 @@ static const uint8_t u8g_dev_ssd1306_128x32_adafruit3_init_seq[] PROGMEM = {
123 123
 
124 124
   0x0ae,				/* display off, sleep mode */
125 125
   0x0d5, 0x080,			/* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
126
-  0x0a8, 0x01f,			/* Feb 23, 2013: 128x32 OLED: 0x01f,  128x64 OLED 0x03f */
126
+  0x0a8, 0x01f,			/* Feb 23, 2013: 128x32 OLED: 0x01f,  128x32 OLED 0x03f */
127 127
 
128 128
   0x0d3, 0x000,			/*  */
129 129
 
@@ -131,7 +131,7 @@ static const uint8_t u8g_dev_ssd1306_128x32_adafruit3_init_seq[] PROGMEM = {
131 131
   
132 132
   0x08d, 0x014,			/* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */ 
133 133
 
134
-  0x020, 0x002,			/* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), Feb 23, 2013: 128x32 OLED: 0x002,  128x64 OLED 0x012 */
134
+  0x020, 0x002,			/* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), Feb 23, 2013: 128x32 OLED: 0x002,  128x32 OLED 0x012 */
135 135
   0x0a1,				/* segment remap a0/a1*/
136 136
   0x0c8,				/* c0: scan dir normal, c8: reverse */
137 137
   0x0da, 0x002,			/* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
@@ -196,7 +196,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
196 196
   U8G_ESC_ADR(0),           /* instruction mode */
197 197
   U8G_ESC_CS(1),             /* enable chip */
198 198
   0x0ae,		/* display off */      
199
-  U8G_ESC_CS(1),             /* disable chip */
199
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
200 200
   U8G_ESC_END                /* end of sequence */
201 201
 };
202 202
 
@@ -205,7 +205,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
205 205
   U8G_ESC_CS(1),             /* enable chip */
206 206
   0x0af,		/* display on */      
207 207
   U8G_ESC_DLY(50),       /* delay 50 ms */
208
-  U8G_ESC_CS(1),             /* disable chip */
208
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
209 209
   U8G_ESC_END                /* end of sequence */
210 210
 };
211 211
 
@@ -214,7 +214,7 @@ uint8_t u8g_dev_ssd1306_128x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
214 214
   switch(msg)
215 215
   {
216 216
     case U8G_DEV_MSG_INIT:
217
-      u8g_InitCom(u8g, dev);
217
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
218 218
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_init_seq);
219 219
       break;
220 220
     case U8G_DEV_MSG_STOP:
@@ -241,7 +241,49 @@ uint8_t u8g_dev_ssd1306_128x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
241 241
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
242 242
 }
243 243
 
244
+uint8_t u8g_dev_ssd1306_128x32_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
245
+{
246
+  switch(msg)
247
+  {
248
+    case U8G_DEV_MSG_INIT:
249
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
250
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_init_seq);
251
+      break;
252
+    case U8G_DEV_MSG_STOP:
253
+      break;
254
+    case U8G_DEV_MSG_PAGE_NEXT:
255
+      {
256
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
257
+	
258
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_data_start);    
259
+        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2));	/* select current page (SSD1306) */
260
+        u8g_SetAddress(u8g, dev, 1);					/* data mode */
261
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
262
+        u8g_SetChipSelect(u8g, dev, 0);
263
+	
264
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_data_start);    
265
+        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1));	/* select current page (SSD1306) */
266
+        u8g_SetAddress(u8g, dev, 1);					/* data mode */
267
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
268
+        u8g_SetChipSelect(u8g, dev, 0);
269
+      }
270
+      break;
271
+    case U8G_DEV_MSG_SLEEP_ON:
272
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);    
273
+      return 1;
274
+    case U8G_DEV_MSG_SLEEP_OFF:
275
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);    
276
+      return 1;
277
+  }
278
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
279
+}
280
+
244 281
 U8G_PB_DEV(u8g_dev_ssd1306_128x32_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x32_fn, U8G_COM_SW_SPI);
245 282
 U8G_PB_DEV(u8g_dev_ssd1306_128x32_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x32_fn, U8G_COM_HW_SPI);
246 283
 U8G_PB_DEV(u8g_dev_ssd1306_128x32_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x32_fn, U8G_COM_SSD_I2C);
247 284
 
285
+uint8_t u8g_dev_ssd1306_128x32_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
286
+u8g_pb_t u8g_dev_ssd1306_128x32_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1306_128x32_2x_buf}; 
287
+u8g_dev_t u8g_dev_ssd1306_128x32_2x_sw_spi = { u8g_dev_ssd1306_128x32_2x_fn, &u8g_dev_ssd1306_128x32_2x_pb, U8G_COM_SW_SPI };
288
+u8g_dev_t u8g_dev_ssd1306_128x32_2x_hw_spi = { u8g_dev_ssd1306_128x32_2x_fn, &u8g_dev_ssd1306_128x32_2x_pb, U8G_COM_HW_SPI };
289
+u8g_dev_t u8g_dev_ssd1306_128x32_2x_i2c = { u8g_dev_ssd1306_128x32_2x_fn, &u8g_dev_ssd1306_128x32_2x_pb, U8G_COM_SSD_I2C };

+ 179
- 4
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1306_128x64.c Просмотреть файл

@@ -172,7 +172,10 @@ static const uint8_t u8g_dev_ssd1306_128x64_univision_init_seq[] PROGMEM = {
172 172
 /* select one init sequence here */
173 173
 //#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_univision_init_seq
174 174
 //#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_adafruit1_init_seq
175
+// 26. Apr 2014: in this thead: http://forum.arduino.cc/index.php?topic=234930.msg1696754;topicseen#msg1696754
176
+// it is mentiond, that adafruit2_init_seq works better --> this will be used by the ssd1306_adafruit device
175 177
 //#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_adafruit2_init_seq
178
+
176 179
 #define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_adafruit3_init_seq
177 180
 
178 181
 
@@ -180,7 +183,16 @@ static const uint8_t u8g_dev_ssd1306_128x64_data_start[] PROGMEM = {
180 183
   U8G_ESC_ADR(0),           /* instruction mode */
181 184
   U8G_ESC_CS(1),             /* enable chip */
182 185
   0x010,		/* set upper 4 bit of the col adr to 0 */
183
-  0x000,		/* set lower 4 bit of the col adr to 4  */
186
+  0x000,		/* set lower 4 bit of the col adr to 0  */
187
+  U8G_ESC_END                /* end of sequence */
188
+};
189
+
190
+/* the sh1106 is compatible to the ssd1306, but is 132x64. display seems to be centered */
191
+static const uint8_t u8g_dev_sh1106_128x64_data_start[] PROGMEM = {
192
+  U8G_ESC_ADR(0),           /* instruction mode */
193
+  U8G_ESC_CS(1),             /* enable chip */
194
+  0x010,		/* set upper 4 bit of the col adr to 0 */
195
+  0x002,		/* set lower 4 bit of the col adr to 2 (centered display with sh1106)  */
184 196
   U8G_ESC_END                /* end of sequence */
185 197
 };
186 198
 
@@ -188,7 +200,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
188 200
   U8G_ESC_ADR(0),           /* instruction mode */
189 201
   U8G_ESC_CS(1),             /* enable chip */
190 202
   0x0ae,		/* display off */      
191
-  U8G_ESC_CS(1),             /* disable chip */
203
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
192 204
   U8G_ESC_END                /* end of sequence */
193 205
 };
194 206
 
@@ -197,7 +209,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
197 209
   U8G_ESC_CS(1),             /* enable chip */
198 210
   0x0af,		/* display on */      
199 211
   U8G_ESC_DLY(50),       /* delay 50 ms */
200
-  U8G_ESC_CS(1),             /* disable chip */
212
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
201 213
   U8G_ESC_END                /* end of sequence */
202 214
 };
203 215
 
@@ -206,7 +218,38 @@ uint8_t u8g_dev_ssd1306_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
206 218
   switch(msg)
207 219
   {
208 220
     case U8G_DEV_MSG_INIT:
209
-      u8g_InitCom(u8g, dev);
221
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
222
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_adafruit2_init_seq);
223
+      break;
224
+    case U8G_DEV_MSG_STOP:
225
+      break;
226
+    case U8G_DEV_MSG_PAGE_NEXT:
227
+      {
228
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
229
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);    
230
+        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
231
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
232
+        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
233
+          return 0;
234
+        u8g_SetChipSelect(u8g, dev, 0);
235
+      }
236
+      break;
237
+    case U8G_DEV_MSG_SLEEP_ON:
238
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);    
239
+      return 1;
240
+    case U8G_DEV_MSG_SLEEP_OFF:
241
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);    
242
+      return 1;
243
+  }
244
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
245
+}
246
+
247
+uint8_t u8g_dev_ssd1306_adafruit_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
248
+{
249
+  switch(msg)
250
+  {
251
+    case U8G_DEV_MSG_INIT:
252
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
210 253
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
211 254
       break;
212 255
     case U8G_DEV_MSG_STOP:
@@ -232,6 +275,138 @@ uint8_t u8g_dev_ssd1306_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
232 275
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
233 276
 }
234 277
 
278
+uint8_t u8g_dev_sh1106_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
279
+{
280
+  switch(msg)
281
+  {
282
+    case U8G_DEV_MSG_INIT:
283
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
284
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
285
+      break;
286
+    case U8G_DEV_MSG_STOP:
287
+      break;
288
+    case U8G_DEV_MSG_PAGE_NEXT:
289
+      {
290
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
291
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_data_start);    
292
+        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
293
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
294
+        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
295
+          return 0;
296
+        u8g_SetChipSelect(u8g, dev, 0);
297
+      }
298
+      break;
299
+    case U8G_DEV_MSG_SLEEP_ON:
300
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);    
301
+      return 1;
302
+    case U8G_DEV_MSG_SLEEP_OFF:
303
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);    
304
+      return 1;
305
+  }
306
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
307
+}
308
+
309
+
310
+uint8_t u8g_dev_ssd1306_128x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
311
+{
312
+  switch(msg)
313
+  {
314
+    case U8G_DEV_MSG_INIT:
315
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
316
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
317
+      break;
318
+    case U8G_DEV_MSG_STOP:
319
+      break;
320
+    case U8G_DEV_MSG_PAGE_NEXT:
321
+      {
322
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
323
+	
324
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);    
325
+        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); /* select current page (SSD1306) */
326
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
327
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
328
+        u8g_SetChipSelect(u8g, dev, 0);
329
+	
330
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);    
331
+        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); /* select current page (SSD1306) */
332
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
333
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
334
+        u8g_SetChipSelect(u8g, dev, 0);
335
+      }
336
+      break;
337
+    case U8G_DEV_MSG_SLEEP_ON:
338
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);    
339
+      return 1;
340
+    case U8G_DEV_MSG_SLEEP_OFF:
341
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);    
342
+      return 1;
343
+  }
344
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
345
+}
346
+
347
+uint8_t u8g_dev_sh1106_128x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
348
+{
349
+  switch(msg)
350
+  {
351
+    case U8G_DEV_MSG_INIT:
352
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
353
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
354
+      break;
355
+    case U8G_DEV_MSG_STOP:
356
+      break;
357
+    case U8G_DEV_MSG_PAGE_NEXT:
358
+      {
359
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
360
+	
361
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_data_start);    
362
+        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); /* select current page (SSD1306) */
363
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
364
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
365
+        u8g_SetChipSelect(u8g, dev, 0);
366
+	
367
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_data_start);    
368
+        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); /* select current page (SSD1306) */
369
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
370
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
371
+        u8g_SetChipSelect(u8g, dev, 0);
372
+      }
373
+      break;
374
+    case U8G_DEV_MSG_SLEEP_ON:
375
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);    
376
+      return 1;
377
+    case U8G_DEV_MSG_SLEEP_OFF:
378
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);    
379
+      return 1;
380
+  }
381
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
382
+}
383
+
384
+
385
+
386
+
235 387
 U8G_PB_DEV(u8g_dev_ssd1306_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_fn, U8G_COM_SW_SPI);
236 388
 U8G_PB_DEV(u8g_dev_ssd1306_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_fn, U8G_COM_HW_SPI);
237 389
 U8G_PB_DEV(u8g_dev_ssd1306_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_fn, U8G_COM_SSD_I2C);
390
+
391
+U8G_PB_DEV(u8g_dev_ssd1306_adafruit_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_adafruit_128x64_fn, U8G_COM_SW_SPI);
392
+U8G_PB_DEV(u8g_dev_ssd1306_adafruit_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_adafruit_128x64_fn, U8G_COM_HW_SPI);
393
+U8G_PB_DEV(u8g_dev_ssd1306_adafruit_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_adafruit_128x64_fn, U8G_COM_SSD_I2C);
394
+
395
+
396
+uint8_t u8g_dev_ssd1306_128x64_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
397
+u8g_pb_t u8g_dev_ssd1306_128x64_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1306_128x64_2x_buf}; 
398
+u8g_dev_t u8g_dev_ssd1306_128x64_2x_sw_spi = { u8g_dev_ssd1306_128x64_2x_fn, &u8g_dev_ssd1306_128x64_2x_pb, U8G_COM_SW_SPI };
399
+u8g_dev_t u8g_dev_ssd1306_128x64_2x_hw_spi = { u8g_dev_ssd1306_128x64_2x_fn, &u8g_dev_ssd1306_128x64_2x_pb, U8G_COM_HW_SPI };
400
+u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c = { u8g_dev_ssd1306_128x64_2x_fn, &u8g_dev_ssd1306_128x64_2x_pb, U8G_COM_SSD_I2C };
401
+
402
+
403
+U8G_PB_DEV(u8g_dev_sh1106_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_fn, U8G_COM_SW_SPI);
404
+U8G_PB_DEV(u8g_dev_sh1106_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_fn, U8G_COM_HW_SPI);
405
+U8G_PB_DEV(u8g_dev_sh1106_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_fn, U8G_COM_SSD_I2C);
406
+
407
+uint8_t u8g_dev_sh1106_128x64_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
408
+u8g_pb_t u8g_dev_sh1106_128x64_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_sh1106_128x64_2x_buf}; 
409
+u8g_dev_t u8g_dev_sh1106_128x64_2x_sw_spi = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_SW_SPI };
410
+u8g_dev_t u8g_dev_sh1106_128x64_2x_hw_spi = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_HW_SPI };
411
+u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_SSD_I2C };
412
+

+ 3
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1309_128x64.c Просмотреть файл

@@ -86,7 +86,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
86 86
   U8G_ESC_ADR(0),           /* instruction mode */
87 87
   U8G_ESC_CS(1),             /* enable chip */
88 88
   0x0ae,		/* display off */      
89
-  U8G_ESC_CS(1),             /* disable chip */
89
+  U8G_ESC_CS(0),             /* disable chip */
90 90
   U8G_ESC_END                /* end of sequence */
91 91
 };
92 92
 
@@ -95,7 +95,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
95 95
   U8G_ESC_CS(1),             /* enable chip */
96 96
   0x0af,		/* display on */      
97 97
   U8G_ESC_DLY(50),       /* delay 50 ms */
98
-  U8G_ESC_CS(1),             /* disable chip */
98
+  U8G_ESC_CS(0),             /* disable chip */
99 99
   U8G_ESC_END                /* end of sequence */
100 100
 };
101 101
 
@@ -104,7 +104,7 @@ uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
104 104
   switch(msg)
105 105
   {
106 106
     case U8G_DEV_MSG_INIT:
107
-      u8g_InitCom(u8g, dev);
107
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
108 108
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1309_128x64_init_seq);
109 109
       break;
110 110
     case U8G_DEV_MSG_STOP:

+ 9
- 5
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1322_nhd31oled_bw.c Просмотреть файл

@@ -199,7 +199,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
199 199
   U8G_ESC_ADR(0),           /* instruction mode */
200 200
   U8G_ESC_CS(1),             /* enable chip */
201 201
   0x0ae,		/* display off */      
202
-  U8G_ESC_CS(1),             /* disable chip */
202
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
203 203
   U8G_ESC_END                /* end of sequence */
204 204
 };
205 205
 
@@ -208,7 +208,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
208 208
   U8G_ESC_CS(1),             /* enable chip */
209 209
   0x0af,		/* display on */      
210 210
   U8G_ESC_DLY(50),       /* delay 50 ms */
211
-  U8G_ESC_CS(1),             /* disable chip */
211
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
212 212
   U8G_ESC_END                /* end of sequence */
213 213
 };
214 214
 
@@ -218,7 +218,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
218 218
   switch(msg)
219 219
   {
220 220
     case U8G_DEV_MSG_INIT:
221
-      u8g_InitCom(u8g, dev);
221
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
222 222
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_1bit_nhd_312_init_seq);
223 223
       break;
224 224
     case U8G_DEV_MSG_STOP:
@@ -244,6 +244,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
244 244
 	  u8g_WriteByte(u8g, dev, 0x0ff);
245 245
 	  u8g_WriteByte(u8g, dev, 0x0ff);
246 246
 #endif
247
+	  u8g_MicroDelay();	// for DUE?
247 248
 	  u8g_SetChipSelect(u8g, dev, 0);        
248 249
 	  p+=cnt;
249 250
 	}
@@ -255,6 +256,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
255 256
       u8g_WriteByte(u8g, dev, 0x081);
256 257
       u8g_SetAddress(u8g, dev, 1);          /* data mode */
257 258
       u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
259
+      u8g_MicroDelay();	// for DUE?
258 260
       u8g_SetChipSelect(u8g, dev, 0);      
259 261
       break;
260 262
     case U8G_DEV_MSG_SLEEP_ON:
@@ -273,7 +275,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
273 275
   switch(msg)
274 276
   {
275 277
     case U8G_DEV_MSG_INIT:
276
-      u8g_InitCom(u8g, dev);
278
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
277 279
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_1bit_nhd_312_init_seq);
278 280
       break;
279 281
     case U8G_DEV_MSG_STOP:
@@ -299,6 +301,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
299 301
 	  u8g_WriteByte(u8g, dev, 0x0ff);
300 302
 	  u8g_WriteByte(u8g, dev, 0x0ff);
301 303
 #endif
304
+	  u8g_MicroDelay();	// for DUE?	  
302 305
 	  u8g_SetChipSelect(u8g, dev, 0);        
303 306
 	  p+=cnt;
304 307
 	}
@@ -307,7 +310,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
307 310
     case U8G_DEV_MSG_CONTRAST:
308 311
       u8g_SetChipSelect(u8g, dev, 1);
309 312
       u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
310
-      u8g_WriteByte(u8g, dev, 0x081);
313
+      u8g_WriteByte(u8g, dev, 0x0c1);	/* 21 May 2013, fixed contrast command */
311 314
       u8g_SetAddress(u8g, dev, 1);          /* data mode */
312 315
       u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
313 316
       u8g_SetChipSelect(u8g, dev, 0);      
@@ -325,6 +328,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
325 328
 
326 329
 U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_bw_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_bw_fn, U8G_COM_SW_SPI);
327 330
 U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_bw_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_bw_fn, U8G_COM_HW_SPI);
331
+U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_bw_parallel , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_bw_fn, U8G_COM_FAST_PARALLEL);
328 332
 
329 333
 #define DWIDTH (WIDTH*2)
330 334
 uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_buf[DWIDTH] U8G_NOCOMMON ; 

+ 14
- 9
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1322_nhd31oled_gr.c Просмотреть файл

@@ -50,7 +50,7 @@
50 50
 #define WIDTH 248
51 51
 #endif
52 52
 #define HEIGHT 64
53
-#define PAGE_HEIGHT 8
53
+//#define PAGE_HEIGHT 8
54 54
 
55 55
 /* 
56 56
   http://www.newhavendisplay.com/app_notes/OLED_25664.txt 
@@ -199,7 +199,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
199 199
   U8G_ESC_ADR(0),           /* instruction mode */
200 200
   U8G_ESC_CS(1),             /* enable chip */
201 201
   0x0ae,		/* display off */      
202
-  U8G_ESC_CS(1),             /* disable chip */
202
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
203 203
   U8G_ESC_END                /* end of sequence */
204 204
 };
205 205
 
@@ -208,7 +208,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
208 208
   U8G_ESC_CS(1),             /* enable chip */
209 209
   0x0af,		/* display on */      
210 210
   U8G_ESC_DLY(50),       /* delay 50 ms */
211
-  U8G_ESC_CS(1),             /* disable chip */
211
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
212 212
   U8G_ESC_END                /* end of sequence */
213 213
 };
214 214
 
@@ -217,7 +217,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
217 217
   switch(msg)
218 218
   {
219 219
     case U8G_DEV_MSG_INIT:
220
-      u8g_InitCom(u8g, dev);
220
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
221 221
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_2bit_nhd_312_init_seq);
222 222
       break;
223 223
     case U8G_DEV_MSG_STOP:
@@ -243,6 +243,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
243 243
 	  u8g_WriteByte(u8g, dev, 0x00);
244 244
 	  u8g_WriteByte(u8g, dev, 0x00);
245 245
 #endif
246
+	  u8g_MicroDelay();	// for DUE?
246 247
 	  u8g_SetChipSelect(u8g, dev, 0);        
247 248
 	  p+=cnt;
248 249
 	}
@@ -254,6 +255,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
254 255
       u8g_WriteByte(u8g, dev, 0x081);
255 256
       u8g_SetAddress(u8g, dev, 1);          /* data mode */
256 257
       u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
258
+      u8g_MicroDelay();	// for DUE?
257 259
       u8g_SetChipSelect(u8g, dev, 0);      
258 260
       break;
259 261
     case U8G_DEV_MSG_SLEEP_ON:
@@ -272,7 +274,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
272 274
   switch(msg)
273 275
   {
274 276
     case U8G_DEV_MSG_INIT:
275
-      u8g_InitCom(u8g, dev);
277
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
276 278
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_2bit_nhd_312_init_seq);
277 279
       break;
278 280
     case U8G_DEV_MSG_STOP:
@@ -284,7 +286,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
284 286
 	uint8_t *p = pb->buf;
285 287
 	u8g_uint_t cnt;
286 288
 	cnt = pb->width;
287
-	cnt >>= 3;
289
+	cnt >>= 2;    /* 23 Oct 2013, changed to 2 */
288 290
 
289 291
 	for( i = 0; i < pb->p.page_height; i++ )
290 292
 	{
@@ -298,6 +300,7 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
298 300
 	  u8g_WriteByte(u8g, dev, 0x00);
299 301
 	  u8g_WriteByte(u8g, dev, 0x00);
300 302
 #endif
303
+	  u8g_MicroDelay();	// for DUE?
301 304
 	  u8g_SetChipSelect(u8g, dev, 0);        
302 305
 	  p+=cnt;
303 306
 	}
@@ -322,12 +325,14 @@ uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
322 325
 }
323 326
 
324 327
 
325
-U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_SW_SPI);
326
-U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_HW_SPI);
328
+U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_sw_spi , WIDTH, HEIGHT, 4, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_SW_SPI);
329
+U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_hw_spi , WIDTH, HEIGHT, 4, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_HW_SPI);
330
+U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_parallel , WIDTH, HEIGHT, 4, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_FAST_PARALLEL);
331
+
327 332
 
328 333
 #define DWIDTH (WIDTH*2)
329 334
 uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_buf[DWIDTH] U8G_NOCOMMON ; 
330
-u8g_pb_t u8g_dev_ssd1322_nhd31oled_2x_gr_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1322_nhd31oled_2x_gr_buf}; 
335
+u8g_pb_t u8g_dev_ssd1322_nhd31oled_2x_gr_pb = { {8, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1322_nhd31oled_2x_gr_buf}; 
331 336
 u8g_dev_t u8g_dev_ssd1322_nhd31oled_2x_gr_sw_spi = { u8g_dev_ssd1322_nhd31oled_2x_gr_fn, &u8g_dev_ssd1322_nhd31oled_2x_gr_pb, U8G_COM_SW_SPI };
332 337
 u8g_dev_t u8g_dev_ssd1322_nhd31oled_2x_gr_hw_spi = { u8g_dev_ssd1322_nhd31oled_2x_gr_fn, &u8g_dev_ssd1322_nhd31oled_2x_gr_pb, U8G_COM_HW_SPI };
333 338
 

+ 2
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_bw.c Просмотреть файл

@@ -191,7 +191,7 @@ uint8_t u8g_dev_ssd1325_nhd27oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
191 191
   switch(msg)
192 192
   {
193 193
     case U8G_DEV_MSG_INIT:
194
-      u8g_InitCom(u8g, dev);
194
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
195 195
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_init_seq);
196 196
       break;
197 197
     case U8G_DEV_MSG_STOP:
@@ -219,7 +219,7 @@ uint8_t u8g_dev_ssd1325_nhd27oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
219 219
   switch(msg)
220 220
   {
221 221
     case U8G_DEV_MSG_INIT:
222
-      u8g_InitCom(u8g, dev);
222
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
223 223
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_init_seq);
224 224
       break;
225 225
     case U8G_DEV_MSG_STOP:

+ 4
- 4
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_bw_new.c Просмотреть файл

@@ -112,7 +112,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
112 112
   U8G_ESC_ADR(0),           /* instruction mode */
113 113
   U8G_ESC_CS(1),             /* enable chip */
114 114
   0x0ae,		/* display off */      
115
-  U8G_ESC_CS(1),             /* disable chip */
115
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
116 116
   U8G_ESC_END                /* end of sequence */
117 117
 };
118 118
 
@@ -121,7 +121,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
121 121
   U8G_ESC_CS(1),             /* enable chip */
122 122
   0x0af,		/* display on */      
123 123
   U8G_ESC_DLY(50),       /* delay 50 ms */
124
-  U8G_ESC_CS(1),             /* disable chip */
124
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
125 125
   U8G_ESC_END                /* end of sequence */
126 126
 };
127 127
 
@@ -133,7 +133,7 @@ static uint8_t u8g_dev_ssd1325_nhd27oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8
133 133
     //case U8G_DEV_MSG_IS_BBX_INTERSECTION:
134 134
     //  return u8g_pb_IsIntersection((u8g_pb_t *)(dev->dev_mem), (u8g_dev_arg_bbx_t *)arg);
135 135
     case U8G_DEV_MSG_INIT:
136
-      u8g_InitCom(u8g, dev);
136
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
137 137
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_nhd_27_12864_init_seq);
138 138
       break;
139 139
     case U8G_DEV_MSG_STOP:
@@ -178,7 +178,7 @@ static uint8_t u8g_dev_ssd1325_nhd27oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, ui
178 178
   switch(msg)
179 179
   {
180 180
     case U8G_DEV_MSG_INIT:
181
-      u8g_InitCom(u8g, dev);
181
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
182 182
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_nhd_27_12864_init_seq);
183 183
       break;
184 184
     case U8G_DEV_MSG_STOP:

+ 2
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_gr.c Просмотреть файл

@@ -190,7 +190,7 @@ static uint8_t u8g_dev_ssd1325_nhd27oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8
190 190
   switch(msg)
191 191
   {
192 192
     case U8G_DEV_MSG_INIT:
193
-      u8g_InitCom(u8g, dev);
193
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
194 194
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq);
195 195
       break;
196 196
     case U8G_DEV_MSG_STOP:
@@ -218,7 +218,7 @@ static uint8_t u8g_dev_ssd1325_nhd27oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, ui
218 218
   switch(msg)
219 219
   {
220 220
     case U8G_DEV_MSG_INIT:
221
-      u8g_InitCom(u8g, dev);
221
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
222 222
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq);
223 223
       break;
224 224
     case U8G_DEV_MSG_STOP:

+ 4
- 4
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1325_nhd27oled_gr_new.c Просмотреть файл

@@ -111,7 +111,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
111 111
   U8G_ESC_ADR(0),           /* instruction mode */
112 112
   U8G_ESC_CS(1),             /* enable chip */
113 113
   0x0ae,		/* display off */      
114
-  U8G_ESC_CS(1),             /* disable chip */
114
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
115 115
   U8G_ESC_END                /* end of sequence */
116 116
 };
117 117
 
@@ -120,7 +120,7 @@ static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
120 120
   U8G_ESC_CS(1),             /* enable chip */
121 121
   0x0af,		/* display on */      
122 122
   U8G_ESC_DLY(50),       /* delay 50 ms */
123
-  U8G_ESC_CS(1),             /* disable chip */
123
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
124 124
   U8G_ESC_END                /* end of sequence */
125 125
 };
126 126
 
@@ -131,7 +131,7 @@ static uint8_t u8g_dev_ssd1325_nhd27oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8
131 131
   switch(msg)
132 132
   {
133 133
     case U8G_DEV_MSG_INIT:
134
-      u8g_InitCom(u8g, dev);
134
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
135 135
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq);
136 136
       break;
137 137
     case U8G_DEV_MSG_STOP:
@@ -178,7 +178,7 @@ static uint8_t u8g_dev_ssd1325_nhd27oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, ui
178 178
   switch(msg)
179 179
   {
180 180
     case U8G_DEV_MSG_INIT:
181
-      u8g_InitCom(u8g, dev);
181
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
182 182
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq);
183 183
       break;
184 184
     case U8G_DEV_MSG_STOP:

+ 2
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1327_96x96_gr.c Просмотреть файл

@@ -233,7 +233,7 @@ uint8_t u8g_dev_ssd1327_96x96_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
233 233
   switch(msg)
234 234
   {
235 235
     case U8G_DEV_MSG_INIT:
236
-      u8g_InitCom(u8g, dev);
236
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
237 237
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1327_2bit_96x96_init_seq);
238 238
       break;
239 239
     case U8G_DEV_MSG_STOP:
@@ -261,7 +261,7 @@ uint8_t u8g_dev_ssd1327_96x96_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
261 261
   switch(msg)
262 262
   {
263 263
     case U8G_DEV_MSG_INIT:
264
-      u8g_InitCom(u8g, dev);
264
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
265 265
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1327_2bit_96x96_init_seq);
266 266
       break;
267 267
     case U8G_DEV_MSG_STOP:

+ 787
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_ssd1351_128x128.c Просмотреть файл

@@ -0,0 +1,787 @@
1
+/*
2
+
3
+  u8g_dev_ssd1351_128x128.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2013, jamjardavies@gmail.com
8
+  Copyright (c) 2013, olikraus@gmail.com
9
+  All rights reserved.
10
+
11
+  Redistribution and use in source and binary forms, with or without modification, 
12
+  are permitted provided that the following conditions are met:
13
+
14
+  * Redistributions of source code must retain the above copyright notice, this list 
15
+    of conditions and the following disclaimer.
16
+    
17
+  * Redistributions in binary form must reproduce the above copyright notice, this 
18
+    list of conditions and the following disclaimer in the documentation and/or other 
19
+    materials provided with the distribution.
20
+
21
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
22
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
23
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
24
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
25
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
26
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
27
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
28
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
29
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
30
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
31
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
32
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
33
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
34
+  
35
+  History:
36
+  Initial version	20 May 2013 jamjardavies@gmail.com	
37
+  indexed device	22 May 2013 olikraus@gmail.com
38
+  
39
+*/
40
+
41
+#include "u8g.h"
42
+
43
+#define WIDTH		128
44
+#define HEIGHT		128
45
+#define PAGE_HEIGHT	8
46
+
47
+static const uint8_t u8g_dev_ssd1351_128x128_init_seq[] PROGMEM = {
48
+	U8G_ESC_CS(0),					/* disable chip */
49
+	U8G_ESC_DLY(50),
50
+	U8G_ESC_ADR(0),					/* instruction mode */
51
+	U8G_ESC_RST(1),					/* do reset low pulse with (1*16)+2 milliseconds */
52
+	U8G_ESC_CS(1),					/* enable chip */
53
+	U8G_ESC_DLY(50),
54
+
55
+	0xfd,							/* Command Lock */
56
+	U8G_ESC_ADR(1),
57
+	0x12,						
58
+
59
+	U8G_ESC_ADR(0),					/* instruction mode */
60
+	0xfd,
61
+	U8G_ESC_ADR(1),
62
+	0xb1,							/* Command Lock */
63
+
64
+	U8G_ESC_ADR(0),					/* instruction mode */
65
+	0xae,							/* Set Display Off */
66
+
67
+	U8G_ESC_ADR(0),					/* instruction mode */
68
+	0xb3,
69
+	U8G_ESC_ADR(1),
70
+	0xf1,							/* Front Clock Div */
71
+
72
+	U8G_ESC_ADR(0),					/* instruction mode */
73
+	0xca,
74
+	U8G_ESC_ADR(1),
75
+	0x7f,							/* Set Multiplex Ratio */
76
+
77
+	U8G_ESC_ADR(0),					/* instruction mode */
78
+	0xa0,
79
+	U8G_ESC_ADR(1),
80
+	0xb4,							/* Set Colour Depth */
81
+
82
+	U8G_ESC_ADR(0),					/* instruction mode */
83
+	0x15,
84
+	U8G_ESC_ADR(1),
85
+	0x00, 0x7f,						/* Set Column Address */
86
+
87
+	U8G_ESC_ADR(0),					/* instruction mode */
88
+	0x75,
89
+	U8G_ESC_ADR(1),
90
+	0x00, 0x7f,						/* Set Row Address */
91
+
92
+	U8G_ESC_ADR(0),					/* instruction mode */
93
+	0xa1,
94
+	U8G_ESC_ADR(1),
95
+	0x00,							/* Set Display Start Line */
96
+
97
+	U8G_ESC_ADR(0),					/* instruction mode */
98
+	0xa2,
99
+	U8G_ESC_ADR(1),
100
+	0x00,							/* Set Display Offset */
101
+
102
+	U8G_ESC_ADR(0),					/* instruction mode */
103
+	0xb5,
104
+	U8G_ESC_ADR(1),
105
+	0x00,							/* Set GPIO */
106
+
107
+	U8G_ESC_ADR(0),					/* instruction mode */
108
+	0xab,
109
+	U8G_ESC_ADR(1),
110
+	0x01,							/* Set Function Selection */
111
+
112
+	U8G_ESC_ADR(0),					/* instruction mode */
113
+	0xb1,
114
+	U8G_ESC_ADR(1),
115
+	0x32,							/* Set Phase Length */
116
+
117
+	U8G_ESC_ADR(0),					/* instruction mode */
118
+	0xb4,
119
+	U8G_ESC_ADR(1),
120
+	0xa0, 0xb5, 0x55,				/* Set Segment Low Voltage */
121
+
122
+	U8G_ESC_ADR(0),					/* instruction mode */
123
+	0xbb,
124
+	U8G_ESC_ADR(1),
125
+	0x17,							/* Set Precharge Voltage */
126
+
127
+	U8G_ESC_ADR(0),					/* instruction mode */
128
+	0xbe,
129
+	U8G_ESC_ADR(1),
130
+	0x05,							/* Set VComH Voltage */
131
+
132
+	U8G_ESC_ADR(0),					/* instruction mode */
133
+	0xc1,
134
+	U8G_ESC_ADR(1),
135
+	0xc8, 0x80, 0xc8,				/* Set Contrast */
136
+
137
+	U8G_ESC_ADR(0),					/* instruction mode */
138
+	0xc7,
139
+	U8G_ESC_ADR(1),
140
+	0x0f,							/* Set Master Contrast */
141
+
142
+	U8G_ESC_ADR(0),					/* instruction mode */
143
+	0xb6,
144
+	U8G_ESC_ADR(1),
145
+	0x01,							/* Set Second Precharge Period */
146
+
147
+	U8G_ESC_ADR(0),					/* instruction mode */
148
+	0xa6,							/* Set Display Mode Reset */
149
+
150
+
151
+	U8G_ESC_ADR(0),					/* instruction mode */
152
+	0xb8,							/* Set CMD Grayscale Lookup */
153
+	U8G_ESC_ADR(1),
154
+	0x05,
155
+	0x06,
156
+	0x07,
157
+	0x08,
158
+	0x09,
159
+	0x0a,
160
+	0x0b,
161
+	0x0c,
162
+	0x0D,
163
+	0x0E,
164
+	0x0F,
165
+	0x10,
166
+	0x11,
167
+	0x12,
168
+	0x13,
169
+	0x14,
170
+	0x15,
171
+	0x16,
172
+	0x18,
173
+	0x1a,
174
+	0x1b,
175
+	0x1C,
176
+	0x1D,
177
+	0x1F,
178
+	0x21,
179
+	0x23,
180
+	0x25,
181
+	0x27,
182
+	0x2A,
183
+	0x2D,
184
+	0x30,
185
+	0x33,
186
+	0x36,
187
+	0x39,
188
+	0x3C,
189
+	0x3F,
190
+	0x42,
191
+	0x45,
192
+	0x48,
193
+	0x4C,
194
+	0x50,
195
+	0x54,
196
+	0x58,
197
+	0x5C,
198
+	0x60,
199
+	0x64,
200
+	0x68,
201
+	0x6C,
202
+	0x70,
203
+	0x74,
204
+	0x78,
205
+	0x7D,
206
+	0x82,
207
+	0x87,
208
+	0x8C,
209
+	0x91,
210
+	0x96,
211
+	0x9B,
212
+	0xA0,
213
+	0xA5,
214
+	0xAA,
215
+	0xAF,
216
+	0xB4,
217
+
218
+	U8G_ESC_ADR(0),
219
+	0xaf,							/* Set Display On */
220
+	0x5c,
221
+	U8G_ESC_DLY(50),
222
+	U8G_ESC_CS(0),					/* disable chip */
223
+	U8G_ESC_ADR(1),
224
+	U8G_ESC_END						/* end of sequence */
225
+};
226
+
227
+
228
+/* set gpio to high */
229
+static const uint8_t u8g_dev_ssd1351_128x128gh_init_seq[] PROGMEM = {
230
+	U8G_ESC_CS(0),					/* disable chip */
231
+	U8G_ESC_DLY(50),
232
+	U8G_ESC_ADR(0),					/* instruction mode */
233
+	U8G_ESC_RST(1),					/* do reset low pulse with (1*16)+2 milliseconds */
234
+	U8G_ESC_CS(1),					/* enable chip */
235
+	U8G_ESC_DLY(50),
236
+
237
+	0xfd,							/* Command Lock */
238
+	U8G_ESC_ADR(1),
239
+	0x12,						
240
+
241
+	U8G_ESC_ADR(0),					/* instruction mode */
242
+	0xfd,
243
+	U8G_ESC_ADR(1),
244
+	0xb1,							/* Command Lock */
245
+
246
+	U8G_ESC_ADR(0),					/* instruction mode */
247
+	0xae,							/* Set Display Off */
248
+
249
+	U8G_ESC_ADR(0),					/* instruction mode */
250
+	0xb3,
251
+	U8G_ESC_ADR(1),
252
+	0xf1,							/* Front Clock Div */
253
+
254
+	U8G_ESC_ADR(0),					/* instruction mode */
255
+	0xca,
256
+	U8G_ESC_ADR(1),
257
+	0x7f,							/* Set Multiplex Ratio */
258
+
259
+	U8G_ESC_ADR(0),					/* instruction mode */
260
+	0xa0,
261
+	U8G_ESC_ADR(1),
262
+	0xb4,							/* Set Colour Depth */
263
+
264
+	U8G_ESC_ADR(0),					/* instruction mode */
265
+	0x15,
266
+	U8G_ESC_ADR(1),
267
+	0x00, 0x7f,						/* Set Column Address */
268
+
269
+	U8G_ESC_ADR(0),					/* instruction mode */
270
+	0x75,
271
+	U8G_ESC_ADR(1),
272
+	0x00, 0x7f,						/* Set Row Address */
273
+
274
+	U8G_ESC_ADR(0),					/* instruction mode */
275
+	0xa1,
276
+	U8G_ESC_ADR(1),
277
+	0x00,							/* Set Display Start Line */
278
+
279
+	U8G_ESC_ADR(0),					/* instruction mode */
280
+	0xa2,
281
+	U8G_ESC_ADR(1),
282
+	0x00,							/* Set Display Offset */
283
+
284
+	U8G_ESC_ADR(0),					/* instruction mode */
285
+	0xb5,
286
+	U8G_ESC_ADR(1),
287
+	0x03,							/* Set GPIO to High Level */
288
+
289
+	U8G_ESC_ADR(0),					/* instruction mode */
290
+	0xab,
291
+	U8G_ESC_ADR(1),
292
+	0x01,							/* Set Function Selection */
293
+
294
+	U8G_ESC_ADR(0),					/* instruction mode */
295
+	0xb1,
296
+	U8G_ESC_ADR(1),
297
+	0x32,							/* Set Phase Length */
298
+
299
+	U8G_ESC_ADR(0),					/* instruction mode */
300
+	0xb4,
301
+	U8G_ESC_ADR(1),
302
+	0xa0, 0xb5, 0x55,				/* Set Segment Low Voltage */
303
+
304
+	U8G_ESC_ADR(0),					/* instruction mode */
305
+	0xbb,
306
+	U8G_ESC_ADR(1),
307
+	0x17,							/* Set Precharge Voltage */
308
+
309
+	U8G_ESC_ADR(0),					/* instruction mode */
310
+	0xbe,
311
+	U8G_ESC_ADR(1),
312
+	0x05,							/* Set VComH Voltage */
313
+
314
+	U8G_ESC_ADR(0),					/* instruction mode */
315
+	0xc1,
316
+	U8G_ESC_ADR(1),
317
+	0xc8, 0x80, 0xc8,				/* Set Contrast */
318
+
319
+	U8G_ESC_ADR(0),					/* instruction mode */
320
+	0xc7,
321
+	U8G_ESC_ADR(1),
322
+	0x0f,							/* Set Master Contrast */
323
+
324
+	U8G_ESC_ADR(0),					/* instruction mode */
325
+	0xb6,
326
+	U8G_ESC_ADR(1),
327
+	0x01,							/* Set Second Precharge Period */
328
+
329
+	U8G_ESC_ADR(0),					/* instruction mode */
330
+	0xa6,							/* Set Display Mode Reset */
331
+
332
+
333
+	U8G_ESC_ADR(0),					/* instruction mode */
334
+	0xb8,							/* Set CMD Grayscale Lookup */
335
+	U8G_ESC_ADR(1),
336
+	0x05,
337
+	0x06,
338
+	0x07,
339
+	0x08,
340
+	0x09,
341
+	0x0a,
342
+	0x0b,
343
+	0x0c,
344
+	0x0D,
345
+	0x0E,
346
+	0x0F,
347
+	0x10,
348
+	0x11,
349
+	0x12,
350
+	0x13,
351
+	0x14,
352
+	0x15,
353
+	0x16,
354
+	0x18,
355
+	0x1a,
356
+	0x1b,
357
+	0x1C,
358
+	0x1D,
359
+	0x1F,
360
+	0x21,
361
+	0x23,
362
+	0x25,
363
+	0x27,
364
+	0x2A,
365
+	0x2D,
366
+	0x30,
367
+	0x33,
368
+	0x36,
369
+	0x39,
370
+	0x3C,
371
+	0x3F,
372
+	0x42,
373
+	0x45,
374
+	0x48,
375
+	0x4C,
376
+	0x50,
377
+	0x54,
378
+	0x58,
379
+	0x5C,
380
+	0x60,
381
+	0x64,
382
+	0x68,
383
+	0x6C,
384
+	0x70,
385
+	0x74,
386
+	0x78,
387
+	0x7D,
388
+	0x82,
389
+	0x87,
390
+	0x8C,
391
+	0x91,
392
+	0x96,
393
+	0x9B,
394
+	0xA0,
395
+	0xA5,
396
+	0xAA,
397
+	0xAF,
398
+	0xB4,
399
+
400
+	U8G_ESC_ADR(0),
401
+	0xaf,							/* Set Display On */
402
+	0x5c,
403
+	U8G_ESC_DLY(50),
404
+	U8G_ESC_CS(0),					/* disable chip */
405
+	U8G_ESC_ADR(1),
406
+	U8G_ESC_END						/* end of sequence */
407
+};
408
+
409
+#define u8g_dev_ssd1351_128x128_init_seq u8g_dev_ssd1351_128x128_init_seq
410
+
411
+static const uint8_t u8g_dev_ssd1351_128x128_column_seq[] PROGMEM = {
412
+	U8G_ESC_CS(1),
413
+	U8G_ESC_ADR(0), 0x15,
414
+	U8G_ESC_ADR(1), 0x00, 0x7f,
415
+	U8G_ESC_ADR(0), 0x75,
416
+	U8G_ESC_ADR(1), 0x00, 0x7f,
417
+	U8G_ESC_ADR(0), 0x5c,
418
+	U8G_ESC_ADR(1),
419
+	U8G_ESC_CS(0),
420
+	U8G_ESC_END
421
+};
422
+
423
+#define RGB332_STREAM_BYTES 8
424
+static uint8_t u8g_ssd1351_stream_bytes[RGB332_STREAM_BYTES*3];
425
+
426
+void u8g_ssd1351_to_stream(uint8_t *ptr)
427
+{
428
+  uint8_t cnt = RGB332_STREAM_BYTES;
429
+  uint8_t val;
430
+  uint8_t *dest = u8g_ssd1351_stream_bytes;
431
+  for( cnt = 0; cnt < RGB332_STREAM_BYTES; cnt++ )
432
+  {
433
+      val = *ptr++;
434
+      *dest++ = ((val & 0xe0) >> 2);
435
+      *dest++ = ((val & 0x1c) << 1);
436
+      *dest++ = ((val & 0x03) << 4);
437
+  } 
438
+}
439
+
440
+
441
+#ifdef OBSOLETE
442
+// Convert the internal RGB 332 to R
443
+static uint8_t u8g_ssd1351_get_r(uint8_t colour)
444
+{
445
+	//return ((colour & 0xe0) >> 5) * 9;
446
+	//return ((colour & 0xe0) >> 5) * 8;
447
+	return ((colour & 0xe0) >> 2) ;
448
+}
449
+
450
+// Convert the internal RGB 332 to G
451
+static uint8_t u8g_ssd1351_get_g(uint8_t colour)
452
+{
453
+	//return ((colour & 0x1c) >> 2) * 9;
454
+	//return ((colour & 0x1c) >> 2) * 8;
455
+	return ((colour & 0x1c) << 1);
456
+}
457
+
458
+// Convert the internal RGB 332 to B
459
+static uint8_t u8g_ssd1351_get_b(uint8_t colour)
460
+{
461
+	//return (colour & 0x03) * 21;
462
+	return (colour & 0x03) * 16;
463
+}
464
+#endif
465
+
466
+
467
+uint8_t u8g_dev_ssd1351_128x128_332_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
468
+{
469
+//	u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
470
+
471
+	switch(msg)
472
+	{
473
+	case U8G_DEV_MSG_INIT:
474
+		u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
475
+		u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_init_seq);
476
+		break;
477
+
478
+	case U8G_DEV_MSG_STOP:
479
+		break;
480
+
481
+	case U8G_DEV_MSG_PAGE_FIRST:
482
+		u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_column_seq);
483
+		break;
484
+
485
+	case U8G_DEV_MSG_PAGE_NEXT:
486
+		{
487
+			u8g_uint_t x;
488
+			uint8_t page_height;
489
+			uint8_t i;
490
+			u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
491
+			uint8_t *ptr = pb->buf;
492
+
493
+			u8g_SetChipSelect(u8g, dev, 1);
494
+
495
+			page_height = pb->p.page_y1;
496
+			page_height -= pb->p.page_y0;
497
+			page_height++;
498
+			for( i = 0; i < page_height; i++ )
499
+			{
500
+			  
501
+			  for (x = 0; x < pb->width; x+=RGB332_STREAM_BYTES)
502
+			  {
503
+			    u8g_ssd1351_to_stream(ptr);
504
+			    u8g_WriteSequence(u8g, dev, RGB332_STREAM_BYTES*3, u8g_ssd1351_stream_bytes);
505
+			    ptr += RGB332_STREAM_BYTES;
506
+			  }
507
+			}
508
+			u8g_SetChipSelect(u8g, dev, 0);
509
+		}
510
+
511
+		break;
512
+	case U8G_DEV_MSG_GET_MODE:
513
+	  return U8G_MODE_R3G3B2;
514
+	}
515
+
516
+	return u8g_dev_pb8h8_base_fn(u8g, dev, msg, arg);
517
+}
518
+
519
+uint8_t u8g_dev_ssd1351_128x128gh_332_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
520
+{
521
+//	u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
522
+
523
+	switch(msg)
524
+	{
525
+	case U8G_DEV_MSG_INIT:
526
+		u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
527
+		u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128gh_init_seq);
528
+		break;
529
+
530
+	case U8G_DEV_MSG_STOP:
531
+		break;
532
+
533
+	case U8G_DEV_MSG_PAGE_FIRST:
534
+		u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_column_seq);
535
+		break;
536
+
537
+	case U8G_DEV_MSG_PAGE_NEXT:
538
+		{
539
+			u8g_uint_t x;
540
+			uint8_t page_height;
541
+			uint8_t i;
542
+			u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
543
+			uint8_t *ptr = pb->buf;
544
+
545
+			u8g_SetChipSelect(u8g, dev, 1);
546
+
547
+			page_height = pb->p.page_y1;
548
+			page_height -= pb->p.page_y0;
549
+			page_height++;
550
+			for( i = 0; i < page_height; i++ )
551
+			{
552
+			  
553
+			  for (x = 0; x < pb->width; x+=RGB332_STREAM_BYTES)
554
+			  {
555
+			    u8g_ssd1351_to_stream(ptr);
556
+			    u8g_WriteSequence(u8g, dev, RGB332_STREAM_BYTES*3, u8g_ssd1351_stream_bytes);
557
+			    ptr += RGB332_STREAM_BYTES;
558
+			  }
559
+			}
560
+			u8g_SetChipSelect(u8g, dev, 0);
561
+		}
562
+
563
+		break;
564
+	case U8G_DEV_MSG_GET_MODE:
565
+	  return U8G_MODE_R3G3B2;
566
+	}
567
+
568
+	return u8g_dev_pb8h8_base_fn(u8g, dev, msg, arg);
569
+}
570
+
571
+static uint8_t u8g_dev_ssd1351_128x128_r[256];
572
+static uint8_t u8g_dev_ssd1351_128x128_g[256];
573
+static uint8_t u8g_dev_ssd1351_128x128_b[256];
574
+
575
+uint8_t u8g_dev_ssd1351_128x128_idx_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
576
+{
577
+//	u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
578
+
579
+	switch(msg)
580
+	{
581
+	case U8G_DEV_MSG_INIT:
582
+		u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
583
+		u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_init_seq);
584
+		break;
585
+
586
+	case U8G_DEV_MSG_STOP:
587
+		break;
588
+	
589
+	case U8G_DEV_MSG_SET_COLOR_ENTRY:
590
+		  u8g_dev_ssd1351_128x128_r[ ((u8g_dev_arg_irgb_t *)arg)->idx ] = ((u8g_dev_arg_irgb_t *)arg)->r;
591
+		  u8g_dev_ssd1351_128x128_g[ ((u8g_dev_arg_irgb_t *)arg)->idx ] = ((u8g_dev_arg_irgb_t *)arg)->g;
592
+		  u8g_dev_ssd1351_128x128_b[ ((u8g_dev_arg_irgb_t *)arg)->idx ] = ((u8g_dev_arg_irgb_t *)arg)->b;
593
+		  break;
594
+	
595
+	case U8G_DEV_MSG_PAGE_FIRST:
596
+		u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_column_seq);
597
+		break;
598
+
599
+	case U8G_DEV_MSG_PAGE_NEXT:
600
+		{
601
+			int x;
602
+			u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
603
+			uint8_t *ptr = pb->buf;
604
+
605
+			u8g_SetChipSelect(u8g, dev, 1);
606
+
607
+			for (x = 0; x < pb->width; x++)
608
+			{
609
+				u8g_WriteByte(u8g, dev, u8g_dev_ssd1351_128x128_r[(*ptr)>>2]);
610
+				u8g_WriteByte(u8g, dev, u8g_dev_ssd1351_128x128_g[(*ptr)>>2]);
611
+				u8g_WriteByte(u8g, dev, u8g_dev_ssd1351_128x128_b[(*ptr)>>2]);
612
+
613
+				ptr++;
614
+			}
615
+
616
+			u8g_SetChipSelect(u8g, dev, 0);
617
+		}
618
+
619
+		break;
620
+	case U8G_DEV_MSG_GET_MODE:
621
+	  return U8G_MODE_INDEX;
622
+	}
623
+
624
+	return u8g_dev_pb8h8_base_fn(u8g, dev, msg, arg);
625
+}
626
+
627
+void u8g_ssd1351_hicolor_to_stream(uint8_t *ptr)
628
+{
629
+  register uint8_t cnt = RGB332_STREAM_BYTES;
630
+  register uint8_t low, high, r, g, b;
631
+  uint8_t *dest = u8g_ssd1351_stream_bytes;
632
+  for( cnt = 0; cnt < RGB332_STREAM_BYTES; cnt++ )
633
+  {
634
+    low = *ptr++;
635
+    high = *ptr++;
636
+    
637
+    r = high & ~7;
638
+    r >>= 2;
639
+    b = low & 31;
640
+    b <<= 1;
641
+    g = high & 7;
642
+    g <<= 3;
643
+    g |= (low>>5)&7;
644
+    
645
+    *dest++ = r;
646
+    *dest++ = g;
647
+    *dest++ = b;
648
+  } 
649
+}
650
+
651
+
652
+uint8_t u8g_dev_ssd1351_128x128_hicolor_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
653
+{
654
+  switch(msg)
655
+  {
656
+    case U8G_DEV_MSG_INIT:
657
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
658
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_init_seq);
659
+      break;
660
+    case U8G_DEV_MSG_STOP:
661
+      break;
662
+    case U8G_DEV_MSG_PAGE_FIRST:
663
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_column_seq);
664
+      break;
665
+    case U8G_DEV_MSG_PAGE_NEXT:
666
+      {
667
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
668
+        uint8_t i, j;
669
+        uint8_t page_height;
670
+	uint8_t *ptr = pb->buf;
671
+
672
+	u8g_SetChipSelect(u8g, dev, 1);
673
+
674
+        page_height = pb->p.page_y1;
675
+        page_height -= pb->p.page_y0;
676
+        page_height++;
677
+        for( j = 0; j < page_height; j++ )
678
+        {
679
+	    for (i = 0; i < pb->width; i+=RGB332_STREAM_BYTES)
680
+	    {
681
+	      u8g_ssd1351_hicolor_to_stream(ptr);
682
+	      u8g_WriteSequence(u8g, dev, RGB332_STREAM_BYTES*3, u8g_ssd1351_stream_bytes);
683
+	      ptr += RGB332_STREAM_BYTES*2;
684
+	    }
685
+	  
686
+        }
687
+
688
+	u8g_SetChipSelect(u8g, dev, 0);
689
+	
690
+      }
691
+      break;    /* continue to base fn */
692
+    case U8G_DEV_MSG_GET_MODE:
693
+     return U8G_MODE_HICOLOR;
694
+  }
695
+  return u8g_dev_pbxh16_base_fn(u8g, dev, msg, arg);
696
+}
697
+
698
+uint8_t u8g_dev_ssd1351_128x128gh_hicolor_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
699
+{
700
+  switch(msg)
701
+  {
702
+    case U8G_DEV_MSG_INIT:
703
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
704
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128gh_init_seq);
705
+      break;
706
+    case U8G_DEV_MSG_STOP:
707
+      break;
708
+    case U8G_DEV_MSG_PAGE_FIRST:
709
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1351_128x128_column_seq);
710
+      break;
711
+    case U8G_DEV_MSG_PAGE_NEXT:
712
+      {
713
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
714
+        uint8_t i, j;
715
+        uint8_t page_height;
716
+	uint8_t *ptr = pb->buf;
717
+
718
+	u8g_SetChipSelect(u8g, dev, 1);
719
+
720
+        page_height = pb->p.page_y1;
721
+        page_height -= pb->p.page_y0;
722
+        page_height++;
723
+        for( j = 0; j < page_height; j++ )
724
+        {
725
+	    for (i = 0; i < pb->width; i+=RGB332_STREAM_BYTES)
726
+	    {
727
+	      u8g_ssd1351_hicolor_to_stream(ptr);
728
+	      u8g_WriteSequence(u8g, dev, RGB332_STREAM_BYTES*3, u8g_ssd1351_stream_bytes);
729
+	      ptr += RGB332_STREAM_BYTES*2;
730
+	    }
731
+	  
732
+        }
733
+
734
+	u8g_SetChipSelect(u8g, dev, 0);
735
+	
736
+      }
737
+      break;    /* continue to base fn */
738
+    case U8G_DEV_MSG_GET_MODE:
739
+     return U8G_MODE_HICOLOR;
740
+  }
741
+  return u8g_dev_pbxh16_base_fn(u8g, dev, msg, arg);
742
+}
743
+
744
+
745
+uint8_t u8g_dev_ssd1351_128x128_byte_buf[WIDTH*PAGE_HEIGHT] U8G_NOCOMMON ; 
746
+
747
+u8g_pb_t u8g_dev_ssd1351_128x128_byte_pb = { {PAGE_HEIGHT, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1351_128x128_byte_buf};  
748
+u8g_dev_t u8g_dev_ssd1351_128x128_332_sw_spi = { u8g_dev_ssd1351_128x128_332_fn, &u8g_dev_ssd1351_128x128_byte_pb, U8G_COM_SW_SPI };
749
+u8g_dev_t u8g_dev_ssd1351_128x128_332_hw_spi = { u8g_dev_ssd1351_128x128_332_fn, &u8g_dev_ssd1351_128x128_byte_pb, U8G_COM_HW_SPI };
750
+u8g_dev_t u8g_dev_ssd1351_128x128gh_332_sw_spi = { u8g_dev_ssd1351_128x128gh_332_fn, &u8g_dev_ssd1351_128x128_byte_pb, U8G_COM_SW_SPI };
751
+u8g_dev_t u8g_dev_ssd1351_128x128gh_332_hw_spi = { u8g_dev_ssd1351_128x128gh_332_fn, &u8g_dev_ssd1351_128x128_byte_pb, U8G_COM_HW_SPI };
752
+
753
+//u8g_dev_t u8g_dev_ssd1351_128x128_idx_sw_spi = { u8g_dev_ssd1351_128x128_idx_fn, &u8g_dev_ssd1351_128x128_byte_pb, U8G_COM_SW_SPI };
754
+//u8g_dev_t u8g_dev_ssd1351_128x128_idx_hw_spi = { u8g_dev_ssd1351_128x128_idx_fn, &u8g_dev_ssd1351_128x128_byte_pb, U8G_COM_HW_SPI };
755
+
756
+
757
+/* only half of the height, because two bytes are needed for one pixel */
758
+u8g_pb_t u8g_dev_ssd1351_128x128_hicolor_byte_pb = { {PAGE_HEIGHT/2, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1351_128x128_byte_buf}; 
759
+u8g_dev_t u8g_dev_ssd1351_128x128_hicolor_sw_spi = { u8g_dev_ssd1351_128x128_hicolor_fn, &u8g_dev_ssd1351_128x128_hicolor_byte_pb, U8G_COM_SW_SPI };
760
+u8g_dev_t u8g_dev_ssd1351_128x128_hicolor_hw_spi = { u8g_dev_ssd1351_128x128_hicolor_fn, &u8g_dev_ssd1351_128x128_hicolor_byte_pb, U8G_COM_HW_SPI };
761
+u8g_dev_t u8g_dev_ssd1351_128x128gh_hicolor_sw_spi = { u8g_dev_ssd1351_128x128gh_hicolor_fn, &u8g_dev_ssd1351_128x128_hicolor_byte_pb, U8G_COM_SW_SPI };
762
+u8g_dev_t u8g_dev_ssd1351_128x128gh_hicolor_hw_spi = { u8g_dev_ssd1351_128x128gh_hicolor_fn, &u8g_dev_ssd1351_128x128_hicolor_byte_pb, U8G_COM_HW_SPI };
763
+
764
+
765
+uint8_t u8g_dev_ssd1351_128x128_4x_byte_buf[WIDTH*PAGE_HEIGHT*4] U8G_NOCOMMON ; 
766
+
767
+u8g_pb_t u8g_dev_ssd1351_128x128_4x_332_byte_pb = { {PAGE_HEIGHT*4, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1351_128x128_4x_byte_buf};  
768
+u8g_dev_t u8g_dev_ssd1351_128x128_4x_332_sw_spi = { u8g_dev_ssd1351_128x128_332_fn, &u8g_dev_ssd1351_128x128_4x_332_byte_pb, U8G_COM_SW_SPI };
769
+u8g_dev_t u8g_dev_ssd1351_128x128_4x_332_hw_spi = { u8g_dev_ssd1351_128x128_332_fn, &u8g_dev_ssd1351_128x128_4x_332_byte_pb, U8G_COM_HW_SPI };
770
+u8g_dev_t u8g_dev_ssd1351_128x128gh_4x_332_sw_spi = { u8g_dev_ssd1351_128x128gh_332_fn, &u8g_dev_ssd1351_128x128_4x_332_byte_pb, U8G_COM_SW_SPI };
771
+u8g_dev_t u8g_dev_ssd1351_128x128gh_4x_332_hw_spi = { u8g_dev_ssd1351_128x128gh_332_fn, &u8g_dev_ssd1351_128x128_4x_332_byte_pb, U8G_COM_HW_SPI };
772
+
773
+u8g_pb_t u8g_dev_ssd1351_128x128_4x_hicolor_byte_pb = { {PAGE_HEIGHT/2*4, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_ssd1351_128x128_4x_byte_buf}; 
774
+u8g_dev_t u8g_dev_ssd1351_128x128_4x_hicolor_sw_spi = { u8g_dev_ssd1351_128x128_hicolor_fn, &u8g_dev_ssd1351_128x128_4x_hicolor_byte_pb, U8G_COM_SW_SPI };
775
+u8g_dev_t u8g_dev_ssd1351_128x128_4x_hicolor_hw_spi = { u8g_dev_ssd1351_128x128_hicolor_fn, &u8g_dev_ssd1351_128x128_4x_hicolor_byte_pb, U8G_COM_HW_SPI };
776
+u8g_dev_t u8g_dev_ssd1351_128x128gh_4x_hicolor_sw_spi = { u8g_dev_ssd1351_128x128gh_hicolor_fn, &u8g_dev_ssd1351_128x128_4x_hicolor_byte_pb, U8G_COM_SW_SPI };
777
+u8g_dev_t u8g_dev_ssd1351_128x128gh_4x_hicolor_hw_spi = { u8g_dev_ssd1351_128x128gh_hicolor_fn, &u8g_dev_ssd1351_128x128_4x_hicolor_byte_pb, U8G_COM_HW_SPI };
778
+
779
+
780
+/*
781
+U8G_PB_DEV(u8g_dev_ssd1351_128x128_332_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1351_128x128_332_fn, U8G_COM_SW_SPI);
782
+U8G_PB_DEV(u8g_dev_ssd1351_128x128_332_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1351_128x128_332_fn, U8G_COM_HW_SPI);
783
+
784
+U8G_PB_DEV(u8g_dev_ssd1351_128x128_idx_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1351_128x128_idx_fn, U8G_COM_SW_SPI);
785
+U8G_PB_DEV(u8g_dev_ssd1351_128x128_idx_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1351_128x128_idx_fn, U8G_COM_HW_SPI);
786
+*/
787
+

+ 53
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_64128n.c Просмотреть файл

@@ -96,7 +96,7 @@ static const uint8_t u8g_dev_st7565_64128n_sleep_on[] PROGMEM = {
96 96
   0x000,		                /* indicator register set (not sure if this is required) */
97 97
   0x0ae,		/* display off */      
98 98
   0x0a5,		/* all points on */      
99
-  U8G_ESC_CS(1),             /* disable chip */
99
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
100 100
   U8G_ESC_END                /* end of sequence */
101 101
 };
102 102
 
@@ -106,7 +106,7 @@ static const uint8_t u8g_dev_st7565_64128n_sleep_off[] PROGMEM = {
106 106
   0x0a4,		/* all points off */      
107 107
   0x0af,		/* display on */      
108 108
   U8G_ESC_DLY(50),       /* delay 50 ms */
109
-  U8G_ESC_CS(1),             /* disable chip */
109
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
110 110
   U8G_ESC_END                /* end of sequence */
111 111
 };
112 112
 
@@ -115,7 +115,7 @@ uint8_t u8g_dev_st7565_64128n_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
115 115
   switch(msg)
116 116
   {
117 117
     case U8G_DEV_MSG_INIT:
118
-      u8g_InitCom(u8g, dev);
118
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
119 119
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_init_seq);
120 120
       break;
121 121
     case U8G_DEV_MSG_STOP:
@@ -148,6 +148,56 @@ uint8_t u8g_dev_st7565_64128n_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
148 148
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
149 149
 }
150 150
 
151
+uint8_t u8g_dev_st7565_64128n_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
152
+{
153
+  switch(msg)
154
+  {
155
+    case U8G_DEV_MSG_INIT:
156
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
157
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_init_seq);
158
+      break;
159
+    case U8G_DEV_MSG_STOP:
160
+      break;
161
+    case U8G_DEV_MSG_PAGE_NEXT:
162
+      {
163
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
164
+	
165
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_data_start);    
166
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
167
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
168
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
169
+        u8g_SetChipSelect(u8g, dev, 0);
170
+	
171
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_data_start);    
172
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
173
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
174
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
175
+        u8g_SetChipSelect(u8g, dev, 0);
176
+      }
177
+      break;
178
+    case U8G_DEV_MSG_CONTRAST:
179
+      u8g_SetChipSelect(u8g, dev, 1);
180
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
181
+      u8g_WriteByte(u8g, dev, 0x081);
182
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
183
+      u8g_SetChipSelect(u8g, dev, 0);      
184
+      return 1;
185
+    case U8G_DEV_MSG_SLEEP_ON:
186
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_sleep_on);    
187
+      return 1;
188
+    case U8G_DEV_MSG_SLEEP_OFF:
189
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_sleep_off);    
190
+      return 1;
191
+  }
192
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
193
+}
194
+
151 195
 U8G_PB_DEV(u8g_dev_st7565_64128n_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_fn, U8G_COM_SW_SPI);
152 196
 U8G_PB_DEV(u8g_dev_st7565_64128n_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_fn, U8G_COM_HW_SPI);
197
+U8G_PB_DEV(u8g_dev_st7565_64128n_parallel, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_fn, U8G_COM_PARALLEL);
153 198
 
199
+uint8_t u8g_dev_st7565_64128n_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
200
+u8g_pb_t u8g_dev_st7565_64128n_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_st7565_64128n_2x_buf}; 
201
+u8g_dev_t u8g_dev_st7565_64128n_2x_sw_spi = { u8g_dev_st7565_64128n_2x_fn, &u8g_dev_st7565_64128n_2x_pb, U8G_COM_SW_SPI };
202
+u8g_dev_t u8g_dev_st7565_64128n_2x_hw_spi = { u8g_dev_st7565_64128n_2x_fn, &u8g_dev_st7565_64128n_2x_pb, U8G_COM_HW_SPI };
203
+u8g_dev_t u8g_dev_st7565_64128n_2x_hw_parallel = { u8g_dev_st7565_64128n_2x_fn, &u8g_dev_st7565_64128n_2x_pb, U8G_COM_PARALLEL };

+ 53
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_dogm128.c Просмотреть файл

@@ -82,7 +82,7 @@ static const uint8_t u8g_dev_st7565_dogm128_sleep_on[] PROGMEM = {
82 82
   0x000,		                /* indicator register set (not sure if this is required) */
83 83
   0x0ae,		/* display off */      
84 84
   0x0a5,		/* all points on */      
85
-  U8G_ESC_CS(1),             /* disable chip */
85
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
86 86
   U8G_ESC_END                /* end of sequence */
87 87
 };
88 88
 
@@ -92,7 +92,7 @@ static const uint8_t u8g_dev_st7565_dogm128_sleep_off[] PROGMEM = {
92 92
   0x0a4,		/* all points off */      
93 93
   0x0af,		/* display on */      
94 94
   U8G_ESC_DLY(50),       /* delay 50 ms */
95
-  U8G_ESC_CS(1),             /* disable chip */
95
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
96 96
   U8G_ESC_END                /* end of sequence */
97 97
 };
98 98
 
@@ -101,7 +101,7 @@ uint8_t u8g_dev_st7565_dogm128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
101 101
   switch(msg)
102 102
   {
103 103
     case U8G_DEV_MSG_INIT:
104
-      u8g_InitCom(u8g, dev);
104
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
105 105
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm128_init_seq);
106 106
       break;
107 107
     case U8G_DEV_MSG_STOP:
@@ -134,7 +134,57 @@ uint8_t u8g_dev_st7565_dogm128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
134 134
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
135 135
 }
136 136
 
137
+uint8_t u8g_dev_st7565_dogm128_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
138
+{
139
+  switch(msg)
140
+  {
141
+    case U8G_DEV_MSG_INIT:
142
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
143
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm128_init_seq);
144
+      break;
145
+    case U8G_DEV_MSG_STOP:
146
+      break;
147
+    case U8G_DEV_MSG_PAGE_NEXT:
148
+      {
149
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
150
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm128_data_start);    
151
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
152
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
153
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
154
+        u8g_SetChipSelect(u8g, dev, 0);
155
+	
156
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm128_data_start);    
157
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
158
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
159
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
160
+        u8g_SetChipSelect(u8g, dev, 0);
161
+	
162
+      }
163
+      break;
164
+    case U8G_DEV_MSG_CONTRAST:
165
+      u8g_SetChipSelect(u8g, dev, 1);
166
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
167
+      u8g_WriteByte(u8g, dev, 0x081);
168
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
169
+      u8g_SetChipSelect(u8g, dev, 0);      
170
+      return 1;
171
+    case U8G_DEV_MSG_SLEEP_ON:
172
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm128_sleep_on);    
173
+      return 1;
174
+    case U8G_DEV_MSG_SLEEP_OFF:
175
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm128_sleep_off);    
176
+      return 1;
177
+  }
178
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
179
+}
180
+
137 181
 U8G_PB_DEV(u8g_dev_st7565_dogm128_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_dogm128_fn, U8G_COM_SW_SPI);
138 182
 U8G_PB_DEV(u8g_dev_st7565_dogm128_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_dogm128_fn, U8G_COM_HW_SPI);
183
+U8G_PB_DEV(u8g_dev_st7565_dogm128_parallel, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_dogm128_fn, U8G_COM_PARALLEL);
139 184
 
140 185
 
186
+uint8_t u8g_dev_st7565_dogm128_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
187
+u8g_pb_t u8g_dev_st7565_dogm128_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_st7565_dogm128_2x_buf}; 
188
+u8g_dev_t u8g_dev_st7565_dogm128_2x_sw_spi = { u8g_dev_st7565_dogm128_2x_fn, &u8g_dev_st7565_dogm128_2x_pb, U8G_COM_SW_SPI };
189
+u8g_dev_t u8g_dev_st7565_dogm128_2x_hw_spi = { u8g_dev_st7565_dogm128_2x_fn, &u8g_dev_st7565_dogm128_2x_pb, U8G_COM_HW_SPI };
190
+u8g_dev_t u8g_dev_st7565_dogm128_2x_parallel = { u8g_dev_st7565_dogm128_2x_fn, &u8g_dev_st7565_dogm128_2x_pb, U8G_COM_PARALLEL };

+ 3
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_dogm132.c Просмотреть файл

@@ -101,7 +101,7 @@ static const uint8_t u8g_dev_st7565_dogm132_sleep_on[] PROGMEM = {
101 101
   0x000,		                /* indicator register set (not sure if this is required) */
102 102
   0x0ae,		/* display off */      
103 103
   0x0a5,		/* all points on */      
104
-  U8G_ESC_CS(1),             /* disable chip */
104
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
105 105
   U8G_ESC_END                /* end of sequence */
106 106
 };
107 107
 
@@ -111,7 +111,7 @@ static const uint8_t u8g_dev_st7565_dogm132_sleep_off[] PROGMEM = {
111 111
   0x0a4,		/* all points off */      
112 112
   0x0af,		/* display on */      
113 113
   U8G_ESC_DLY(50),       /* delay 50 ms */
114
-  U8G_ESC_CS(1),             /* disable chip */
114
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
115 115
   U8G_ESC_END                /* end of sequence */
116 116
 };
117 117
 
@@ -120,7 +120,7 @@ uint8_t u8g_dev_st7565_dogm132_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
120 120
   switch(msg)
121 121
   {
122 122
     case U8G_DEV_MSG_INIT:
123
-      u8g_InitCom(u8g, dev);
123
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
124 124
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_dogm132_init_seq);
125 125
       break;
126 126
     case U8G_DEV_MSG_STOP:

+ 51
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_lm6059.c Просмотреть файл

@@ -98,7 +98,7 @@ static const uint8_t u8g_dev_st7565_lm6059_sleep_on[] PROGMEM = {
98 98
   0x000,		                /* indicator register set (not sure if this is required) */
99 99
   0x0ae,		/* display off */      
100 100
   0x0a5,		/* all points on */      
101
-  U8G_ESC_CS(1),             /* disable chip */
101
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
102 102
   U8G_ESC_END                /* end of sequence */
103 103
 };
104 104
 
@@ -108,7 +108,7 @@ static const uint8_t u8g_dev_st7565_lm6059_sleep_off[] PROGMEM = {
108 108
   0x0a4,		/* all points off */      
109 109
   0x0af,		/* display on */      
110 110
   U8G_ESC_DLY(50),       /* delay 50 ms */
111
-  U8G_ESC_CS(1),             /* disable chip */
111
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
112 112
   U8G_ESC_END                /* end of sequence */
113 113
 };
114 114
 
@@ -118,7 +118,7 @@ uint8_t u8g_dev_st7565_lm6059_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
118 118
   switch(msg)
119 119
   {
120 120
     case U8G_DEV_MSG_INIT:
121
-      u8g_InitCom(u8g, dev);
121
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
122 122
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6059_init_seq);
123 123
       break;
124 124
     case U8G_DEV_MSG_STOP:
@@ -151,7 +151,55 @@ uint8_t u8g_dev_st7565_lm6059_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
151 151
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
152 152
 }
153 153
 
154
+uint8_t u8g_dev_st7565_lm6059_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
155
+{
156
+  switch(msg)
157
+  {
158
+    case U8G_DEV_MSG_INIT:
159
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
160
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6059_init_seq);
161
+      break;
162
+    case U8G_DEV_MSG_STOP:
163
+      break;
164
+    case U8G_DEV_MSG_PAGE_NEXT:
165
+      {
166
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
167
+	
168
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6059_data_start);    
169
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
170
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
171
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
172
+        u8g_SetChipSelect(u8g, dev, 0);
173
+
174
+	u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6059_data_start);    
175
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
176
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
177
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
178
+        u8g_SetChipSelect(u8g, dev, 0);
179
+      }
180
+      break;
181
+    case U8G_DEV_MSG_CONTRAST:
182
+      u8g_SetChipSelect(u8g, dev, 1);
183
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
184
+      u8g_WriteByte(u8g, dev, 0x081);
185
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
186
+      u8g_SetChipSelect(u8g, dev, 0);      
187
+      return 1;
188
+    case U8G_DEV_MSG_SLEEP_ON:
189
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6059_sleep_on);    
190
+      return 1;
191
+    case U8G_DEV_MSG_SLEEP_OFF:
192
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6059_sleep_off);    
193
+      return 1;
194
+  }
195
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
196
+}
197
+
154 198
 U8G_PB_DEV(u8g_dev_st7565_lm6059_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_lm6059_fn, U8G_COM_SW_SPI);
155 199
 U8G_PB_DEV(u8g_dev_st7565_lm6059_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_lm6059_fn, U8G_COM_HW_SPI);
156 200
 
157 201
 
202
+uint8_t u8g_dev_st7565_lm6059_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
203
+u8g_pb_t u8g_dev_st7565_lm6059_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_st7565_lm6059_2x_buf}; 
204
+u8g_dev_t u8g_dev_st7565_lm6059_2x_sw_spi = { u8g_dev_st7565_lm6059_2x_fn, &u8g_dev_st7565_lm6059_2x_pb, U8G_COM_SW_SPI };
205
+u8g_dev_t u8g_dev_st7565_lm6059_2x_hw_spi = { u8g_dev_st7565_lm6059_2x_fn, &u8g_dev_st7565_lm6059_2x_pb, U8G_COM_HW_SPI };

+ 51
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_lm6063.c Просмотреть файл

@@ -129,7 +129,7 @@ static const uint8_t u8g_dev_st7565_st7565_sleep_on[] PROGMEM = {
129 129
   0x000,		                /* indicator register set (not sure if this is required) */
130 130
   0x0ae,		/* display off */      
131 131
   0x0a5,		/* all points on */      
132
-  U8G_ESC_CS(1),             /* disable chip */
132
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
133 133
   U8G_ESC_END                /* end of sequence */
134 134
 };
135 135
 
@@ -139,7 +139,7 @@ static const uint8_t u8g_dev_st7565_st7565_sleep_off[] PROGMEM = {
139 139
   0x0a4,		/* all points off */      
140 140
   0x0af,		/* display on */      
141 141
   U8G_ESC_DLY(50),       /* delay 50 ms */
142
-  U8G_ESC_CS(1),             /* disable chip */
142
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
143 143
   U8G_ESC_END                /* end of sequence */
144 144
 };
145 145
 
@@ -149,7 +149,7 @@ uint8_t u8g_dev_st7565_lm6063_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
149 149
   switch(msg)
150 150
   {
151 151
     case U8G_DEV_MSG_INIT:
152
-      u8g_InitCom(u8g, dev);
152
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
153 153
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6063_init_seq);
154 154
       break;
155 155
     case U8G_DEV_MSG_STOP:
@@ -182,7 +182,55 @@ uint8_t u8g_dev_st7565_lm6063_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
182 182
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
183 183
 }
184 184
 
185
+uint8_t u8g_dev_st7565_lm6063_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
186
+{
187
+  switch(msg)
188
+  {
189
+    case U8G_DEV_MSG_INIT:
190
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
191
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6063_init_seq);
192
+      break;
193
+    case U8G_DEV_MSG_STOP:
194
+      break;
195
+    case U8G_DEV_MSG_PAGE_NEXT:
196
+      {
197
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
198
+	
199
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6063_data_start);    
200
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
201
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
202
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
203
+        u8g_SetChipSelect(u8g, dev, 0);
204
+
205
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_lm6063_data_start);    
206
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
207
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
208
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
209
+        u8g_SetChipSelect(u8g, dev, 0);
210
+      }
211
+      break;
212
+    case U8G_DEV_MSG_CONTRAST:
213
+      u8g_SetChipSelect(u8g, dev, 1);
214
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
215
+      u8g_WriteByte(u8g, dev, 0x081);
216
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
217
+      u8g_SetChipSelect(u8g, dev, 0);      
218
+      return 1;
219
+    case U8G_DEV_MSG_SLEEP_ON:
220
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_st7565_sleep_on);    
221
+      return 1;
222
+    case U8G_DEV_MSG_SLEEP_OFF:
223
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_st7565_sleep_off);    
224
+      return 1;
225
+  }
226
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
227
+}
228
+
185 229
 U8G_PB_DEV(u8g_dev_st7565_lm6063_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_lm6063_fn, U8G_COM_SW_SPI);
186 230
 U8G_PB_DEV(u8g_dev_st7565_lm6063_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_lm6063_fn, U8G_COM_HW_SPI);
187 231
 
232
+uint8_t u8g_dev_st7565_lm6063_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
233
+u8g_pb_t u8g_dev_st7565_lm6063_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_st7565_lm6063_2x_buf}; 
234
+u8g_dev_t u8g_dev_st7565_lm6063_2x_sw_spi = { u8g_dev_st7565_lm6063_2x_fn, &u8g_dev_st7565_lm6063_2x_pb, U8G_COM_SW_SPI };
235
+u8g_dev_t u8g_dev_st7565_lm6063_2x_hw_spi = { u8g_dev_st7565_lm6063_2x_fn, &u8g_dev_st7565_lm6063_2x_pb, U8G_COM_HW_SPI };
188 236
 

+ 5
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_nhd_c12832.c Просмотреть файл

@@ -86,7 +86,7 @@ static const uint8_t u8g_dev_st7565_c12832_sleep_on[] PROGMEM = {
86 86
   0x000,		                /* indicator register set (not sure if this is required) */
87 87
   0x0ae,		/* display off */      
88 88
   0x0a5,		/* all points on */      
89
-  U8G_ESC_CS(1),             /* disable chip */
89
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
90 90
   U8G_ESC_END                /* end of sequence */
91 91
 };
92 92
 
@@ -96,7 +96,7 @@ static const uint8_t u8g_dev_st7565_c12832_sleep_off[] PROGMEM = {
96 96
   0x0a4,		/* all points off */      
97 97
   0x0af,		/* display on */      
98 98
   U8G_ESC_DLY(50),       /* delay 50 ms */
99
-  U8G_ESC_CS(1),             /* disable chip */
99
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
100 100
   U8G_ESC_END                /* end of sequence */
101 101
 };
102 102
 
@@ -105,7 +105,7 @@ uint8_t u8g_dev_st7565_c12832_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
105 105
   switch(msg)
106 106
   {
107 107
     case U8G_DEV_MSG_INIT:
108
-      u8g_InitCom(u8g, dev);
108
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
109 109
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_c12832_init_seq);
110 110
       break;
111 111
     case U8G_DEV_MSG_STOP:
@@ -141,3 +141,5 @@ uint8_t u8g_dev_st7565_c12832_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
141 141
 U8G_PB_DEV(u8g_dev_st7565_nhd_c12832_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_c12832_fn, U8G_COM_SW_SPI);
142 142
 U8G_PB_DEV(u8g_dev_st7565_nhd_c12832_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_c12832_fn, U8G_COM_HW_SPI);
143 143
 U8G_PB_DEV(u8g_dev_st7565_nhd_c12832_parallel, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_c12832_fn, U8G_COM_PARALLEL);
144
+U8G_PB_DEV(u8g_dev_st7565_nhd_c12832_hw_usart_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_c12832_fn, U8G_COM_HW_USART_SPI);
145
+

+ 52
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7565_nhd_c12864.c Просмотреть файл

@@ -87,7 +87,7 @@ static const uint8_t u8g_dev_st7565_c12864_sleep_on[] PROGMEM = {
87 87
   0x000,		                /* indicator register set (not sure if this is required) */
88 88
   0x0ae,		/* display off */      
89 89
   0x0a5,		/* all points on */      
90
-  U8G_ESC_CS(1),             /* disable chip */
90
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
91 91
   U8G_ESC_END                /* end of sequence */
92 92
 };
93 93
 
@@ -97,7 +97,7 @@ static const uint8_t u8g_dev_st7565_c12864_sleep_off[] PROGMEM = {
97 97
   0x0a4,		/* all points off */      
98 98
   0x0af,		/* display on */      
99 99
   U8G_ESC_DLY(50),       /* delay 50 ms */
100
-  U8G_ESC_CS(1),             /* disable chip */
100
+  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
101 101
   U8G_ESC_END                /* end of sequence */
102 102
 };
103 103
 
@@ -106,7 +106,7 @@ uint8_t u8g_dev_st7565_nhd_c12864_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
106 106
   switch(msg)
107 107
   {
108 108
     case U8G_DEV_MSG_INIT:
109
-      u8g_InitCom(u8g, dev);
109
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
110 110
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_nhd_c12864_init_seq);
111 111
       break;
112 112
     case U8G_DEV_MSG_STOP:
@@ -139,7 +139,56 @@ uint8_t u8g_dev_st7565_nhd_c12864_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
139 139
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
140 140
 }
141 141
 
142
+uint8_t u8g_dev_st7565_nhd_c12864_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
143
+{
144
+  switch(msg)
145
+  {
146
+    case U8G_DEV_MSG_INIT:
147
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
148
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_nhd_c12864_init_seq);
149
+      break;
150
+    case U8G_DEV_MSG_STOP:
151
+      break;
152
+    case U8G_DEV_MSG_PAGE_NEXT:
153
+      {
154
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
155
+	
156
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_nhd_c12864_data_start);    
157
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
158
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
159
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
160
+        u8g_SetChipSelect(u8g, dev, 0);
161
+	
162
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_nhd_c12864_data_start);    
163
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
164
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
165
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
166
+        u8g_SetChipSelect(u8g, dev, 0);
167
+      }
168
+      break;
169
+    case U8G_DEV_MSG_CONTRAST:
170
+      u8g_SetChipSelect(u8g, dev, 1);
171
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
172
+      u8g_WriteByte(u8g, dev, 0x081);
173
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
174
+      u8g_SetChipSelect(u8g, dev, 0);      
175
+      return 1;
176
+    case U8G_DEV_MSG_SLEEP_ON:
177
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_c12864_sleep_on);    
178
+      return 1;
179
+    case U8G_DEV_MSG_SLEEP_OFF:
180
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_c12864_sleep_off);    
181
+      return 1;
182
+  }
183
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
184
+}
185
+
142 186
 U8G_PB_DEV(u8g_dev_st7565_nhd_c12864_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_nhd_c12864_fn, U8G_COM_SW_SPI);
143 187
 U8G_PB_DEV(u8g_dev_st7565_nhd_c12864_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_nhd_c12864_fn, U8G_COM_HW_SPI);
144 188
 
145 189
 
190
+uint8_t u8g_dev_st7565_nhd_c12864_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
191
+u8g_pb_t u8g_dev_st7565_nhd_c12864_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_st7565_nhd_c12864_2x_buf}; 
192
+u8g_dev_t u8g_dev_st7565_nhd_c12864_2x_sw_spi = { u8g_dev_st7565_nhd_c12864_2x_fn, &u8g_dev_st7565_nhd_c12864_2x_pb, U8G_COM_SW_SPI };
193
+u8g_dev_t u8g_dev_st7565_nhd_c12864_2x_hw_spi = { u8g_dev_st7565_nhd_c12864_2x_fn, &u8g_dev_st7565_nhd_c12864_2x_pb, U8G_COM_HW_SPI };
194
+

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7687_c144mvgd.c Просмотреть файл

@@ -363,7 +363,7 @@ uint8_t u8g_dev_st7687_c144mvgd_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
363 363
   switch(msg)
364 364
   {
365 365
     case U8G_DEV_MSG_INIT:
366
-      u8g_InitCom(u8g, dev);
366
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
367 367
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7687_c144mvgd_init_seq);
368 368
       break;
369 369
     case U8G_DEV_MSG_STOP:

+ 7
- 3
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7920_128x64.c Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 /*
2 2
 
3
-  u8g_dev_st7565_128x64.c
3
+  u8g_dev_st7920_128x64.c
4 4
 
5 5
   Universal 8bit Graphics Library
6 6
   
@@ -66,7 +66,7 @@ uint8_t u8g_dev_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
66 66
   switch(msg)
67 67
   {
68 68
     case U8G_DEV_MSG_INIT:
69
-      u8g_InitCom(u8g, dev);
69
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
70 70
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_128x64_init_seq);
71 71
       break;
72 72
     case U8G_DEV_MSG_STOP:
@@ -114,7 +114,7 @@ uint8_t u8g_dev_st7920_128x64_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
114 114
   switch(msg)
115 115
   {
116 116
     case U8G_DEV_MSG_INIT:
117
-      u8g_InitCom(u8g, dev);
117
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
118 118
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_128x64_init_seq);
119 119
       break;
120 120
     case U8G_DEV_MSG_STOP:
@@ -160,6 +160,9 @@ uint8_t u8g_dev_st7920_128x64_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
160 160
 U8G_PB_DEV(u8g_dev_st7920_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_fn, U8G_COM_ST7920_SW_SPI);
161 161
 U8G_PB_DEV(u8g_dev_st7920_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_fn, U8G_COM_ST7920_HW_SPI);
162 162
 U8G_PB_DEV(u8g_dev_st7920_128x64_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_fn, U8G_COM_FAST_PARALLEL);
163
+U8G_PB_DEV(u8g_dev_st7920_128x64_custom, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_fn, u8g_com_arduino_st7920_custom_fn);
164
+
165
+
163 166
 
164 167
 #define QWIDTH (WIDTH*4)
165 168
 uint8_t u8g_dev_st7920_128x64_4x_buf[QWIDTH] U8G_NOCOMMON ; 
@@ -167,5 +170,6 @@ u8g_pb_t u8g_dev_st7920_128x64_4x_pb = { {32, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_
167 170
 u8g_dev_t u8g_dev_st7920_128x64_4x_sw_spi = { u8g_dev_st7920_128x64_4x_fn, &u8g_dev_st7920_128x64_4x_pb, U8G_COM_ST7920_SW_SPI };
168 171
 u8g_dev_t u8g_dev_st7920_128x64_4x_hw_spi = { u8g_dev_st7920_128x64_4x_fn, &u8g_dev_st7920_128x64_4x_pb, U8G_COM_ST7920_HW_SPI };
169 172
 u8g_dev_t u8g_dev_st7920_128x64_4x_8bit = { u8g_dev_st7920_128x64_4x_fn, &u8g_dev_st7920_128x64_4x_pb, U8G_COM_FAST_PARALLEL };
173
+u8g_dev_t u8g_dev_st7920_128x64_4x_custom = { u8g_dev_st7920_128x64_4x_fn, &u8g_dev_st7920_128x64_4x_pb, u8g_com_arduino_st7920_custom_fn };
170 174
 
171 175
 

+ 2
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7920_192x32.c Просмотреть файл

@@ -65,7 +65,7 @@ uint8_t u8g_dev_st7920_192x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
65 65
   switch(msg)
66 66
   {
67 67
     case U8G_DEV_MSG_INIT:
68
-      u8g_InitCom(u8g, dev);
68
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
69 69
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_192x32_init_seq);
70 70
       break;
71 71
     case U8G_DEV_MSG_STOP:
@@ -103,7 +103,7 @@ uint8_t u8g_dev_st7920_192x32_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
103 103
   switch(msg)
104 104
   {
105 105
     case U8G_DEV_MSG_INIT:
106
-      u8g_InitCom(u8g, dev);
106
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
107 107
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_192x32_init_seq);
108 108
       break;
109 109
     case U8G_DEV_MSG_STOP:

+ 2
- 2
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_st7920_202x32.c Просмотреть файл

@@ -68,7 +68,7 @@ uint8_t u8g_dev_st7920_202x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
68 68
   switch(msg)
69 69
   {
70 70
     case U8G_DEV_MSG_INIT:
71
-      u8g_InitCom(u8g, dev);
71
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
72 72
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_202x32_init_seq);
73 73
       break;
74 74
     case U8G_DEV_MSG_STOP:
@@ -106,7 +106,7 @@ uint8_t u8g_dev_st7920_202x32_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
106 106
   switch(msg)
107 107
   {
108 108
     case U8G_DEV_MSG_INIT:
109
-      u8g_InitCom(u8g, dev);
109
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
110 110
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_202x32_init_seq);
111 111
       break;
112 112
     case U8G_DEV_MSG_STOP:

+ 193
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_128x128.c Просмотреть файл

@@ -0,0 +1,193 @@
1
+/*
2
+
3
+  u8g_dev_t6963_128x128.c
4
+  
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2013, olikraus@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+    
34
+        
35
+  Application Notes for the MGLS 128x128
36
+    www.baso.no/content/pdf/T6963C_Application.pdf
37
+  
38
+  Hitachi App Notes:
39
+    https://www.sparkfun.com/datasheets/LCD/Monochrome/AN-029-Toshiba_T6963C.pdf
40
+
41
+  Notes:
42
+    The font selection pins should generate the 8x8 font.
43
+    For the MGLS240128TZ only FS1 is available on pin 18.
44
+    FS1 must be low to generate the 8x8 font.
45
+  
46
+
47
+*/
48
+
49
+#include "u8g.h"
50
+
51
+#define WIDTH 128
52
+#define HEIGHT 128
53
+#define PAGE_HEIGHT 16
54
+
55
+
56
+/*
57
+  http://www.mark-products.com/graphics.htm#240x64%20Pixel%20Format
58
+*/
59
+
60
+/* text is not used, so settings are not relevant */
61
+static const uint8_t u8g_dev_t6963_128x128_init_seq[] PROGMEM = {
62
+  U8G_ESC_CS(0),             /* disable chip */
63
+  U8G_ESC_ADR(0),           /* data mode */
64
+  U8G_ESC_RST(15),           /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
65
+
66
+  U8G_ESC_CS(1),             /* enable chip */
67
+  U8G_ESC_DLY(50),         /* delay 50 ms */
68
+
69
+  U8G_ESC_ADR(0),               /* data mode */
70
+  0x000,                                /* low byte */
71
+  0x000,                                /* height byte */
72
+  U8G_ESC_ADR(1),               /* instruction mode */
73
+  0x021,                                /* set cursor position */
74
+  
75
+  U8G_ESC_ADR(0),               /* data mode */
76
+  0x000,                                /* low byte */
77
+  0x000,                                /* height byte */
78
+  U8G_ESC_ADR(1),               /* instruction mode */
79
+  0x022,                                /* set offset */
80
+
81
+  U8G_ESC_ADR(0),               /* data mode */
82
+  0x000,                                /* low byte */
83
+  0x000,                                /* height byte */
84
+  U8G_ESC_ADR(1),               /* instruction mode */
85
+  0x040,				     /* text home */
86
+
87
+  U8G_ESC_ADR(0),               /* data mode */
88
+  WIDTH/8,                      	    /* low byte */
89
+  0x000,                                /* height byte */
90
+  U8G_ESC_ADR(1),               /* instruction mode */
91
+  0x041,				     /* text columns */
92
+
93
+  U8G_ESC_ADR(0),               /* data mode */
94
+  0x000,                                /* low byte */
95
+  0x000,                                /* height byte */
96
+  U8G_ESC_ADR(1),               /* instruction mode */
97
+  0x042,				     /* graphics home */
98
+
99
+  U8G_ESC_ADR(0),               /* data mode */
100
+  WIDTH/8,                            /* low byte */
101
+  0x000,                                /* height byte */
102
+  U8G_ESC_ADR(1),               /* instruction mode */
103
+  0x043,				     /* graphics columns */
104
+  
105
+  // mode set
106
+  // 0x080: Internal CG, OR Mode
107
+  // 0x081: Internal CG, EXOR Mode
108
+  // 0x083: Internal CG, AND Mode
109
+  // 0x088: External CG, OR Mode
110
+  // 0x089: External CG, EXOR Mode
111
+  // 0x08B: External CG, AND Mode
112
+  U8G_ESC_ADR(1),               /* instruction mode */
113
+  0x080,                                /* mode register: OR Mode, Internal Character Mode */
114
+  
115
+  U8G_ESC_ADR(1),               /* instruction mode */
116
+  // display mode
117
+  // 0x090: Display off
118
+  // 0x094: Graphic off, text on, cursor off, blink off
119
+  // 0x096: Graphic off, text on, cursor on, blink off
120
+  // 0x097: Graphic off, text on, cursor on, blink on
121
+  // 0x098: Graphic on, text off, cursor off, blink off
122
+  // 0x09a: Graphic on, text off, cursor on, blink off
123
+  // ...
124
+  // 0x09c: Graphic on, text on, cursor off, blink off
125
+  // 0x09f: Graphic on, text on, cursor on, blink on
126
+  0x098,                                /* mode register: Display Mode, Graphics on, Text off, Cursor off */
127
+  
128
+  U8G_ESC_ADR(0),               /* data mode */
129
+  0x000,                                /* low byte */
130
+  0x000,                                /* height byte */
131
+  U8G_ESC_ADR(1),               /* instruction mode */
132
+  0x024,                                /* set adr pointer */
133
+  
134
+
135
+  U8G_ESC_DLY(100),         /* delay 100 ms */
136
+  
137
+  U8G_ESC_ADR(0),               /* data mode */
138
+  U8G_ESC_CS(0),             /* disable chip */
139
+  U8G_ESC_END                /* end of sequence */
140
+};
141
+
142
+uint8_t u8g_dev_t6963_128x128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
143
+{
144
+  switch(msg)
145
+  {
146
+    case U8G_DEV_MSG_INIT:
147
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);    
148
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_t6963_128x128_init_seq);
149
+      break;
150
+    case U8G_DEV_MSG_STOP:
151
+      break;
152
+    case U8G_DEV_MSG_PAGE_NEXT:
153
+      {
154
+        uint8_t y, i;
155
+        uint16_t disp_ram_adr;
156
+        uint8_t *ptr;
157
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
158
+
159
+        
160
+	u8g_SetAddress(u8g, dev, 0);           /* data mode */
161
+        u8g_SetChipSelect(u8g, dev, 1);
162
+        y = pb->p.page_y0;
163
+        ptr = pb->buf;
164
+        disp_ram_adr = WIDTH/8;
165
+        disp_ram_adr *= y;
166
+        for( i = 0; i < PAGE_HEIGHT; i ++ )
167
+        {
168
+          u8g_SetAddress(u8g, dev, 0);           /* data mode */
169
+          u8g_WriteByte(u8g, dev, disp_ram_adr&255 );      /* address low byte */
170
+          u8g_WriteByte(u8g, dev, disp_ram_adr>>8 );      /* address hight byte */
171
+          u8g_SetAddress(u8g, dev, 1);           /* cmd mode */
172
+          u8g_WriteByte(u8g, dev, 0x024 );      /* set adr ptr */
173
+	  
174
+          u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);	
175
+	  
176
+          ptr += WIDTH/8;
177
+          disp_ram_adr += WIDTH/8;
178
+        }
179
+	u8g_SetAddress(u8g, dev, 0);           /* data mode */
180
+        u8g_SetChipSelect(u8g, dev, 0);
181
+      }
182
+      break;
183
+  }
184
+  return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg);
185
+}
186
+
187
+// U8G_PB_DEV(u8g_dev_t6963_128x128_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_t6963_128x128_fn, U8G_COM_T6963);
188
+
189
+uint8_t u8g_dev_t6963_128x128_2x_bw_buf[WIDTH/8*PAGE_HEIGHT] U8G_NOCOMMON ; 
190
+u8g_pb_t u8g_dev_t6963_128x128_2x_bw_pb = { {PAGE_HEIGHT, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_t6963_128x128_2x_bw_buf}; 
191
+u8g_dev_t u8g_dev_t6963_128x128_8bit = { u8g_dev_t6963_128x128_fn, &u8g_dev_t6963_128x128_2x_bw_pb, U8G_COM_T6963 };
192
+
193
+

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_128x64.c Просмотреть файл

@@ -142,7 +142,7 @@ uint8_t u8g_dev_t6963_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *a
142 142
   switch(msg)
143 143
   {
144 144
     case U8G_DEV_MSG_INIT:
145
-      u8g_InitCom(u8g, dev);    
145
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);    
146 146
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_t6963_128x64_init_seq);
147 147
       break;
148 148
     case U8G_DEV_MSG_STOP:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_240x128.c Просмотреть файл

@@ -146,7 +146,7 @@ uint8_t u8g_dev_t6963_240x128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
146 146
   switch(msg)
147 147
   {
148 148
     case U8G_DEV_MSG_INIT:
149
-      u8g_InitCom(u8g, dev);    
149
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);    
150 150
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_t6963_240x128_init_seq);
151 151
       break;
152 152
     case U8G_DEV_MSG_STOP:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_t6963_240x64.c Просмотреть файл

@@ -146,7 +146,7 @@ uint8_t u8g_dev_t6963_240x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *a
146 146
   switch(msg)
147 147
   {
148 148
     case U8G_DEV_MSG_INIT:
149
-      u8g_InitCom(u8g, dev);    
149
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);    
150 150
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_t6963_240x64_init_seq);
151 151
       break;
152 152
     case U8G_DEV_MSG_STOP:

+ 1
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_tls8204_84x48.c Просмотреть файл

@@ -78,7 +78,7 @@ uint8_t u8g_dev_tls8204_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
78 78
   switch(msg)
79 79
   {
80 80
     case U8G_DEV_MSG_INIT:
81
-      u8g_InitCom(u8g, dev);
81
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
82 82
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_tls8204_init_seq);
83 83
       break;
84 84
     case U8G_DEV_MSG_STOP:

+ 201
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1601_c128032.c Просмотреть файл

@@ -0,0 +1,201 @@
1
+/*
2
+
3
+  u8g_dev_uc1601_c128032.c
4
+  
5
+  LCD-AG-C128032R-DIW W/KK E6 PBF from http://www.artronic.pl/o_produkcie.php?id=1343
6
+
7
+  Universal 8bit Graphics Library
8
+  
9
+  Copyright (c) 2013, olikraus@gmail.com
10
+  All rights reserved.
11
+
12
+  Redistribution and use in source and binary forms, with or without modification, 
13
+  are permitted provided that the following conditions are met:
14
+
15
+  * Redistributions of source code must retain the above copyright notice, this list 
16
+    of conditions and the following disclaimer.
17
+    
18
+  * Redistributions in binary form must reproduce the above copyright notice, this 
19
+    list of conditions and the following disclaimer in the documentation and/or other 
20
+    materials provided with the distribution.
21
+
22
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
23
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
24
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
25
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
26
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
27
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
28
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
29
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
30
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
31
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
32
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
33
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
34
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
35
+  
36
+  
37
+*/
38
+
39
+#include "u8g.h"
40
+
41
+#define WIDTH 128
42
+#define HEIGHT 32
43
+#define PAGE_HEIGHT 8
44
+
45
+/* init sequence */
46
+static const uint8_t u8g_dev_uc1601_c128032_init_seq[] PROGMEM = {
47
+  U8G_ESC_CS(0),            	/* disable chip */
48
+  U8G_ESC_ADR(0),           	/* instruction mode */
49
+  U8G_ESC_CS(1),             	/* enable chip */
50
+  U8G_ESC_RST(15),           	/* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
51
+
52
+  0x0a3,		        /* 0x0a3: LCD bias 1/7 ,  0x0a2: LCD bias 1/9 */
53
+  0x0a0,		        /* 0x0a0: ADC set to normal,  0x0a1 ADC set to inverted */
54
+  0x0c8,                        /* common output mode: set scan direction normal operation/SHL Select, 0x0c0 --> SHL = 0, normal, 0x0c8 --> SHL = 1 */
55
+  0x0c2,				/* 22 May 2013: mirror x */
56
+  
57
+  0x040,		        /* set display start line */
58
+  
59
+  0x028 | 0x04,                 /* power control: turn on voltage converter */
60
+  U8G_ESC_DLY(50),         	/* delay 50 ms */
61
+
62
+  0x028 | 0x06,                 /* power control: turn on voltage regulator */
63
+  U8G_ESC_DLY(50),         	/* delay 50 ms */
64
+  
65
+  0x028 | 0x07,                 /* power control: turn on voltage follower */
66
+  U8G_ESC_DLY(10),         	/* delay 10 ms */
67
+
68
+  0x020| 0x06,		        /* set V0 voltage resistor ratio to 6  */
69
+  
70
+  0x0af,		        /* display on */
71
+  
72
+  //0x081,		        /* set contrast */
73
+  //0x018,		        /* contrast value*/
74
+ 
75
+  0x0a6,                      /* display normal, bit val 0: LCD pixel off. */
76
+
77
+  U8G_ESC_DLY(100),       	/* delay 100 ms */
78
+  U8G_ESC_CS(0),             	/* disable chip */
79
+  U8G_ESC_END                	/* end of sequence */
80
+};
81
+
82
+static const uint8_t u8g_dev_uc1601_c128032_data_start[] PROGMEM = {
83
+  U8G_ESC_ADR(0),           	/* instruction mode */
84
+  U8G_ESC_CS(1),             	/* enable chip */
85
+  0x010,			/* set upper 4 bit of the col adr to 0 */
86
+  0x004,			/* set lower 4 bit of the col adr  */      
87
+  U8G_ESC_END                	/* end of sequence */
88
+};
89
+
90
+static const uint8_t u8g_dev_uc1601_c128032_sleep_on[] PROGMEM = {
91
+  U8G_ESC_ADR(0),           	/* instruction mode */
92
+  U8G_ESC_CS(1),             	/* enable chip */
93
+  0x0ac,			/* static indicator off */
94
+  0x000,		        /* indicator register set (not sure if this is required) */
95
+  0x0ae,			/* display off */      
96
+  0x0a5,			/* all points on */      
97
+  U8G_ESC_CS(1),             	/* disable chip */
98
+  U8G_ESC_END                	/* end of sequence */
99
+};
100
+
101
+static const uint8_t u8g_dev_uc1601_c128032_sleep_off[] PROGMEM = {
102
+  U8G_ESC_ADR(0),           	/* instruction mode */
103
+  U8G_ESC_CS(1),             	/* enable chip */
104
+  0x0a4,			/* all points off */      
105
+  0x0af,			/* display on */      
106
+  U8G_ESC_DLY(50),       	/* delay 50 ms */
107
+  U8G_ESC_CS(1),             	/* disable chip */
108
+  U8G_ESC_END                	/* end of sequence */
109
+};
110
+
111
+
112
+uint8_t u8g_dev_uc1601_c128032_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
113
+{
114
+  switch(msg)
115
+  {
116
+    case U8G_DEV_MSG_INIT:
117
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
118
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_init_seq);
119
+      break;
120
+    case U8G_DEV_MSG_STOP:
121
+      break;
122
+    case U8G_DEV_MSG_PAGE_NEXT:
123
+      {
124
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
125
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_data_start);    
126
+        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (UC1601) */
127
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
128
+        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
129
+          return 0;
130
+        u8g_SetChipSelect(u8g, dev, 0);
131
+      }
132
+      break;
133
+    case U8G_DEV_MSG_CONTRAST:
134
+      u8g_SetChipSelect(u8g, dev, 1);
135
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
136
+      u8g_WriteByte(u8g, dev, 0x081);
137
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
138
+      u8g_SetChipSelect(u8g, dev, 0);      
139
+      return 1;
140
+    case U8G_DEV_MSG_SLEEP_ON:
141
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_sleep_on);    
142
+      return 1;
143
+    case U8G_DEV_MSG_SLEEP_OFF:
144
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_sleep_off);    
145
+      return 1;
146
+  }
147
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
148
+}
149
+
150
+uint8_t u8g_dev_uc1601_c128032_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
151
+{
152
+  switch(msg)
153
+  {
154
+    case U8G_DEV_MSG_INIT:
155
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
156
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_init_seq);
157
+      break;
158
+    case U8G_DEV_MSG_STOP:
159
+      break;
160
+    case U8G_DEV_MSG_PAGE_NEXT:
161
+      {
162
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
163
+	
164
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_data_start);    
165
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (UC1601) */
166
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
167
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
168
+        u8g_SetChipSelect(u8g, dev, 0);
169
+	
170
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_data_start);    
171
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (UC1601) */
172
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
173
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
174
+        u8g_SetChipSelect(u8g, dev, 0);
175
+      }
176
+      break;
177
+    case U8G_DEV_MSG_CONTRAST:
178
+      u8g_SetChipSelect(u8g, dev, 1);
179
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
180
+      u8g_WriteByte(u8g, dev, 0x081);
181
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
182
+      u8g_SetChipSelect(u8g, dev, 0);      
183
+      return 1;
184
+    case U8G_DEV_MSG_SLEEP_ON:
185
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_sleep_on);    
186
+      return 1;
187
+    case U8G_DEV_MSG_SLEEP_OFF:
188
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1601_c128032_sleep_off);    
189
+      return 1;
190
+  }
191
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
192
+}
193
+
194
+U8G_PB_DEV(u8g_dev_uc1601_c128032_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1601_c128032_fn, U8G_COM_SW_SPI);
195
+U8G_PB_DEV(u8g_dev_uc1601_c128032_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1601_c128032_fn, U8G_COM_HW_SPI);
196
+
197
+uint8_t u8g_dev_uc1601_c128032_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
198
+u8g_pb_t u8g_dev_uc1601_c128032_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_uc1601_c128032_2x_buf}; 
199
+u8g_dev_t u8g_dev_uc1601_c128032_2x_sw_spi = { u8g_dev_uc1601_c128032_2x_fn, &u8g_dev_uc1601_c128032_2x_pb, U8G_COM_SW_SPI };
200
+u8g_dev_t u8g_dev_uc1601_c128032_2x_hw_spi = { u8g_dev_uc1601_c128032_2x_fn, &u8g_dev_uc1601_c128032_2x_pb, U8G_COM_HW_SPI };
201
+

+ 200
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1608_240x128.c Просмотреть файл

@@ -0,0 +1,200 @@
1
+/*
2
+
3
+
4
+
5
+  u8g_dev_uc1608_240x128.c
6
+
7
+  Universal 8bit Graphics Library
8
+
9
+  Copyright (c) 2013, olikraus@gmail.com (original 240x64 library)
10
+  Modified by thieringpeti@gmail.com for Raystar rx240128 family displays
11
+  All rights reserved.
12
+
13
+  Redistribution and use in source and binary forms, with or without modification,
14
+  are permitted provided that the following conditions are met:
15
+
16
+  * Redistributions of source code must retain the above copyright notice, this list
17
+    of conditions and the following disclaimer.
18
+
19
+  * Redistributions in binary form must reproduce the above copyright notice, this
20
+    list of conditions and the following disclaimer in the documentation and/or other
21
+    materials provided with the distribution.
22
+
23
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+
37
+
38
+*/
39
+
40
+/*
41
+Display: http://www.tme.eu/en/details/rx240128a-ghw/lcd-graphic-displays/raystar-optronics/
42
+Connection: HW / SW SPI.
43
+To get this display working, You need some extra capacitors:
44
+
45
+connect 4.7uF caps between:
46
+    PIN1 & PIN2 VB1 +-
47
+    PIN3 & PIN4 VB0 -+
48
+connect 0.1uF caps between:
49
+    VLCD and VSS
50
+    VBIAS and VSS
51
+You can find some schematics with a 10M resistor parallellized with the VLCD capacitor.
52
+
53
+Select 4-bit SPI mode.
54
+
55
+Connect D7 (PIN9) To VDD (+3.3V)
56
+Connect D1, D2, D4, D5, D6 to GND (PINS 10,11,12,14,15)
57
+Connect WR0, WR1, BM0, BM1 to GND (PINS 17,18,22,23)
58
+
59
+D0: (PIN16) AVR's SCK pin (HW SPI)
60
+D3: (PIN13) AVR's MOSI pin (HW SPI)
61
+CD: (PIN19) used as A0 in the library
62
+CS: (PIN21) Connect to the defined CS pin, and You can re-use the HW SPI in different routines.
63
+RST: (PIN20) optional reset, can be defined in the function, resets on initialization.
64
+
65
+Adjust contrast if necessary. Default: 0x072.
66
+
67
+*/
68
+
69
+#include "u8g.h"
70
+
71
+#define WIDTH 240
72
+#define HEIGHT 128
73
+#define PAGE_HEIGHT 8
74
+
75
+/* see also ERC24064-1 for init sequence example */
76
+static const uint8_t u8g_dev_uc1608_240x128_init_seq[] PROGMEM = {
77
+  U8G_ESC_CS(1),             /* disable chip (UC1608 has positive logic for CS) */
78
+  U8G_ESC_ADR(0),           /* instruction mode */
79
+  U8G_ESC_RST(1),           /* do reset low pulse with (15*16)+2 milliseconds */
80
+
81
+
82
+  U8G_ESC_CS(0),             /* enable chip */
83
+  0x0e2,            		/* soft reset */
84
+
85
+  U8G_ESC_DLY(100),       /* delay 100 ms */
86
+  U8G_ESC_DLY(100),       /* delay 100 ms */
87
+  0x026,                        /* MUX rate and temperature compensation */
88
+
89
+  0x0c8,		                /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */
90
+
91
+  0x0eb,		                /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7*/
92
+                                /* default 0x0ea for 240x128 */
93
+  0x081,		                /* set contrast (bits 0..5) and gain (bits 6/7) */
94
+  0x072,		                /* default for 240x128 displays: 0x072*/
95
+
96
+  0x02f,		                /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */
97
+  U8G_ESC_DLY(50),         /* delay 50 ms */
98
+
99
+  0x040,		                /* set display start line to 0 */
100
+  0x090,		                /* no fixed lines */
101
+  0x089,		                /* RAM access control  */
102
+
103
+  0x0af,		                /* disable sleep mode  */
104
+  0x0a4,		                /* normal display  */
105
+  0x0a5,		                /* display all points, ST7565, UC1610 */
106
+  // 0x0a7,                        /* inverse display */
107
+  0x0a6,                        /* normal display */
108
+
109
+  U8G_ESC_DLY(100),       /* delay 100 ms */
110
+  0x0a4,		                /* normal display */
111
+  U8G_ESC_CS(1),             /* disable chip */
112
+  U8G_ESC_END                /* end of sequence */
113
+};
114
+
115
+static const uint8_t u8g_dev_uc1608_240x128_data_start[] PROGMEM = {
116
+  U8G_ESC_ADR(0),           /* instruction mode */
117
+  U8G_ESC_CS(0),             /* enable chip */
118
+  0x010,		/* set upper 4 bit of the col adr to 0 (UC1608)  */
119
+  0x000,		/* set lower 4 bit of the col adr to 0 */
120
+  U8G_ESC_END                /* end of sequence */
121
+};
122
+
123
+uint8_t u8g_dev_uc1608_240x128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
124
+{
125
+  switch(msg)
126
+  {
127
+    case U8G_DEV_MSG_INIT:
128
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
129
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x128_init_seq);
130
+      break;
131
+    case U8G_DEV_MSG_STOP:
132
+      break;
133
+    case U8G_DEV_MSG_PAGE_NEXT:
134
+      {
135
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
136
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x128_data_start);
137
+        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (UC1608) */
138
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
139
+        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
140
+          return 0;
141
+        u8g_SetChipSelect(u8g, dev, 1);
142
+      }
143
+      break;
144
+    case U8G_DEV_MSG_CONTRAST:
145
+      u8g_SetChipSelect(u8g, dev, 0);
146
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
147
+      u8g_WriteByte(u8g, dev, 0x081);
148
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);	/* set contrast from, keep gain at 0 */
149
+      u8g_SetChipSelect(u8g, dev, 1);
150
+      return 1;
151
+  }
152
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
153
+}
154
+
155
+uint8_t u8g_dev_uc1608_240x128_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
156
+{
157
+  switch(msg)
158
+  {
159
+    case U8G_DEV_MSG_INIT:
160
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
161
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x128_init_seq);
162
+      break;
163
+    case U8G_DEV_MSG_STOP:
164
+      break;
165
+    case U8G_DEV_MSG_PAGE_NEXT:
166
+      {
167
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
168
+
169
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x128_data_start);
170
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
171
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
172
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf);
173
+        u8g_SetChipSelect(u8g, dev, 0);
174
+
175
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x128_data_start);
176
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
177
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
178
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
179
+        u8g_SetChipSelect(u8g, dev, 0);
180
+      }
181
+      break;
182
+    case U8G_DEV_MSG_CONTRAST:
183
+      u8g_SetChipSelect(u8g, dev, 1);
184
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
185
+      u8g_WriteByte(u8g, dev, 0x081);
186
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
187
+      u8g_SetChipSelect(u8g, dev, 0);
188
+      return 1;
189
+  }
190
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
191
+}
192
+
193
+U8G_PB_DEV(u8g_dev_uc1608_240x128_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1608_240x128_fn, U8G_COM_SW_SPI);
194
+U8G_PB_DEV(u8g_dev_uc1608_240x128_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1608_240x128_fn, U8G_COM_HW_SPI);
195
+
196
+uint8_t u8g_dev_uc1608_240x128_2x_buf[WIDTH*2] U8G_NOCOMMON ;
197
+u8g_pb_t u8g_dev_uc1608_240x128_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_uc1608_240x128_2x_buf};
198
+u8g_dev_t u8g_dev_uc1608_240x128_2x_sw_spi = { u8g_dev_uc1608_240x128_2x_fn, &u8g_dev_uc1608_240x128_2x_pb, U8G_COM_SW_SPI };
199
+u8g_dev_t u8g_dev_uc1608_240x128_2x_hw_spi = { u8g_dev_uc1608_240x128_2x_fn, &u8g_dev_uc1608_240x128_2x_pb, U8G_COM_HW_SPI };
200
+

+ 168
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1608_240x64.c Просмотреть файл

@@ -0,0 +1,168 @@
1
+/*
2
+
3
+  u8g_dev_uc1608_240x64.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2013, olikraus@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+  
34
+  
35
+*/
36
+
37
+#include "u8g.h"
38
+
39
+#define WIDTH 240
40
+#define HEIGHT 64
41
+#define PAGE_HEIGHT 8
42
+
43
+/* see also ERC24064-1 for init sequence example */
44
+static const uint8_t u8g_dev_uc1608_240x64_init_seq[] PROGMEM = {
45
+  U8G_ESC_CS(1),             /* disable chip (UC1608 has positive logic for CS) */
46
+  U8G_ESC_ADR(0),           /* instruction mode */
47
+  U8G_ESC_RST(1),           /* do reset low pulse with (15*16)+2 milliseconds */
48
+  
49
+  
50
+  U8G_ESC_CS(0),             /* enable chip */
51
+  0x0e2,            		/* soft reset */
52
+  
53
+  U8G_ESC_DLY(100),       /* delay 100 ms */
54
+  U8G_ESC_DLY(100),       /* delay 100 ms */
55
+#if HEIGHT <= 96
56
+  0x023,				/* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */
57
+#else
58
+  /* 30 Nov 2013: not tested */
59
+  0x027,				/* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */
60
+#endif  
61
+  0x0c8,		                /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */
62
+  0x0e8,		                /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7*/
63
+  
64
+  0x081,		                /* set contrast (bits 0..5) and gain (bits 6/7) */
65
+  0x014,		                /* ECR24064-1 default: 0x040*/
66
+  
67
+  0x02f,		                /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */  
68
+  U8G_ESC_DLY(50),         /* delay 50 ms */
69
+  
70
+  0x040,		                /* set display start line to 0 */
71
+  0x090,		                /* no fixed lines */
72
+  0x089,		                /* RAM access control  */
73
+  
74
+  0x0af,		                /* disable sleep mode  */
75
+  0x0a4,		                /* normal display  */
76
+  0x0a5,		                /* display all points, ST7565, UC1610 */
77
+  U8G_ESC_DLY(100),       /* delay 100 ms */
78
+  0x0a4,		                /* normal display */
79
+  U8G_ESC_CS(1),             /* disable chip */
80
+  U8G_ESC_END                /* end of sequence */
81
+};
82
+
83
+static const uint8_t u8g_dev_uc1608_240x64_data_start[] PROGMEM = {
84
+  U8G_ESC_ADR(0),           /* instruction mode */
85
+  U8G_ESC_CS(0),             /* enable chip */
86
+  0x010,		/* set upper 4 bit of the col adr to 0 (UC1608)  */
87
+  0x000,		/* set lower 4 bit of the col adr to 0 */      
88
+  U8G_ESC_END                /* end of sequence */
89
+};
90
+
91
+uint8_t u8g_dev_uc1608_240x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
92
+{
93
+  switch(msg)
94
+  {
95
+    case U8G_DEV_MSG_INIT:
96
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
97
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x64_init_seq);
98
+      break;
99
+    case U8G_DEV_MSG_STOP:
100
+      break;
101
+    case U8G_DEV_MSG_PAGE_NEXT:
102
+      {
103
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
104
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x64_data_start);    
105
+        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (UC1608) */
106
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
107
+        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
108
+          return 0;
109
+        u8g_SetChipSelect(u8g, dev, 1);
110
+      }
111
+      break;
112
+    case U8G_DEV_MSG_CONTRAST:
113
+      u8g_SetChipSelect(u8g, dev, 0);
114
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
115
+      u8g_WriteByte(u8g, dev, 0x081);
116
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);	/* set contrast from, keep gain at 0 */
117
+      u8g_SetChipSelect(u8g, dev, 1);      
118
+      return 1;
119
+  }
120
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
121
+}
122
+
123
+uint8_t u8g_dev_uc1608_240x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
124
+{
125
+  switch(msg)
126
+  {
127
+    case U8G_DEV_MSG_INIT:
128
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
129
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x64_init_seq);
130
+      break;
131
+    case U8G_DEV_MSG_STOP:
132
+      break;
133
+    case U8G_DEV_MSG_PAGE_NEXT:
134
+      {
135
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
136
+	
137
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x64_data_start);    
138
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
139
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
140
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
141
+        u8g_SetChipSelect(u8g, dev, 0);
142
+	
143
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1608_240x64_data_start);    
144
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
145
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
146
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
147
+        u8g_SetChipSelect(u8g, dev, 0);
148
+      }
149
+      break;
150
+    case U8G_DEV_MSG_CONTRAST:
151
+      u8g_SetChipSelect(u8g, dev, 1);
152
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
153
+      u8g_WriteByte(u8g, dev, 0x081);
154
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
155
+      u8g_SetChipSelect(u8g, dev, 0);      
156
+      return 1;
157
+  }
158
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
159
+}
160
+
161
+U8G_PB_DEV(u8g_dev_uc1608_240x64_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1608_240x64_fn, U8G_COM_SW_SPI);
162
+U8G_PB_DEV(u8g_dev_uc1608_240x64_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1608_240x64_fn, U8G_COM_HW_SPI);
163
+
164
+uint8_t u8g_dev_uc1608_240x64_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
165
+u8g_pb_t u8g_dev_uc1608_240x64_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_uc1608_240x64_2x_buf}; 
166
+u8g_dev_t u8g_dev_uc1608_240x64_2x_sw_spi = { u8g_dev_uc1608_240x64_2x_fn, &u8g_dev_uc1608_240x64_2x_pb, U8G_COM_SW_SPI };
167
+u8g_dev_t u8g_dev_uc1608_240x64_2x_hw_spi = { u8g_dev_uc1608_240x64_2x_fn, &u8g_dev_uc1608_240x64_2x_pb, U8G_COM_HW_SPI };
168
+

+ 7
- 7
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1610_dogxl160.c Просмотреть файл

@@ -101,7 +101,7 @@ uint8_t u8g_dev_uc1610_dogxl160_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, v
101 101
   switch(msg)
102 102
   {
103 103
     case U8G_DEV_MSG_INIT:
104
-      u8g_InitCom(u8g, dev);
104
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
105 105
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1610_dogxl160_init_seq);
106 106
       break;
107 107
     case U8G_DEV_MSG_STOP:
@@ -145,7 +145,7 @@ uint8_t u8g_dev_uc1610_dogxl160_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, v
145 145
   switch(msg)
146 146
   {
147 147
     case U8G_DEV_MSG_INIT:
148
-      u8g_InitCom(u8g, dev);
148
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
149 149
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1610_dogxl160_init_seq);
150 150
       break;
151 151
     case U8G_DEV_MSG_STOP:
@@ -177,7 +177,7 @@ uint8_t u8g_dev_uc1610_dogxl160_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg
177 177
   switch(msg)
178 178
   {
179 179
     case U8G_DEV_MSG_INIT:
180
-      u8g_InitCom(u8g, dev);
180
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
181 181
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1610_dogxl160_init_seq);
182 182
       break;
183 183
     case U8G_DEV_MSG_STOP:
@@ -208,7 +208,7 @@ uint8_t u8g_dev_uc1610_dogxl160_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg
208 208
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
209 209
         for( i = 0; i < WIDTH; i++ )
210 210
         {
211
-          u8g_WriteByte(u8g, dev, u8g_dev_1to2( ((uint8_t *)(pb->buf+WIDTH))[i] ) );          
211
+          u8g_WriteByte(u8g, dev, u8g_dev_1to2( ((uint8_t *)((uint8_t *)(pb->buf)+WIDTH))[i] ) );          
212 212
         }
213 213
 
214 214
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1610_dogxl160_data_start);    
@@ -216,7 +216,7 @@ uint8_t u8g_dev_uc1610_dogxl160_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg
216 216
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
217 217
         for( i = 0; i < WIDTH; i++ )
218 218
         {
219
-          u8g_WriteByte(u8g, dev, u8g_dev_1to2( ((uint8_t *)(pb->buf+WIDTH))[i] >> 4 ) );          
219
+          u8g_WriteByte(u8g, dev, u8g_dev_1to2( ((uint8_t *)((uint8_t *)(pb->buf)+WIDTH))[i] >> 4 ) );          
220 220
         }
221 221
         
222 222
         u8g_SetChipSelect(u8g, dev, 0);
@@ -238,7 +238,7 @@ uint8_t u8g_dev_uc1610_dogxl160_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg
238 238
   switch(msg)
239 239
   {
240 240
     case U8G_DEV_MSG_INIT:
241
-      u8g_InitCom(u8g, dev);
241
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
242 242
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1610_dogxl160_init_seq);
243 243
       break;
244 244
     case U8G_DEV_MSG_STOP:
@@ -256,7 +256,7 @@ uint8_t u8g_dev_uc1610_dogxl160_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg
256 256
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1610_dogxl160_data_start);    
257 257
         u8g_WriteByte(u8g, dev, 0x060 | (pb->p.page*2+1) ); /* select current page (UC1610) */
258 258
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
259
-        if ( u8g_WriteSequence(u8g, dev, WIDTH, pb->buf+WIDTH) == 0 )
259
+        if ( u8g_WriteSequence(u8g, dev, WIDTH, (uint8_t *)(pb->buf)+WIDTH) == 0 )
260 260
           return 0;
261 261
         
262 262
         u8g_SetChipSelect(u8g, dev, 0);

+ 116
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1611_dogm240.c Просмотреть файл

@@ -0,0 +1,116 @@
1
+/*
2
+
3
+  u8g_dev_uc1611_dogm240.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2014, dev.menges.jonas@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+  
34
+  
35
+*/
36
+
37
+#include "u8g.h"
38
+
39
+
40
+#define WIDTH 240
41
+#define HEIGHT 64
42
+#define PAGE_HEIGHT 8
43
+
44
+
45
+static const uint8_t u8g_dev_uc1611_dogm240_init_seq[] PROGMEM = {
46
+  U8G_ESC_CS(1),             // enable chip
47
+  U8G_ESC_ADR(0),           // instruction mode
48
+  0xF1,     // set last COM electrode
49
+  0x3F,     // 64-1=63
50
+  0xF2,     // set display start line
51
+  0x00,     // 0
52
+  0xF3,     // set display end line
53
+  0x3F,     // 64-1=63
54
+  0x81,     // set contrast (0-255)
55
+  0xB7,     // 183
56
+  0xC0,     // set view
57
+  //0x04,     // topview
58
+  0x02,     // bottomview
59
+  0xA3,     // set line rate (9.4k)
60
+  0xE9,     // set bias ratio (10)
61
+  0xA9,     // enable display
62
+  0xD1,      // set black and white mode
63
+  U8G_ESC_CS(0),             // disable chip
64
+  U8G_ESC_END                // end of sequence
65
+};
66
+
67
+static void setPage(u8g_t *u8g, u8g_dev_t *dev, unsigned char page)
68
+{
69
+  u8g_WriteByte(u8g, dev, 0x70);
70
+  u8g_WriteByte(u8g, dev, 0x60 + (page&0x0F));
71
+}
72
+
73
+static const uint8_t u8g_dev_uc1611_dogm240_data_start[] PROGMEM = {
74
+  U8G_ESC_ADR(0),           /* instruction mode */
75
+  U8G_ESC_CS(1),            /* enable chip */
76
+  0x10,                     /* set upper 4 bit of the col adr to 0 */
77
+  0x00,                     /* set lower 4 bit of the col adr to 0 */
78
+  U8G_ESC_END               /* end of sequence */
79
+};
80
+
81
+uint8_t u8g_dev_uc1611_dogm240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
82
+{
83
+  switch(msg)
84
+  {
85
+    case U8G_DEV_MSG_INIT:
86
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
87
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogm240_init_seq);
88
+      break;
89
+    case U8G_DEV_MSG_STOP:
90
+      break;
91
+    case U8G_DEV_MSG_PAGE_NEXT:
92
+      {
93
+      u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
94
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogm240_data_start);
95
+      setPage(u8g, dev, pb->p.page);   /* select current page (uc1611) */
96
+      u8g_SetAddress(u8g, dev, 1);     /* data mode */
97
+      if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
98
+        return 0;
99
+      u8g_SetChipSelect(u8g, dev, 1);
100
+      }
101
+      break;
102
+    case U8G_DEV_MSG_CONTRAST:
103
+      u8g_SetChipSelect(u8g, dev, 0);
104
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
105
+      u8g_WriteByte(u8g, dev, 0x81);
106
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);	/* set contrast from, keep gain at 0 */
107
+      u8g_SetChipSelect(u8g, dev, 1);
108
+      return 1;
109
+  }
110
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
111
+}
112
+
113
+U8G_PB_DEV(u8g_dev_uc1611_dogm240_i2c , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogm240_fn, U8G_COM_UC_I2C);
114
+U8G_PB_DEV(u8g_dev_uc1611_dogm240_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogm240_fn, U8G_COM_SW_SPI);
115
+U8G_PB_DEV(u8g_dev_uc1611_dogm240_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogm240_fn, U8G_COM_HW_SPI);
116
+

+ 116
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1611_dogxl240.c Просмотреть файл

@@ -0,0 +1,116 @@
1
+/*
2
+
3
+  u8g_dev_uc1611_dogxl240.c
4
+
5
+  Universal 8bit Graphics Library
6
+  
7
+  Copyright (c) 2014, dev.menges.jonas@gmail.com, olikraus@gmail.com
8
+  All rights reserved.
9
+
10
+  Redistribution and use in source and binary forms, with or without modification, 
11
+  are permitted provided that the following conditions are met:
12
+
13
+  * Redistributions of source code must retain the above copyright notice, this list 
14
+    of conditions and the following disclaimer.
15
+    
16
+  * Redistributions in binary form must reproduce the above copyright notice, this 
17
+    list of conditions and the following disclaimer in the documentation and/or other 
18
+    materials provided with the distribution.
19
+
20
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
21
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
22
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
23
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
24
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
25
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
29
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
30
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
31
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
32
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
33
+  
34
+  
35
+*/
36
+
37
+#include "u8g.h"
38
+
39
+
40
+#define WIDTH 240
41
+#define HEIGHT 128
42
+#define PAGE_HEIGHT 8
43
+
44
+
45
+static const uint8_t u8g_dev_uc1611_dogxl240_init_seq[] PROGMEM = {
46
+  U8G_ESC_CS(1),             // enable chip
47
+  U8G_ESC_ADR(0),           // instruction mode
48
+  0xF1,     // set last COM electrode
49
+  0x7F,     // DOGXL240
50
+  0xF2,     // set display start line
51
+  0x00,     // 0
52
+  0xF3,     // set display end line
53
+  0x7F,     // DOGXL240
54
+  0x81,     // set contrast (0-255)
55
+  0xAA,     // DOGXL240 
56
+  0xC0,     // set view
57
+  //0x04,     // topview
58
+  0x02,     // bottomview
59
+  0xA3,     // set line rate (9.4k)
60
+  0xE9,     // set bias ratio (10)
61
+  0xA9,     // enable display
62
+  0xD1,      // set black and white mode
63
+  U8G_ESC_CS(0),             // disable chip
64
+  U8G_ESC_END                // end of sequence
65
+};
66
+
67
+static void u8g_dev_dogxl240_set_page(u8g_t *u8g, u8g_dev_t *dev, unsigned char page)
68
+{
69
+  u8g_WriteByte(u8g, dev, 0x70);
70
+  u8g_WriteByte(u8g, dev, 0x60 + (page&0x0F));
71
+}
72
+
73
+static const uint8_t u8g_dev_uc1611_dogxl240_data_start[] PROGMEM = {
74
+  U8G_ESC_ADR(0),           /* instruction mode */
75
+  U8G_ESC_CS(1),            /* enable chip */
76
+  0x10,                     /* set upper 4 bit of the col adr to 0 */
77
+  0x00,                     /* set lower 4 bit of the col adr to 0 */
78
+  U8G_ESC_END               /* end of sequence */
79
+};
80
+
81
+static uint8_t u8g_dev_uc1611_dogxl240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
82
+{
83
+  switch(msg)
84
+  {
85
+    case U8G_DEV_MSG_INIT:
86
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
87
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogxl240_init_seq);
88
+      break;
89
+    case U8G_DEV_MSG_STOP:
90
+      break;
91
+    case U8G_DEV_MSG_PAGE_NEXT:
92
+      {
93
+      u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
94
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogxl240_data_start);
95
+      u8g_dev_dogxl240_set_page(u8g, dev, pb->p.page);   /* select current page (uc1611) */
96
+      u8g_SetAddress(u8g, dev, 1);     /* data mode */
97
+      if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
98
+        return 0;
99
+      u8g_SetChipSelect(u8g, dev, 1);
100
+      }
101
+      break;
102
+    case U8G_DEV_MSG_CONTRAST:
103
+      u8g_SetChipSelect(u8g, dev, 0);
104
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
105
+      u8g_WriteByte(u8g, dev, 0x81);
106
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);	/* set contrast from, keep gain at 0 */
107
+      u8g_SetChipSelect(u8g, dev, 1);
108
+      return 1;
109
+  }
110
+  return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
111
+}
112
+
113
+U8G_PB_DEV(u8g_dev_uc1611_dogxl240_i2c , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogxl240_fn, U8G_COM_UC_I2C);
114
+U8G_PB_DEV(u8g_dev_uc1611_dogxl240_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogxl240_fn, U8G_COM_SW_SPI);
115
+U8G_PB_DEV(u8g_dev_uc1611_dogxl240_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogxl240_fn, U8G_COM_HW_SPI);
116
+

+ 45
- 1
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1701_dogs102.c Просмотреть файл

@@ -45,6 +45,8 @@ static const uint8_t u8g_dev_dogs102_init_seq[] PROGMEM = {
45 45
   U8G_ESC_ADR(0),           /* instruction mode */
46 46
   U8G_ESC_RST(1),           /* do reset low pulse with (1*16)+2 milliseconds */
47 47
   U8G_ESC_CS(1),             /* enable chip */
48
+  
49
+  0x0e2,            		/* soft reset */
48 50
   0x040,		                /* set display start line to 0 */
49 51
   0x0a1,		                /* ADC set to reverse */
50 52
   0x0c0,		                /* common output mode */
@@ -80,7 +82,7 @@ uint8_t u8g_dev_dogs102_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
80 82
   switch(msg)
81 83
   {
82 84
     case U8G_DEV_MSG_INIT:
83
-      u8g_InitCom(u8g, dev);
85
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
84 86
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_dogs102_init_seq);
85 87
       break;
86 88
     case U8G_DEV_MSG_STOP:
@@ -107,7 +109,49 @@ uint8_t u8g_dev_dogs102_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
107 109
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
108 110
 }
109 111
 
112
+uint8_t u8g_dev_uc1701_dogs102_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
113
+{
114
+  switch(msg)
115
+  {
116
+    case U8G_DEV_MSG_INIT:
117
+      u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
118
+      u8g_WriteEscSeqP(u8g, dev, u8g_dev_dogs102_init_seq);
119
+      break;
120
+    case U8G_DEV_MSG_STOP:
121
+      break;
122
+    case U8G_DEV_MSG_PAGE_NEXT:
123
+      {
124
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
125
+	
126
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_dogs102_data_start);    
127
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
128
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
129
+	u8g_WriteSequence(u8g, dev, pb->width, pb->buf); 
130
+        u8g_SetChipSelect(u8g, dev, 0);
131
+	
132
+        u8g_WriteEscSeqP(u8g, dev, u8g_dev_dogs102_data_start);    
133
+        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
134
+        u8g_SetAddress(u8g, dev, 1);           /* data mode */
135
+	u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); 
136
+        u8g_SetChipSelect(u8g, dev, 0);
137
+      }
138
+      break;
139
+    case U8G_DEV_MSG_CONTRAST:
140
+      u8g_SetChipSelect(u8g, dev, 1);
141
+      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
142
+      u8g_WriteByte(u8g, dev, 0x081);
143
+      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
144
+      u8g_SetChipSelect(u8g, dev, 0);      
145
+      return 1;
146
+  }
147
+  return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
148
+}
149
+
110 150
 U8G_PB_DEV(u8g_dev_uc1701_dogs102_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_dogs102_fn, U8G_COM_SW_SPI);
111 151
 U8G_PB_DEV(u8g_dev_uc1701_dogs102_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_dogs102_fn, U8G_COM_HW_SPI);
112 152
 
153
+uint8_t u8g_dev_uc1701_dogs102_2x_buf[WIDTH*2] U8G_NOCOMMON ; 
154
+u8g_pb_t u8g_dev_uc1701_dogs102_2x_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_uc1701_dogs102_2x_buf}; 
155
+u8g_dev_t u8g_dev_uc1701_dogs102_2x_sw_spi = { u8g_dev_uc1701_dogs102_2x_fn, &u8g_dev_uc1701_dogs102_2x_pb, U8G_COM_SW_SPI };
156
+u8g_dev_t u8g_dev_uc1701_dogs102_2x_hw_spi = { u8g_dev_uc1701_dogs102_2x_fn, &u8g_dev_uc1701_dogs102_2x_pb, U8G_COM_HW_SPI };
113 157
 

+ 0
- 0
ArduinoAddons/Arduino_1.0.x/libraries/U8glib/utility/u8g_dev_uc1701_mini12864.c Просмотреть файл


Некоторые файлы не были показаны из-за большого количества измененных файлов

Загрузка…
Отмена
Сохранить