I have been stuck on this very problem too... 
if you get the solution kindly post it here...
i ll do the same .


canatan wrote:
> 
> the following code doesnot compile with following errors
> 
>   I2CSCL.setGAFRpin not connected
>   I2CSCL.setGPDRbit not connected
>   I2CSDA.setGAFRpin not connected
>   I2CSDA.setGPDRbit not connected
> 
> We dont know how to resolve these errors
> 
> #include "TestSerial.h"
> #include <I2C.h>
> 
> 
> configuration i2cafAppC {
> 
>  }
> implementation {
>   components i2cafC as App,MainC;
>   components SerialActiveMessageC as AM;
>   components new HalPXA27xI2CMasterC(TRUE);
> 
> 
> 
>   App.Boot -> MainC.Boot;
>   App.Control -> AM;
> 
>   App.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
> 
>   App.Packet -> AM;
>   App.I2CPacket -> HalPXA27xI2CMasterC;
> 
> 
> }
> 
> module i2cafC {
>   uses {
>     interface SplitControl as Control;
> 
>     interface Boot;
> 
>     interface AMSend;
> 
>     interface Packet;
> 
>     interface I2CPacket<TI2CBasicAddr> as I2CPacket;
>   }
> }
> implementation {
> 
>   message_t packet;
>   uint8_t datapointer;
>   bool locked = FALSE;
>   bool locked_serial = FALSE;
>   uint16_t counter = 43690;
>   i2c_flags_t flagnow = I2C_START;
>   event void Boot.booted() {
>     call Control.start();
>   }
> 
>    event void AMSend.sendDone(message_t* bufPtr, error_t error) {
>     if (&packet == bufPtr) {
>       locked_serial = FALSE;
>     }
>    if(call I2CPacket.read(flagnow,0,1,&datapointer) == SUCCESS)
>      {
>      locked = TRUE;}
>      else{
>      locked = FALSE;}
>   }
> 
>   event void Control.startDone(error_t err) {
>     if (err == SUCCESS) {
>      if(call I2CPacket.read(flagnow,0,1,&datapointer) == SUCCESS)
>      {
>      locked = TRUE;}
>      else{
>      locked = FALSE;}
>     }
> 
> 
>   }
> 
> 
>  // async event void I2CPacket.readDone (error_t err, 0,1,&datapointer)
>  async event void I2CPacket.readDone(error_t error, uint16_t addr, uint8_t
> length, uint8_t* data) {
>   if (locked_serial) {
>       return;
>     }
>     else {
>       test_serial_msg_t* rcm = (test_serial_msg_t*)call
> Packet.getPayload(&packet, sizeof(test_serial_msg_t));
>       if (rcm == NULL) {return;}
>       if (call Packet.maxPayloadLength() < sizeof(test_serial_msg_t)) {
> return;
>       }
> 
>       rcm->counter = datapointer;
>      // rcm->counter=33;
>       //dbg(counter,"Dude you suck\n");
>       if (call AMSend.send(AM_BROADCAST_ADDR, &packet,
> sizeof(test_serial_msg_t)) == SUCCESS) {
> locked_serial = TRUE;
>       }
>     }
>   }
>   event void Control.stopDone(error_t err) {}
>   async event void I2CPacket.writeDone(error_t error, uint16_t addr,
> uint8_t
> length, uint8_t* data){}
> }
> 
> -- 
> Fatma
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> 

-- 
View this message in context: 
http://old.nabble.com/imu-interfacing-with-imote2-via-i2c-bus-tp31087846p31170528.html
Sent from the TinyOS - Help mailing list archive at Nabble.com.

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to