瀏覽代碼

Made i2c mode wok with the hardware I am able to test (ywrobot / sainsmart i2c LCD 2004)

Removed incorrect LiquidCrystal_I2C Library
MendelMax 12 年之前
父節點
當前提交
67710df9f3

+ 0
- 1
ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal_I2C

1
-Subproject commit bfb71c87594ab904db9e41d9f57c6e2df89dc632

+ 0
- 1
ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal_I2C

1
-Subproject commit bfb71c87594ab904db9e41d9f57c6e2df89dc632

+ 2
- 2
Marlin/Configuration.h 查看文件

354
 //The LCD is attached via an I2C port expander.
354
 //The LCD is attached via an I2C port expander.
355
 //#define LCD_I2C
355
 //#define LCD_I2C
356
 #ifdef LCD_I2C
356
 #ifdef LCD_I2C
357
-  // Port Expander Type - 0=PCF8574 or 1=MCP23008
357
+  // Port Expander Type - 0=PCF8574 sainsmart/ywrobot
358
   #define LCD_I2C_TYPE 0
358
   #define LCD_I2C_TYPE 0
359
   // I2C Address of the port expander
359
   // I2C Address of the port expander
360
-  #define LCD_I2C_ADDRESS 0x20
360
+  #define LCD_I2C_ADDRESS 0x27
361
 #endif
361
 #endif
362
 
362
 
363
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
363
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino

+ 20
- 4
Marlin/ultralcd_implementation_hitachi_HD44780.h 查看文件

11
   #define LCD_CLASS LiquidCrystalRus
11
   #define LCD_CLASS LiquidCrystalRus
12
 #else
12
 #else
13
   #ifdef LCD_I2C
13
   #ifdef LCD_I2C
14
+    #if LCD_I2C_TYPE = 0
15
+      #define LCD_I2C_PIN_BL  3
16
+      #define LCD_I2C_PIN_EN  2
17
+      #define LCD_I2C_PIN_RW  1
18
+      #define LCD_I2C_PIN_RS  0
19
+      #define LCD_I2C_PIN_D4  4
20
+      #define LCD_I2C_PIN_D5  5
21
+      #define LCD_I2C_PIN_D6  6
22
+      #define LCD_I2C_PIN_D7  7
23
+    #endif
24
+
14
     #include <Wire.h>
25
     #include <Wire.h>
26
+    #include <LCD.h>
15
     #include <LiquidCrystal_I2C.h>
27
     #include <LiquidCrystal_I2C.h>
16
     #define LCD_CLASS LiquidCrystal_I2C
28
     #define LCD_CLASS LiquidCrystal_I2C
17
   #else
29
   #else
32
 #define LCD_STR_ARROW_RIGHT "\x7E"  /* from the default character set */
44
 #define LCD_STR_ARROW_RIGHT "\x7E"  /* from the default character set */
33
 
45
 
34
 #ifdef LCD_I2C
46
 #ifdef LCD_I2C
35
-  LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT, LCD_I2C_TYPE);  //address, columns, rows, type
47
+  LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
36
 #else
48
 #else
37
   LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
49
   LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
38
 #endif
50
 #endif
122
         B00000,
134
         B00000,
123
         B00000
135
         B00000
124
     }; //thanks Sonny Mounicou
136
     }; //thanks Sonny Mounicou
137
+
125
     #ifdef LCD_I2C
138
     #ifdef LCD_I2C
126
-        lcd.init();
127
-    #else
128
-        lcd.begin(LCD_WIDTH, LCD_HEIGHT);
139
+        #ifdef LCD_I2C_PIN_BL
140
+            lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
141
+            lcd.setBacklight(HIGH);
142
+        #endif
129
     #endif
143
     #endif
144
+
145
+    lcd.begin(LCD_WIDTH, LCD_HEIGHT);
130
     lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
146
     lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
131
     lcd.createChar(LCD_STR_DEGREE[0], degree);
147
     lcd.createChar(LCD_STR_DEGREE[0], degree);
132
     lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
148
     lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);

Loading…
取消
儲存