* @author Jonathan Hui <jhui@archrock.com>
* @author David Moss
* @author Roman Lim
+ * @author Razvan Musaloie-E.
+ * @author Jeonggil Ko
* @version $Revision$ $Date$
*/
-module CC2420SpiP {
+module CC2420SpiP @safe() {
provides {
interface ChipSpiResource;
addr += offset;
- call SpiByte.write( addr | 0x80 );
- status = call SpiByte.write( ( ( addr >> 1 ) & 0xc0 ) | 0x20 );
+ status = call SpiByte.write( addr | 0x80 );
+ call SpiByte.write( ( ( addr >> 1 ) & 0xC0 ) | 0x20 );
for ( ; len; len-- ) {
*data++ = call SpiByte.write( 0 );
}
uint8_t len ) {
cc2420_status_t status = 0;
+ uint8_t tmpLen = len;
+ uint8_t * COUNT(tmpLen) tmpData = (uint8_t * COUNT(tmpLen))data;
atomic {
if(call WorkingState.isIdle()) {
addr += offset;
- call SpiByte.write( addr | 0x80 );
+ status = call SpiByte.write( addr | 0x80 );
call SpiByte.write( ( addr >> 1 ) & 0xc0 );
for ( ; len; len-- ) {
- status = call SpiByte.write( *data++ );
+ call SpiByte.write( tmpData[tmpLen-len] );
}
return status;