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

Removed incorrect LiquidCrystal_I2C Library
This commit is contained in:
MendelMax 2013-02-26 22:22:12 +00:00
parent b6209c86dd
commit 67710df9f3
4 changed files with 22 additions and 8 deletions

@ -1 +0,0 @@
Subproject commit bfb71c87594ab904db9e41d9f57c6e2df89dc632

@ -1 +0,0 @@
Subproject commit bfb71c87594ab904db9e41d9f57c6e2df89dc632

View file

@ -354,10 +354,10 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
//The LCD is attached via an I2C port expander.
//#define LCD_I2C
#ifdef LCD_I2C
// Port Expander Type - 0=PCF8574 or 1=MCP23008
// Port Expander Type - 0=PCF8574 sainsmart/ywrobot
#define LCD_I2C_TYPE 0
// I2C Address of the port expander
#define LCD_I2C_ADDRESS 0x20
#define LCD_I2C_ADDRESS 0x27
#endif
// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino

View file

@ -11,7 +11,19 @@
#define LCD_CLASS LiquidCrystalRus
#else
#ifdef LCD_I2C
#if LCD_I2C_TYPE = 0
#define LCD_I2C_PIN_BL 3
#define LCD_I2C_PIN_EN 2
#define LCD_I2C_PIN_RW 1
#define LCD_I2C_PIN_RS 0
#define LCD_I2C_PIN_D4 4
#define LCD_I2C_PIN_D5 5
#define LCD_I2C_PIN_D6 6
#define LCD_I2C_PIN_D7 7
#endif
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C
#else
@ -32,7 +44,7 @@
#define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set */
#ifdef LCD_I2C
LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT, LCD_I2C_TYPE); //address, columns, rows, type
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);
#else
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
#endif
@ -122,11 +134,15 @@ static void lcd_implementation_init()
B00000,
B00000
}; //thanks Sonny Mounicou
#ifdef LCD_I2C
lcd.init();
#else
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#ifdef LCD_I2C_PIN_BL
lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
lcd.setBacklight(HIGH);
#endif
#endif
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
lcd.createChar(LCD_STR_DEGREE[0], degree);
lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);