Example #1
0
/** @brief Wait for the device to become ready per GPIO
 */
void halExtDeviceWaitReady(void)
{
  halResetWatchdog();
  while (! halExtDeviceIsReady()) {
    // spin
  }
  halResetWatchdog();
}
Example #2
0
/*---------------------------------------------------------------------------*/
void
watchdog_periodic(void)
{
  /* This function is called periodically to restart the watchdog
     timer. */
  halResetWatchdog();
}
Example #3
0
Ecode_t COM_ReadLine(COM_Port_t port, char *data, uint8_t max)
{
  if (checkValidPort(port)==false)
  {
    return EMBER_ERR_FATAL;
  }
  uint8_t index=0;

  while(COM_ReadPartialLine(port, data, max, &index) != EMBER_SUCCESS) {
    halResetWatchdog();
  }
  return EMBER_SUCCESS;
}
Example #4
0
EzspStatus halNcpHardResetReqBootload(bool requestBootload)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  
  //reset the NCP and wait for it to come back.
  //assert nRESET low (by changing it to push-pull output)
  ASSERT_nRESET();
  //the state of the nWAKE pin while the NCP is booting asks the NCP to
  //either enter the bootloader (nWAKE is low) or continue like normal
  if(requestBootload) {
    //request bootloader
    ASSERT_nWAKE();
  } else {
    //continue with normal boot
    IDLE_nWAKE();
  }
  halCommonDelayMicroseconds(NCP_RESET_DELAY);
  //deassert nRESET (by returning it to input, pullup)
  IDLE_nRESET();
  halNcpHostIntAssertedOnPowerup = false;
  //wait for nHOST_INT to assert to say it is fully booted
  halResetWatchdog(); //reset the watchdog since this could take some time
  
  //It is legal to hijack our inter-command spacing timer at this point
  //because the NCP is not doing anything else.
  //Configure the timer for STARTUP_TIMEOUT, but do not enable the
  //timer interrupt or nHOST_INT interrupt since we'll be polling the
  //status of the timer interrupt and the nHOST_INT flag.
  ATOMIC(
    SET_SPIP_TIMER(STARTUP_TIMEOUT, DISABLE);
    nHOST_INT_ISR_OFF();
  )
  
  //Ideally we would use a call to halNcpHasData() here to see if nHOST_INT
  //has been asserted, but the function halNcpHasData() is
  //mutually exclusive with the use of nWAKE.  Since this is a special case
  //only used for triggering the bootloader, we can directly check for the
  //nHOST_INT falling edge here.
  while(!nHOST_INT_PENDING) {
Example #5
0
static void loop(void)
{
  while (true) {
    // Reset the watchdog timer to prevent a timeout.
    halResetWatchdog();

    PROCESS_MANAGEMENT_COMMAND();

    if (init) {
      init = false;
      emberAfInit();
    }

    // Let the stack, application, and plugins run periodic tasks.  This
    // function is generated.
    emberAfTick();

    // Run the application and plugin events.
    emberRunTask(emAppTask);

    simulatedTimePassesMs(emberMsToNextEvent(emAppEvents, MAX_INT32U_VALUE));
  }
}
Example #6
0
int MAIN(MAIN_FUNCTION_PARAMETERS)
{
  // Let the application and plugins do early initialization.  This function is
  // generated.
  emberAfMain(MAIN_FUNCTION_ARGUMENTS);

  // Initialize the HAL and enable interrupts.
  halInit();
  INTERRUPTS_ON();

  // Initialize the serial ports.
  SERIAL_INIT();

  // Display diagnostic information about the most recent reset.
  PRINT_RESET_INFORMATION();

  // Initialize a task for the application and plugin events and enable idling.
  emAppTask = emberTaskInit(emAppEvents);
  emberTaskEnableIdling(true);

  // Initialize the stack and wait until it finishes.  We do this so that the
  // application doesn't get ahead of the stack.
  emberInit();
  while (!init) {
    halResetWatchdog();
    PROCESS_MANAGEMENT_COMMAND();
  }
  init = false;

  // Initialize the application and plugins.  This function is generated.
  emberAfInit();

  // Run the application loop, which usually never terminates.
  loop();

  return 0;
}
Example #7
0
void halHostSerialPowerdown(void)
{
  //we need to block (interrupts are off), until transmission is done
while(nSSEL_IS_LOW) { halResetWatchdog(); }
}