From: <jo...@us...> - 2008-09-17 00:40:07
|
Revision: 335 http://mspsim.svn.sourceforge.net/mspsim/?rev=335&view=rev Author: joxe Date: 2008-09-17 07:40:05 +0000 (Wed, 17 Sep 2008) Log Message: ----------- bugfix to IOPort notification Modified Paths: -------------- mspsim/se/sics/mspsim/chip/SHT11.java mspsim/se/sics/mspsim/core/IOPort.java Modified: mspsim/se/sics/mspsim/chip/SHT11.java =================================================================== --- mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-16 21:08:05 UTC (rev 334) +++ mspsim/se/sics/mspsim/chip/SHT11.java 2008-09-17 07:40:05 UTC (rev 335) @@ -64,6 +64,12 @@ boolean clockHi = false; boolean dataHi = false; + public void reset() { + clockHi = true; + dataHi = true; + initPos = 0; + } + public void clockPin(boolean high) { if (clockHi == high) return; char c = high ? 'C' : 'c'; @@ -98,6 +104,10 @@ } } else { initPos = 0; + // If this is a correct first char => ok! + if (c == INIT_COMMAND[0]) { + initPos = 1; + } } return false; } Modified: mspsim/se/sics/mspsim/core/IOPort.java =================================================================== --- mspsim/se/sics/mspsim/core/IOPort.java 2008-09-16 21:08:05 UTC (rev 334) +++ mspsim/se/sics/mspsim/core/IOPort.java 2008-09-17 07:40:05 UTC (rev 335) @@ -76,6 +76,7 @@ private PortListener listener; // represents the direction register private int dirReg; + private int out; /** * Creates a new <code>IOPort</code> instance. @@ -131,13 +132,22 @@ case IN: break; case OUT: + out = data; if (listener != null) { // Any output configured pin (pin-bit = 0) should have 1 here?! - listener.portWrite(this, data | (~dirReg)&0xff); +// if (name.equals("1")) +// System.out.println(getName() + " write to IOPort via OUT reg: " + Utils.hex8(data)); + listener.portWrite(this, out | (~dirReg)&0xff); } break; case DIR: dirReg = data; + if (listener != null) { + // Any output configured pin (pin-bit = 0) should have 1 here?! +// if (name.equals("1")) +// System.out.println(getName() + " write to IOPort via DIR reg: " + Utils.hex8(data)); + listener.portWrite(this, out | (~dirReg)&0xff); + } break; // SEL & IFG is the same but behaviour differs between p1,p2 and rest... case SEL: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |