Am 05.07.2016 um 07:41 schrieb Dr. Trigon:
> The
> datasheet sais "software controlled contrast" not more. The code
> example [1] they provide mentions a ST7036 display controller [2].
> May be that is related as I never saw any dots of the matrices.
>
Please rollback the previous patch, then apply the new one.
[owfs-code]$ patch -p1 -R <eservice_lcd.diff
[owfs-code]$ patch -p1 <eservice_lcd-2.diff
[owfs-code]$ make
Kind regards
Jan
diff --git a/module/owlib/src/c/ow_2408.c b/module/owlib/src/c/ow_2408.c
index 811c304..c548135 100644
--- a/module/owlib/src/c/ow_2408.c
+++ b/module/owlib/src/c/ow_2408.c
@@ -100,7 +100,8 @@ WRITE_FUNCTION(FS_redefchar_hex);
static struct aggregate A2408 = { 8, ag_numbers, ag_aggregate, };
static struct aggregate A2408c = { 8, ag_numbers, ag_separate, };
// LCD_M is HD44780 in 8bit mode
-// LCD_H is HD44780 in 4bit mode
+// LCD_H is HD44780 in 4bit mode, hobby-boards schematic
+// LCD_E is HD44780 in 4bit mode, eservice schematic
static struct filetype DS2408[] = {
F_STANDARD,
{"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, },
@@ -150,15 +151,40 @@ Make_SlaveSpecificTag(INI, fc_stable); // LCD screen initialized?
* 0 during initialization of the display module, turning the output
* transistors on and by that taking the sensing voltage away from the
* buttons.
-* */
-#define LCD_DATA_FLAG 0x08
-#define LCD_BUTTON_MASK 0x07
+ */
+
+/* Maxim LCD design */
#define LCD_M_VERIFY_MASK 0xFF
-#define LCD_H_VERIFY_MASK 0xF8
-#define NIBBLE_ONE(x) ( ((x)&0xF0) | LCD_BUTTON_MASK )
-#define NIBBLE_TWO(x) ( (((x)<<4)&0xF0) | LCD_BUTTON_MASK )
-#define NIBBLE_CTRL( x ) NIBBLE_ONE(x) , NIBBLE_TWO(x)
-#define NIBBLE_DATA( x ) NIBBLE_ONE(x)|LCD_DATA_FLAG , NIBBLE_TWO(x)|LCD_DATA_FLAG
+
+/* Hobby-Boards LCD design */
+#define LCD_H_BUTTON_MASK 0x07
+#define LCD_H_VERIFY_MASK 0xF8
+#define LCD_H_DATA_FLAG 0x08
+#define NIBBLE_ONE_H(x) ( ((x)&0xF0) | LCD_H_BUTTON_MASK )
+#define NIBBLE_TWO_H(x) ( (((x)<<4)&0xF0) | LCD_H_BUTTON_MASK )
+#define NIBBLE_CTRL_H(x) NIBBLE_ONE_H(x) , NIBBLE_TWO_H(x)
+#define NIBBLE_DATA_H(x) NIBBLE_ONE_H(x) | LCD_H_DATA_FLAG , NIBBLE_TWO_H(x) | LCD_H_DATA_FLAG
+
+/* Eservice LCD design */
+#define LCD_E_VERIFY_MASK 0x1F
+#define LCD_E_BUTTON_MASK 0x20
+#define LCD_E_BCKLGT_CTRL 0x80
+#define LCD_E_DATA_FLAG 0x10
+#define NIBBLE_ONE_E(x) ( (((x)>>4)&0x0F) | LCD_E_BUTTON_MASK | LCD_E_BCKLGT_CTRL )
+#define NIBBLE_TWO_E(x) ( ((x)&0x0F) | LCD_E_BUTTON_MASK | LCD_E_BCKLGT_CTRL )
+#define NIBBLE_CTRL_E(x) NIBBLE_ONE_E(x) , NIBBLE_TWO_E(x)
+#define NIBBLE_DATA_E(x) NIBBLE_ONE_E(x) | LCD_E_DATA_FLAG , NIBBLE_TWO_E(x) | LCD_E_DATA_FLAG
+
+
+/* Select Hobby-Boards or Eservice design */
+/* Eservice */
+#define NIBBLE_ONE(x) NIBBLE_ONE_E(x)
+#define NIBBLE_TWO(x) NIBBLE_TWO_E(x)
+#define NIBBLE_CTRL(x) NIBBLE_CTRL_E(x)
+#define NIBBLE_DATA(x) NIBBLE_DATA_E(x)
+#define LCD_DATA_FLAG LCD_E_DATA_FLAG
+#define LCD_VERIFY_MASK LCD_E_VERIFY_MASK
+
/* ------- Functions ------------ */
@@ -374,6 +400,9 @@ static ZERO_OR_ERROR FS_w_por(struct one_wire_query *owq)
#define LCD_COMMAND_DISPLAY_OFF 0x08
#define LCD_COMMAND_4_BIT 0x20
#define LCD_COMMAND_4_BIT_2_LINES 0x28
+#define LCD_COMMAND_4_BIT_2_LINES_EXT 0x29
+#define LCD_COMMAND_CONTRAST1 0x51
+#define LCD_COMMAND_CONTRAST2 0x77
#define LCD_COMMAND_ATTENTION 0x30
#define LCD_COMMAND_SET_DDRAM_ADDRESS 0x80
@@ -410,7 +439,7 @@ static ZERO_OR_ERROR FS_Hclear(struct one_wire_query *owq)
LEVEL_DEBUG("Screen initialization error");
return -EINVAL ;
}
- return GB_to_Z_OR_E(OW_w_pios(clear, 6, LCD_H_VERIFY_MASK, pn)) ;
+ return GB_to_Z_OR_E(OW_w_pios(clear, 6, LCD_VERIFY_MASK, pn)) ;
}
static GOOD_OR_BAD OW_Hinit(struct parsedname * pn)
@@ -422,6 +451,9 @@ static GOOD_OR_BAD OW_Hinit(struct parsedname * pn)
NIBBLE_ONE(LCD_COMMAND_ATTENTION),
NIBBLE_ONE(LCD_COMMAND_ATTENTION),
NIBBLE_ONE(LCD_COMMAND_4_BIT),
+ NIBBLE_CTRL(LCD_COMMAND_4_BIT_2_LINES_EXT),
+ NIBBLE_CTRL(LCD_COMMAND_CONTRAST1),
+ NIBBLE_CTRL(LCD_COMMAND_CONTRAST2),
NIBBLE_CTRL(LCD_COMMAND_4_BIT_2_LINES),
};
BYTE data[6];
@@ -442,12 +474,12 @@ static GOOD_OR_BAD OW_Hinit(struct parsedname * pn)
LEVEL_DEBUG("Trouble clearing latches") ;
return gbBAD ;
}// clear PIOs
- if ( BAD(OW_w_pios(start, 1, LCD_H_VERIFY_MASK, pn)) ) {
+ if ( BAD(OW_w_pios(start, 1, LCD_VERIFY_MASK, pn)) ) {
LEVEL_DEBUG("Error sending initial attention");
return gbBAD;
}
UT_delay(5);
- if ( BAD(OW_w_pios(next, 5, LCD_H_VERIFY_MASK, pn)) ) {
+ if ( BAD(OW_w_pios(next, 5, LCD_VERIFY_MASK, pn)) ) {
LEVEL_DEBUG("Error sending setup commands");
return gbBAD;
}
@@ -596,7 +628,7 @@ static GOOD_OR_BAD OW_Hprintyx(struct yx * YX, struct parsedname * pn)
}
}
LEVEL_DEBUG("Print the message");
- return OW_w_pios(translated_data, translate_index, LCD_H_VERIFY_MASK, pn);
+ return OW_w_pios(translated_data, translate_index, LCD_VERIFY_MASK, pn);
}
// 0x01 => blinking cursor on
@@ -609,7 +641,7 @@ static ZERO_OR_ERROR FS_Honoff(struct one_wire_query *owq)
RETURN_ERROR_IF_BAD( OW_Hinit(pn) ) ;
// onoff
- if ( BAD(OW_w_pios(onoff, 2, LCD_H_VERIFY_MASK, pn)) ) {
+ if ( BAD(OW_w_pios(onoff, 2, LCD_VERIFY_MASK, pn)) ) {
LEVEL_DEBUG("Error setting LCD state");
return -EINVAL;
}
@@ -860,5 +892,5 @@ static GOOD_OR_BAD OW_redefchar(ASCII * pattern, struct parsedname * pn)
data[j++] = NIBBLE_TWO(pattern[i]) | LCD_DATA_FLAG;
}
- return OW_w_pios(data, datalength, LCD_H_VERIFY_MASK, pn);
+ return OW_w_pios(data, datalength, LCD_VERIFY_MASK, pn);
}
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers