This is a simplest test. But It seems that only the erase operation works in mica2. I don't know why.
RandRWAppC.nc: #include "StorageVolumes.h" configuration RandRWAppC { } implementation { components RandRWC, new BlockStorageC(VOLUME_BLOCKTEST), MainC, LedsC, PlatformC, RandomC; MainC.Boot <- RandRWC; RandRWC.BlockWrite -> BlockStorageC.BlockWrite; RandRWC.Leds -> LedsC; RandRWC.Random -> RandomC.Random; } RandRWC.nc: module RandRWC { uses { interface Boot; interface Leds; interface BlockWrite; interface Random; } } implementation { uint8_t data[8] = {1, 2, 3, 4, 5, 6, 7, 8}; event void Boot.booted() { call BlockWrite.erase(); call BlockWrite.write(0, data, 8); call BlockWrite.sync(); } event void BlockWrite.eraseDone(error_t result) { if(result == SUCCESS) call Leds.led0On(); } event void BlockWrite.writeDone(storage_addr_t x, void* buf, storage_len_t y, error_t result) { if(result == SUCCESS){ call Leds.led0Off(); call Leds.led1On(); } } event void BlockWrite.syncDone(error_t result) { if(result == SUCCESS) call Leds.led1Off(); call Leds.led2On(); } }
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help