In TextLCD_I2C_N Class, added void setContrast(unsigned char c) function as temporary. This is for ST7032i non-volume type contrast control.
Dependents: LPC1114_data_logger RTC_w_COM Frequency_Counter_w_GPS_1PPS CW_Decoder_using_FFT_on_F446 ... more
Fork of TextLCD by
In TextLCD_I2C_N Class, added void setContrast(unsigned char c) function as temporary.
Diff: TextLCD.cpp
- Revision:
- 29:986538f94abe
- Parent:
- 28:30fa94f7341c
- Child:
- 30:4c57a022a56c
--- a/TextLCD.cpp Sat Jun 14 17:04:25 2014 +0000 +++ b/TextLCD.cpp Sun Jun 15 03:22:32 2014 +0000 @@ -9,7 +9,8 @@ * 2013, v07: WH, Added support for backlight and include portdefinitions for LCD2004 Module from DFROBOT * 2014, v08: WH, Refactored in Base and Derived Classes to deal with mbed lib change regarding 'NC' defined pins * 2014, v09: WH/EO, Added Class for Native SPI controllers such as ST7032 - * 2014, v10: WH, Added Class for Native I2C controllers such as ST7032i, Added support for MCP23008 I2C portexpander, Added support for Adafruit module + * 2014, v10: WH, Added Class for Native I2C controllers such as ST7032i, Added support for MCP23008 I2C portexpander, Added support for Adafruit module + * 2014, v11: SW, added setContrast function for ST7032i only by JH1PJL * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -115,7 +116,7 @@ _writeCommand(0x1C); //Internal OSC frequency adjustment Framefreq=183HZ, bias will be 1/4 - _writeCommand(0x73); //Contrast control low byte + _writeCommand(0x70); //Contrast control low byte _writeCommand(0x57); //booster circuit is turned on. /ICON display off. /Contrast control high byte wait_ms(10); // Wait 10ms to ensure powered up @@ -808,6 +809,19 @@ } +// JH1PJL from here -> +void TextLCD_Base::setContrast(unsigned char c) { + + if (_ctrl == ST7032_3V3){ + _writeCommand(0x39); + _writeCommand(0x70 | (c & 0x0f)); // contrast Low + _writeCommand(0x5C | ((c >> 4) & 0x03)); // contast High/icon/power + _writeCommand(0x38); + } + +} +// JH1PJL <- to here + //--------- End TextLCD_Base -----------