Example #1
0
void radio_rfOff() {
   // change state
   radio_vars.state = RADIOSTATE_TURNING_OFF;
   radio_off();
   // wiggle debug pin
   debugpins_radio_clr();
   leds_radio_off();
   //enable radio interrupts
   disable_radio_interrupts();
   
   // change state
   radio_vars.state = RADIOSTATE_RFOFF;
}
Example #2
0
void radio_rfOff() {
  // change state
  radio_vars.state = RADIOSTATE_TURNING_OFF;

  // calibrates frequency synthesizer and turns it off
  radio_spiStrobe(CC1101_SCAL, &radio_vars.radioStatusByte);
 
  debugpins_radio_clr();
  leds_radio_off();
  
  // change state
  radio_vars.state = RADIOSTATE_RFOFF;
   
}
void radio_rfOff(void) {
   
   // change state
   radio_vars.state = RADIOSTATE_TURNING_OFF;
   
   cc2420_spiStrobe(CC2420_SRFOFF, &radio_vars.radioStatusByte);
   // poipoipoi wait until off
   
   // wiggle debug pin
   debugpins_radio_clr();
   
   // change state
   radio_vars.state = RADIOSTATE_RFOFF;
}
Example #4
0
void radio_rfOff() {
   // change state
   radio_vars.state = RADIOSTATE_TURNING_OFF;
   radio_spiReadReg(RG_TRX_STATUS);
   // turn radio off
   radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF);
   //radio_spiWriteReg(RG_TRX_STATE, CMD_TRX_OFF);
   while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF); // busy wait until done
   
   // wiggle debug pin
   debugpins_radio_clr();
   leds_radio_off();
   
   // change state
   radio_vars.state = RADIOSTATE_RFOFF;
}
Example #5
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;
}
Example #6
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();

}