Exemplo n.º 1
0
void radio_txEnable() {
   // change state
   radio_vars.state = RADIOSTATE_ENABLING_TX;
   
   // wiggle debug pin
   debugpins_radio_set();
   leds_radio_on();
    
   // change state
   radio_vars.state = RADIOSTATE_TX_ENABLED;
}
Exemplo n.º 2
0
void radio_txEnable(void) {
   // change state
   radio_vars.state = RADIOSTATE_ENABLING_TX;
   
   // wiggle debug pin
   debugpins_radio_set();
   
   // I don't fully understand how the CC2420_STXCA the can be used here.
   
   // change state
   radio_vars.state = RADIOSTATE_TX_ENABLED;
}
Exemplo n.º 3
0
void radio_rxEnable() {

   // change state
   radio_vars.state = RADIOSTATE_ENABLING_RX;
   //enable radio interrupts

   // do nothing as we do not want to receive anything yet.
   // wiggle debug pin
   debugpins_radio_set();
   leds_radio_on();

   // change state
   radio_vars.state = RADIOSTATE_LISTENING;
}
Exemplo n.º 4
0
void radio_txEnable() {
   // change state
   radio_vars.state = RADIOSTATE_ENABLING_TX;
   
   // wiggle debug pin
   debugpins_radio_set();
   leds_radio_on();

   //do nothing -- radio is activated by the strobe on rx or tx
   //radio_rfOn();

   // change state
   radio_vars.state = RADIOSTATE_TX_ENABLED;
}
Exemplo n.º 5
0
void radio_txEnable() {
   // change state
   radio_vars.state = RADIOSTATE_ENABLING_TX;
   
   // wiggle debug pin
   debugpins_radio_set();
   leds_radio_on();
   
   // turn on radio's PLL
   radio_spiWriteReg(RG_TRX_STATE, CMD_PLL_ON);
   while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != PLL_ON); // busy wait until done
   
   // change state
   radio_vars.state = RADIOSTATE_TX_ENABLED;
}
Exemplo n.º 6
0
void radio_rxEnable() {
   // change state
   radio_vars.state = RADIOSTATE_ENABLING_RX;
   
   // put radio in reception mode
   radio_spiWriteReg(RG_TRX_STATE, CMD_RX_ON);
   
   // wiggle debug pin
   debugpins_radio_set();
   leds_radio_on();
   
   // busy wait until radio really listening
   while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != RX_ON);
   
   // change state
   radio_vars.state = RADIOSTATE_LISTENING;
}
Exemplo n.º 7
0
void radio_rxEnable(void) {
   // change state
   radio_vars.state = RADIOSTATE_ENABLING_RX;
   
   // put radio in reception mode
   cc2420_spiStrobe(CC2420_SRXON, &radio_vars.radioStatusByte);
   cc2420_spiStrobe(CC2420_SFLUSHRX, &radio_vars.radioStatusByte);
   
   // wiggle debug pin
   debugpins_radio_set();
   
   // busy wait until radio really listening
   while (radio_vars.radioStatusByte.rssi_valid==0) {
      cc2420_spiStrobe(CC2420_SNOP, &radio_vars.radioStatusByte);
   }
   
   // change state
   radio_vars.state = RADIOSTATE_LISTENING;
}
Exemplo n.º 8
0
/**
\brief The program starts executing here.
*/
int mote_main(void) {
   
   board_init();
   leds_error_on();
   
   debugpins_frame_set();    some_delay();
   debugpins_frame_toggle(); some_delay();
   debugpins_frame_toggle(); some_delay();
   debugpins_frame_clr();    some_delay();
   
   debugpins_slot_set();     some_delay();
   debugpins_slot_toggle();  some_delay();
   debugpins_slot_toggle();  some_delay();
   debugpins_slot_clr();     some_delay();
   
   debugpins_fsm_set();      some_delay();
   debugpins_fsm_toggle();   some_delay();
   debugpins_fsm_toggle();   some_delay();
   debugpins_fsm_clr();      some_delay();
   
   debugpins_task_set();     some_delay();
   debugpins_task_toggle();  some_delay();
   debugpins_task_toggle();  some_delay();
   debugpins_task_clr();     some_delay();
   
   debugpins_isr_set();      some_delay();
   debugpins_isr_toggle();   some_delay();
   debugpins_isr_toggle();   some_delay();
   debugpins_isr_clr();      some_delay();
   
   debugpins_radio_set();    some_delay();
   debugpins_radio_toggle(); some_delay();
   debugpins_radio_toggle(); some_delay();
   debugpins_radio_clr();    some_delay();
   
   board_reset();
   
   return 0;
}
Exemplo n.º 9
0
void radio_rxEnable() {

   // change state
  radio_vars.state = RADIOSTATE_ENABLING_RX;
	    

   // put radio in reception mode
  radio_spiStrobe(CC1101_SRX, &radio_vars.radioStatusByte);
  radio_spiStrobe(CC1101_SFRX, &radio_vars.radioStatusByte);
  
   // wiggle debug pin
  debugpins_radio_set();
  leds_radio_on();
   

   // busy wait until radio really listening
  while (radio_vars.radioStatusByte.STATE == 0x01) {
    radio_spiStrobe(CC1101_SNOP, &radio_vars.radioStatusByte);
  }
   
   // change state
  radio_vars.state = RADIOSTATE_LISTENING;
}
Exemplo n.º 10
0
/*******************************************************************************
*
*   PROCEDURE NAME:
*       llwu_isr - Interrupt handler for LLWU
*       the commented code is kept as an example for future alternative wake up sources.
*
*******************************************************************************/
void llwu_isr(void)
{

debugpins_radio_set();

//   if (LLWU_F1 & LLWU_F1_WUF0_MASK) {
//       LLWU_F1 |= LLWU_F1_WUF0_MASK;   // write one to clear the flag -- UART RX flag
////       printf("\n[LLWU ISR]  ****WUF0 was set *****\r\n");
//   }
//   if (LLWU_F1 & LLWU_F1_WUF1_MASK) {
////       printf("\n [LLWU ISR] ****WUF1 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF2_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF2_MASK) {
////       printf("\n [LLWU ISR] ****WUF2 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF2_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF3_MASK){
////       printf("\n [LLWU ISR] ****WUF3 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF3_MASK;   // write one to clear the flag
//    }
//   if (LLWU_F1 & LLWU_F1_WUF4_MASK) {
// //      printf("\n [LLWU ISR] ****WUF4 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF4_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF5_MASK) {
////       printf("\n [LLWU ISR] ****WUF5 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF5_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF6_MASK) {
////       printf("\n [LLWU ISR] ****WUF6 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF6_MASK;   // write one to clear the flag
//    }
//   if (LLWU_F1 & LLWU_F1_WUF7_MASK) {
////       printf("\n [LLWU ISR] ****WUF7 was set from PTC3 input  *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF7_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF8_MASK) {
// //      printf("\n [LLWU ISR] ****WUF8 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF8_MASK;   // write one to clear the flag
//   }
  if (LLWU_F2 & LLWU_F2_WUF9_MASK) {
       LLWU_F2 |= LLWU_F2_WUF9_MASK;   // write one to clear the flag -- radio isr (ptc5 external interrupt)
   	  // signal_irq(RADIO_EXTERNAL_PORT_IRQ_NUM);//activate nvic irq.
       radio_isr(); //instead of that, the isr of that port can be set in the NVIC and there handle the 
       //corresponding action after clearing the LLWU_F2 WUF9 flag. (hence not clearing it here)
  }
//   if (LLWU_F2 & LLWU_F2_WUF10_MASK) {
////       printf("\n [LLWU ISR] ****WUF10 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF10_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF11_MASK) {
// //      printf("\n [LLWU ISR] ****WUF11 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF11_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF12_MASK) {
////       printf("\n [LLWU ISR] ****WUF12 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF12_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF13_MASK) {
////       printf("[LLWU ISR] ****WUF13 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF13_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF14_MASK) {
////       printf("[LLWU ISR] RTS\n");
//       SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK; // turn on port D ajj per alister
//       LLWU_F2 |= LLWU_F2_WUF14_MASK;   // write one to clear the flag
//       PORTD_PCR4 |= PORT_PCR_ISF_MASK  ;   //  clear Flag if there
//   }
//   if (LLWU_F2 & LLWU_F2_WUF15_MASK) {
////       printf("[LLWU ISR] UART0\n");
//       SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK; // turn on port D ajj per alister
//   //    ch = uart_getchar(UART0_BASE_PTR);
//     //  out_char(ch);
//       LLWU_F2 |= LLWU_F2_WUF15_MASK;   // write one to clear the flag
//       PORTD_PCR6  |= PORT_PCR_ISF_MASK  ;   //  clear Flag if there
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF0_MASK) {
////       printf("[LLWU ISR] LPT0\n");
////       LPTMR0_CSR |=  LPTMR_CSR_TCF_MASK;   // write 1 to TCF to clear the LPT timer compare flag
////       LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK  );
//       LLWU_F3 |= LLWU_F3_MWUF0_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF1_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF1 IF  CMP0  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF1_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF2_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF2 IF  CMP1 *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF2_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF3_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF3 IF CMP2/CMP3  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF3_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF4_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF4 IF TSI  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF4_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF5_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF5 IF RTC Alarm  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF5_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF6_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF6 IF DryIce(Tamper Detect)  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF6_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF7_MASK) {
////       printf("[LLWU ISR] RTC\n");
//       LLWU_F3 |= LLWU_F3_MWUF7_MASK;   // write one to clear the flag
//   }
//
//   if(LLWU_FILT1 & LLWU_FILT1_FILTF_MASK){
//
//       LLWU_FILT1 |= LLWU_FILT1_FILTF_MASK;
//   }
//   if(LLWU_FILT2 & LLWU_FILT2_FILTF_MASK){
//
//       LLWU_FILT2 |= LLWU_FILT2_FILTF_MASK;
//   }
   
	   LLWU_F1 = 0xFF;            // clear wakeup flags
	   LLWU_F2 = 0xFF;            // clear wakeup flags
	   LLWU_F3 = 0xFF;            // clear wakeup flags
	
   debugpins_radio_clr();

}