/****************************************************************************
 *
 * NAME: vInit
 *
 * DESCRIPTION:
 * Initialises Zigbee stack and hardware. Final action is to start BOS, from
 * which there is no return. Subsequent application actions occur in the
 * functions defined above.
 *
 * RETURNS:
 * No return from this function
 *
 ****************************************************************************/
PRIVATE void vInit(void)
{
    int i;
    int machh, machl, maclh, macll;
    uint8  MacAddress[8];
    void   *pu8ExtAdr;
    /* Initialise Zigbee stack */
    JZS_u32InitSystem(TRUE);

    /* Set DIO for LEDs */
    vLedInitFfd();

    vLedControl(0,0);
    vLedControl(1,0);
    vLedControl(2,0);
    vLedControl(3,0);

    /* Intialise serial comms unless debug mode*/
    #ifndef GDB
        vUART_printInit();

    #endif

    /* Set sensors */
    vInitSensors();
    singledata.estate.estate = E_FILL_UNCOMPLETE;
    for(i = 0; i < 6; i++)
    {
        sensordata.data.sd.tempdata[i] = 0;
        sensordata.data.md[i].tempdata = 0;
        sensordata.data.sd.humidata[i] = 0;
        sensordata.data.md[i].humidata = 0;
        sensordata.sensorinfo[i].sensorID = 0;
        sensordata.sensorinfo[i].isValiable = FALSE;
        sensordata.sensorCount = 0;
        sensordata.datatype = UNSTARTED;
    }

    //sExtAddr.u32L = *(uint32 *)(0xf0000004);
    //sExtAddr.u32H = *(uint32 *)(0xf0000000);
    //vPrintf("%x, %x \n", sExtAddr.u32H, sExtAddr.u32L);



  /* Set pointer to point to location in internal RAM where extended address is stored */
      // pu8ExtAdr = pvAppApiGetMacAddrLocation();
     /* Load extended address into frame payload */
      // for (i = 0; i < 8; i++)
      //  {
      //   MacAddress[i] = *( (uint8*)pu8ExtAdr + i);
      //   vPrintf(" %x",MacAddress[i] );
      //  }
      //  vPrintf("\n");

    /* Start BOS */
    (void)bBosRun(TRUE);

    /* No return from the above function call */
}
Ejemplo n.º 2
0
/****************************************************************************
 *
 * NAME: vJenie_CbInit
 *
 * DESCRIPTION:
 * Initialisation of system.
 *
 * RETURNS:
 * Nothing
 *
 ****************************************************************************/
PUBLIC void vJenie_CbInit(bool_t bWarmStart)
{
	teJenieStatusCode eStatus; /* Jenie status code */

	/* Warm start - reopen UART for printf use {v2} */
	if (bWarmStart) vUART_printInit();
	/* Output function call to UART */
	vPrintf("vJenie_CbInit(%d)\n", bWarmStart);

    /* Initialise application */
    vApp_CbInit(bWarmStart);

	/* Start Jenie */
    eStatus = eJenie_Start(E_JENIE_COORDINATOR);
	/* Output function call to UART {v2} */
	vPrintf("eJenie_Start(COORDINATOR) = %d\n", eStatus);
}
Ejemplo n.º 3
0
/****************************************************************************
 *
 * NAME: vJenie_CbConfigureNetwork
 *
 * DESCRIPTION:
 * Entry point for application from boot loader.
 *
 * RETURNS:
 * Nothing
 *
 ****************************************************************************/
PUBLIC void vJenie_CbConfigureNetwork(void)
{
	/* Set up routing table */
	gJenie_RoutingEnabled    = TRUE;
	gJenie_RoutingTableSize  = ROUTING_TABLE_SIZE;
	gJenie_RoutingTableSpace = (void *) asRoutingTable;

    /* Change default network config */
    gJenie_NetworkApplicationID = APPLICATION_ID;
    gJenie_PanID                = PAN_ID;
    gJenie_Channel              = CHANNEL;
    gJenie_ScanChannels         = SCAN_CHANNELS;

	/* Open UART for printf use {v2} */
	vUART_printInit();
	/* Output function call to UART */
	vPrintf("\nvJenie_CbConfigureNetwork()\n");
}