Esempio n. 1
0
static void Init(void) {
  /*if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) {  set a default address
    //APP_DebugPrint((unsigned char*)"ERR: Failed setting node address\r\n");
  }*/
#if defined(PL_CONFIG_BOARD_IS_ROBO)
  RAPP_SetThisNodeAddr(0xD); /* address of this network node */
#else
  RAPP_SetThisNodeAddr(0xD1); /* address of this network node */
#endif
}
Esempio n. 2
0
static portTASK_FUNCTION(RNetTask, pvParameters) {
  uint32_t cntr;
  uint8_t msgCntr;

  (void)pvParameters; /* not used */
  if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) { /* set a default address */
    for(;;); /* "ERR: Failed setting node address" */
  }
  cntr = 0; /* initialize LED counter */
  msgCntr = 0; /* initialize message counter */
  appState = RNETA_INITIAL; /* initialize state machine state */
  for(;;) {
    Process(); /* process state machine */
    cntr++;
    if (cntr==100) { /* with an RTOS 10 ms/100 Hz tick rate, this is every second */
      LED3_On(); /* blink blue LED for 20 ms */
      RAPP_SendPayloadDataBlock(&msgCntr, sizeof(msgCntr), RAPP_MSG_TYPE_PING, RNWK_ADDR_BROADCAST, RPHY_PACKET_FLAGS_NONE);
      msgCntr++;
      cntr = 0;
      FRTOS1_vTaskDelay(20/portTICK_RATE_MS);
      LED3_Off(); /* blink blue LED */
    }
    FRTOS1_vTaskDelay(10/portTICK_RATE_MS);
  } /* for */
}
Esempio n. 3
0
static void Init(void) {
//  if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) { /* set a default address */
#if PL_IS_ROBO
	#define RNWK_ADDR ADDR_ROBO
#elif PL_IS_FRDM
	#define RNWK_ADDR ADDR_FRDM
#endif
	 if (RAPP_SetThisNodeAddr(RNWK_ADDR)!=ERR_OK) { /* set a default address */
    APP_DebugPrint((unsigned char*)"ERR: Failed setting node address\r\n");
  }
}
Esempio n. 4
0
void RMT_Init() {
#ifdef G13_HAS_REMOTE
	RSTACK_Init(); /* initialize stack */
	  if (RAPP_SetMessageHandlerTable(handlerTable)!=ERR_OK) { /* assign application message handler */
	    for(;;){} /* error */
	  }
	  if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) { /* set a default address */
	    for(;;){} /* error */
	  }
	  
	  RTOS_AddTask(vRemoteTask, "RemoteTask");
#endif
}
Esempio n. 5
0
static portTASK_FUNCTION(MainTask, pvParameters) {
#if PL_HAS_SHELL
  static unsigned char localConsole_buf[48];
#endif
#if PL_HAS_RSTDIO
  static unsigned char radio_cmd_buf[48];
  CLS1_ConstStdIOType *ioRemote = RSTDIO_GetStdioRx();
#endif
#if PL_HAS_RSTDIO || PL_HAS_SHELL
  CLS1_ConstStdIOTypePtr ioLocal = CLS1_GetStdio();
#endif
  
#if PL_HAS_RSTDIO
  radio_cmd_buf[0] = '\0';
#endif
#if PL_HAS_SHELL
  localConsole_buf[0] = '\0';
  CLS1_SendStr((unsigned char*)"nRF24L01+ Demo\r\n", ioLocal->stdOut);
#endif
  RSTACK_Init(); /* initialize stack */
  if (RAPP_SetMessageHandlerTable(handlerTable)!=ERR_OK) { /* assign application message handler */
    Err((unsigned char*)"Failed setting message handler!\r\n");
  }
  if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) { /* set a default address */
    Err((unsigned char*)"Failed setting source address!\r\n");
  }
#if PL_HAS_SHELL
  (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, ioLocal, CmdParserTable);
#endif
  for(;;) {
#if PL_HAS_SHELL
    (void)CLS1_ReadAndParseWithCommandTable(localConsole_buf, sizeof(localConsole_buf), ioLocal, CmdParserTable);
#endif
#if PL_HAS_RSTDIO
    RSTDIO_Print(ioLocal); /* handle stdout/stderr messages coming in */
    (void)CLS1_ReadAndParseWithCommandTable(radio_cmd_buf, sizeof(radio_cmd_buf), ioRemote, CmdParserTable);
#endif
    LED1_Neg();
    FRTOS1_vTaskDelay(10/portTICK_RATE_MS);
  }
}
Esempio n. 6
0
void RNETA_Init(void) {
  RSTACK_Init(); /* initialize stack */
  if (RAPP_SetMessageHandlerTable(handlerTable)!=ERR_OK) { /* assign application message handler */
    for(;;){} /* error */
  }
  if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) { /* set a default address */
    for(;;){} /* error */
  }
  if (FRTOS1_xTaskCreate(
        RadioTask,  /* pointer to the task */
        "Radio", /* task name for kernel awareness debugging */
        configMINIMAL_STACK_SIZE, /* task stack size */
        (void*)NULL, /* optional task startup argument */
        tskIDLE_PRIORITY+1,  /* initial priority */
        (xTaskHandle*)NULL /* optional task handle to create */
      ) != pdPASS) {
    /*lint -e527 */
    for(;;){}; /* error! probably out of memory */
    /*lint +e527 */
  }
}
Esempio n. 7
0
static void Init(void) {
  if (RAPP_SetThisNodeAddr(RNWK_ADDR_BROADCAST)!=ERR_OK) { /* set a default address */
    APP_DebugPrint((unsigned char*)"ERR: Failed setting node address\r\n");
  }
}