Platforms telosb
Revision as of 19:12, 21 March 2008 by 77.38.196.183 (talk) (New page: Telosb is also compatible to Tmote Sky, TmoteMINI, and similar. === Telosb initialization in TinyOS 1.x === Sets all pin directions and values. Inits the external flash memory chip. <co...)
Telosb is also compatible to Tmote Sky, TmoteMINI, and similar.
Telosb initialization in TinyOS 1.x
Sets all pin directions and values. Inits the external flash memory chip.
void TOSH_SET_PIN_DIRECTIONS(void){
atomic {
P1SEL = 0; // Select all ports to be I/O pins
P2SEL = 0;
P3SEL = 0;
P4SEL = 0;
P5SEL = 0;
P6SEL = 0;
P1DIR = 0xe0; // 1110 0000 (0=input, 1=output)
P1OUT = 0x00; // 0000 0000
P2DIR = 0x7b; // 0111 1011 (0=input, 1=output)
P2OUT = 0x10; // 0001 0000
P3DIR = 0xf1; // 1111 0001 (0=input, 1=output)
P3OUT = 0x00; // 0000 0000
P4DIR = 0xfd; // 1111 1101 (0=input, 1=output)
P4OUT = 0xdd; // 1101 1101
P5DIR = 0xff; // 1111 1111 (0=input, 1=output)
P5OUT = 0xff; // 1111 1111
P6DIR = 0xff; // 1111 1111 (0=input, 1=output)
P6OUT = 0x00; // 0000 0000
P1IE = 0; // Port P1 pin interrupts - all disabled
P2IE = 0; // Port P2 pin interrupts - all disabled
TOSH_uwait(1024*10); // wait 10ms for the flash to startup
TOSH_FLASH_M25P_DP(); // Put the flash in deep sleep state
}//atomic
}