added notification of configuration change for CC2420

git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@759 23d1a52b-0c3c-0410-b72d-8f29ab48fe35
This commit is contained in:
joxe 2010-09-08 12:04:03 +00:00
parent 97b7984c94
commit 1cbd5410e5
2 changed files with 7 additions and 5 deletions

View File

@ -661,6 +661,7 @@ public class CC2420 extends Chip implements USARTListener, RFListener, RFSource
}
private void setReg(int address, int data) {
int oldValue = registers[address];
registers[address] = data;
switch(address) {
case REG_IOCFG0:
@ -682,12 +683,13 @@ public class CC2420 extends Chip implements USARTListener, RFListener, RFSource
autoAck = (data & AUTOACK) != 0;
break;
case REG_FSCTRL:
if (cl != null) {
updateActiveFrequency();
cl.changedChannel(activeChannel);
}
if (cl != null) {
updateActiveFrequency();
cl.changedChannel(activeChannel);
}
break;
}
configurationChanged(address, oldValue, data);
}
public void dataReceived(USART source, int data) {

View File

@ -181,7 +181,7 @@ public abstract class Chip implements Loggable, EventSource {
/* Called by subclasses to inform about changes of configuration */
protected void configurationChanged(int parameter, int oldValue, int newValue) {
ConfigurationChangeListener[] listeners = ccListeners;
if (listeners != null) {
if (oldValue != newValue && listeners != null) {
for (int i = 0, n = listeners.length; i < n; i++) {
listeners[i].configurationChanged(this, parameter, oldValue, newValue);
}