[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/diku/mcs51/apps/ADCTest ADCTest.nc, NONE, 1.1 ADCTestM.nc, NONE, 1.1 Makefile, NONE, 1.1

Martin Leopold mleopold at users.sourceforge.net
Fri Apr 7 05:49:58 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/diku/mcs51/apps/ADCTest
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20038/apps/ADCTest

Added Files:
	ADCTest.nc ADCTestM.nc Makefile 
Log Message:
A first go at an mcs51 port

--- NEW FILE: ADCTest.nc ---
/* 
*/

configuration ADCTest {
}
implementation {
  components Main, ADCTestM, ADCC, TimerC;
  Main.StdControl -> ADCTestM;
  Main.StdControl -> TimerC;
  ADCTestM.Timer -> TimerC.Timer[unique("Timer")];
  ADCTestM.ADC -> ADCC.ADC[0];
  ADCTestM.ADCControl -> ADCC;
}

--- NEW FILE: ADCTestM.nc ---
/*
  Testing the ADC connection
  
*/

module ADCTestM {
  provides {
     interface StdControl;
  }
  uses {
     interface Timer;
     interface ADC;
     interface ADCControl;
  }
}
implementation {
  
  command result_t StdControl.init() {
    return call ADCControl.init();
  }

  command result_t StdControl.start() {
    call Timer.start(TIMER_REPEAT, 250);
    return SUCCESS;
  }

  command result_t StdControl.stop() {
    return SUCCESS;
  }
  
  event result_t Timer.fired() {
    call ADC.getData();
    return SUCCESS;
  }


  async event result_t ADC.dataReady(uint16_t input) {
    int8_t idx;
    input = input>>8;
    atomic{
      P0 = 0;
      for(idx = 7; idx >= 0; idx--) {
        if(input > (32*idx)) P0 |= 1<<idx;
      }
    }
    return SUCCESS;
  }
}

--- NEW FILE: Makefile ---
COMPONENT=ADCTest
PFLAGS=-I%T/lib/Counters 

ifdef IM_SENDER
 PFLAGS += "-DIM_SENDER"
endif

include ../Makerules



More information about the Tinyos-contrib-commits mailing list