예제 #1
0
파일: rf233.c 프로젝트: Idolf/tock
int rf233_sleep(void) {
  /* Check whether we're already sleeping */
  if (!sleep_on) {
    PRINTF("RF233: Putting to sleep.\n");
    //delay_ms(1);
    sleep_on = 1;
    /* Turn off the Radio */
    rf233_off();
    /* Set the SLP_PIN to high */
    gpio_set(SLP_PIN);
  }
  
  return 0;
}
예제 #2
0
/* switch the radio off */
int
off(void)
{ 
  #if NULLRDC_CONF_802154_AUTOACK_HW
  if(rf233_status() != STATE_RX_AACK_ON ) {
  #else
  if(rf233_status() != STATE_RX_ON) {
  #endif
    /* fail, we need the radio transceiver to be in this state */
    return -1;
  }

  /* turn off the radio transceiver */
  ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
  RF233_COMMAND(TRXCMD_TRX_OFF);
  radio_is_on = 0;
  return 0;
}
/*---------------------------------------------------------------------------*/
/* Put the Radio in sleep mode */

int 
rf233_sleep(void)
{
	int status;
	/* Check whether we're already sleeping */
	if (!sleep_on) {
	//printf("\r\n goto sleep %d",rf233_get_channel());
	//delay_ms(1);
	sleep_on = 1;
	/* Turn off the Radio */
	status = rf233_off();
	/* Set the SLP_PIN to high */
	  if(status == 0) {
	    goto_sleep();
	  }
	}
	
	return 0;
	
}