Am 27.06.2016 um 18:06 schrieb Dr. Trigon:
>
> Any news on this? Patch for testing ready? ;)
>
A quick&dirty patch is appended. I have tested it myself with a DS2408
plus HD44780 LCD connected as described in the eservice documentation.
Don't forget to install automake and pkgconfig. Use the current git
archive clone as your base.
$ git clone git://git.code.sf.net/p/owfs/code owfs-code
$ cd owfs-code
$ ./bootstrap
$ ./configure
$ patch -p1 <../eservice_lcd.diff
$ make ; sudo make install
Test with:
# /opt/owfs/bin/owserver --debug -u
and in another terminal window:
$ /opt/owfs/bin/owwrite /<your DS2408 address>/strobe 1
$ /opt/owfs/bin/owwrite /<your DS2408 address>/LCD_H/clear 1
$ /opt/owfs/bin/owwrite /<your DS2408 address>/LCD_H/message "Foobar"
Kind regards
Jan
diff --git a/module/owlib/src/c/ow_2408.c b/module/owlib/src/c/ow_2408.c
index 811c304..e02b505 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
+
+/* Hobby-Boards LCD design */
+#define LCD_H_BUTTON_MASK 0x07
#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
+#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 ------------ */
@@ -410,7 +436,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)
@@ -442,12 +468,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 +622,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 +635,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 +886,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