If you're using Boomerang, you need to acquire the I2C resource.  I
think there's a few articles about this in the mailing list archives.

-Joe

On 7/18/06, Nicolas Schulcz <[EMAIL PROTECTED]> wrote:
Hi everybody

This is the problem, I design an application on the Tmote Sky kit.
It have to dialog with an external sensor (I2C protocol), and send
values to an other Tmote.

I dont find some sample on implementation of the I2C protocol,
so I write it myself.

When I connect it with the sample IntToRfm, it doesnt work,
but if I connect the orther sample IntToLeds, it work very well

So I am very sad.
I someone have an idea?? thanks

This is the code of my I2C module :



module DemoI2CM {

  provides {
    interface StdControl;
  }

  uses {
    interface StdControl as MSPStdControl;
    interface MSP430I2C;
    interface MSP430I2CPacket;
    interface MSP430I2CEvents;
    interface Timer;
    interface IntOutput;
  }

}

implementation {

  bool read=FALSE;

  uint8_t inc_debug=0;

  event result_t Timer.fired()
  {
      uint8_t Data[2];

          //call IntOutput.output(inc_debug);

          inc_debug++;

          Data[0] = 0x16;               //
          Data[1] = inc_debug;  //

          read=TRUE;
          call MSP430I2CPacket.writePacket(29, 2, Data );

      return SUCCESS;
  }

  event void MSP430I2CPacket.writePacketDone(uint16_t addr, uint8_t
length, uint8_t* data, result_t success){
    uint8_t Data[6];
    uint8_t DataToRead = 0x16;

        if (read) {

           read=FALSE;
           call MSP430I2CPacket.writePacket(29, 1, &DataToRead );

        } else {

           call MSP430I2CPacket.readPacket(29, 1, Data );

        }

  }

  event void MSP430I2CPacket.readPacketDone(uint16_t addr, uint8_t
length, uint8_t* data, result_t success) {

          call IntOutput.output(data[0]);

  }


  command result_t StdControl.init() {
                call MSPStdControl.init();
                call MSP430I2C.enable();
                call MSP430I2C.setModeMaster();
                call MSP430I2C.setAddr7bit();
                return SUCCESS;
  }

  command result_t StdControl.start() {

        return rcombine(call MSPStdControl.start(),call
Timer.start(TIMER_REPEAT, 250));
                return SUCCESS;
  }


  command result_t StdControl.stop() {
    return call MSPStdControl.stop();
  }


  async event void MSP430I2CEvents.arbitrationLost() {}

  async event void MSP430I2CEvents.noAck(){}

  async event void MSP430I2CEvents.ownAddr(){}

  async event void MSP430I2CEvents.readyRegAccess(){}

  async event void MSP430I2CEvents.readyRxData(){}

  async event void MSP430I2CEvents.readyTxData(){}

  async event void MSP430I2CEvents.generalCall(){}

  async event void MSP430I2CEvents.startRecv(){}

  event result_t IntOutput.outputComplete(result_t success)
  {
    return SUCCESS;
  }

}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to