I don't use T2, but if the paradigm is similar those code snippets
match my understanding of things. I also don't kow about the resource
arbitration stuff but I assume there is a grant and a release of
some kind, so the usual idea would be to start a task from granted()
which eventually calls release().

MS

Andres Vahter wrote:
> So if I want just read 2 bytes using I2C then I have to do something 
> like this?
> 
> 
> /uint8_t rbuffer[2];// //// read buffer/
> /uint16_t seconds;// //// global seconds/
> /
> /
> /rbuffer[0] = rbuffer[1]  = 0;/
> /call I2CPacket.read(I2C_START | I2C_STOP, 0x51, 2, rbuffer)/
> /
> /
> /async event void I2CPacket.readDone(error_t error, uint16_t addr, 
> uint8_t length, uint8_t* data) {/
> / //uint16_t val;/
> / //val = data[0];// //// data[1] not used although 2 bytes read/
> / //seconds = val;/
> /}/
> 
> Does I2CPacket.readDone actually returns the same uint8_t rbuffer[2] 
> as uint8_t* data pointer?
> Do I have to call all /I2CPacket.read/ and /I2CPacket.write/ functions 
> from /event void Resource.granted()/?
> 
> 
> Andres Vahter
> 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to