Other Parts Discussed in Thread: Z-STACK
In samplelight(HA Z-Stack 1.2.1), this is the reset code.
if ( keys & HAL_KEY_SW_6 )
{
zclSampleLight_BasicResetCB();
}
static void zclSampleLight_BasicResetCB( void )
{
NLME_LeaveReq_t leaveReq;
// Set every field to 0
osal_memset( &leaveReq, 0, sizeof( NLME_LeaveReq_t ) );
// This will enable the device to rejoin the network after reset.
leaveReq.rejoin = TRUE;
// Set the NV startup option to force a "new" join.
zgWriteStartupOptions( ZG_STARTUP_SET, ZCD_STARTOPT_DEFAULT_NETWORK_STATE );
// Leave the network, and reset afterwards
if ( NLME_LeaveReq( &leaveReq ) != ZSuccess )
{
// Couldn't send out leave; prepare to reset anyway
ZDApp_LeaveReset( FALSE );
}
}
-------------------
What am I supposed to put in here?
if ( keys & HAL_KEY_SW_6 || ?????)
Let say I want it to reset every midnight 12:00 AM. Any tips?
-------------------
Another questions is how I can call a Watchdog Timer Reset condition? Let's say if the router/end devices is not connected to the coordinator or another devices for a certain period of time, it will call a watchdog timer reset.
I can see WDCTL in hal_mcu.h and Onboard.h, but I don't know how to use it in application such as samplelight.c
Thank you.