int main( void )
{
    halInit();
    moduleInit();
    printf("\r\nWriting NV Items\r\n");
    result = moduleReset();
    if (result == MODULE_SUCCESS)
    {
        displaySysResetInd();  // Display the contents of the received SYS_RESET_IND message
    } else {
        printf("Module Reset ERROR 0x%02X\r\n", result);
    }
    debugConsoleIsr = &handleDebugConsoleInterrupt;   //call method handleDebugConsoleInterrupt() when a byte is received    
    HAL_ENABLE_INTERRUPTS();              //Enable Interrupts

    while (1)
    {
        uint8_t whichNvItem = getWhichNvItemToWrite();  
        if (whichNvItem != NO_CHARACTER_RECEIVED)
        {
            uint8_t nvItemSize = getNvItemSize(whichNvItem);
            printf("\r\nWriting to NV item %u, L%u:", whichNvItem, nvItemSize);    
            printHexBytes(dataToWrite, nvItemSize);
            result = sysNvWrite(whichNvItem, dataToWrite);
            if (result != MODULE_SUCCESS)
            {
                printf("sysNvWrite ERROR 0x%02X\r\n", result);
            }
        }
    }
}
int main( void )
{
    halInit();
    moduleInit();    
    printf("\r\nResetting Module, then getting MAC Address\r\n");
    HAL_ENABLE_INTERRUPTS();
    
    result = moduleReset();
    if (result == MODULE_SUCCESS)
    {
        /* Display the contents of the received SYS_RESET_IND message */
        displaySysResetInd();  
    } else {
        printf("ERROR 0x%02X\r\n", result);
    }    
    
    while (1)
    {
        result = zbGetDeviceInfo(DIP_MAC_ADDRESS);
        if (result == MODULE_SUCCESS)
        {
            uint8_t* mac = zmBuf+SRSP_DIP_VALUE_FIELD;
            printf("MAC (as sent, LSB first):");
            printHexBytes(mac, 8);
            
            /* Note: the MAC address comes over the wire in reverse order (LSB first)
            So we swap the order of the bytes so we can display it correctly. */
            uint8_t temp[8];
            int i;
            for (i=0; i<8; i++)
            {
                temp[i] = mac[7-i];
            }
            printf("MAC (correct, MSB first):");
            printHexBytes(temp, 8);
            printf("\r\n");
        } else {
            printf("ERROR 0x%02X\r\n", result);
        }
        toggleLed(1);
        delayMs(1000);
    }
}
int main( void )
{

    halInit();
    moduleInit();
    printf("\r\nResetting Module\r\n"); 
    HAL_ENABLE_INTERRUPTS();    
    moduleReset();
    while (1)
    {
        printf("Module Reset: ");
        result = moduleReset();
        if (result == MODULE_SUCCESS)
        {
            displaySysResetInd();  // Display the contents of the received SYS_RESET_IND message
        } else {
            printf("ERROR 0x%02X\r\n", result);
        }
        delayMs(3000);
    }
}