!! Harmony Custom Name of GPIO, no space !!
---------------------------------------------------------------------
WDRV_WINC_RESETN     (PA03 as GPIO output, Latch Hight)
WDRV_WINC_CHIP_EN    (PA20 as GPIO output, Latch Hight)
LED2                 (PA21 as GPIO output, Latch Hight)
!! Remember to !!    (PA04 as EIC_EXINT4)

---------------------------------------------------------------------
=====================================================================
---------------------------------------------------------------------
!! Add below code in app_drv_winc.h !!
---------------------------------------------------------------------
    // APP_DRV_WINC_STATE_SERVICE_TASKS,
    APP_DRV_WINC_STATE_OPEN,
    APP_DRV_WINC_STATE_SCAN_START,
    APP_DRV_WINC_STATE_SCANNING,
    APP_DRV_WINC_STATE_SCAN_GET_RESULT,
    APP_DRV_WINC_STATE_SCAN_DONE,
    APP_DRV_WINC_STATE_CONNECTING,
    APP_DRV_WINC_STATE_CONNECTED,
    APP_DRV_WINC_STATE_DISCONNECTED,
    APP_DRV_WINC_STATE_ERROR,
    APP_DRV_WINC_STATE_IDLE,

---------------------------------------------------------------------


---------------------------------------------------------------------
!! Add below code in app_drv_winc.c !!
---------------------------------------------------------------------
    switch ( app_drv_wincData.state )
    {
    case APP_DRV_WINC_STATE_INIT:
        app_drv_wincData.state = APP_DRV_WINC_STATE_OPEN;
        break;

    case APP_DRV_WINC_STATE_OPEN:
        app_drv_wincData.state = APP_DRV_WINC_STATE_SCAN_START;
        break;

    case APP_DRV_WINC_STATE_SCAN_START:
        app_drv_wincData.state = APP_DRV_WINC_STATE_SCANNING;
        break;

    case APP_DRV_WINC_STATE_SCANNING:
        app_drv_wincData.state = APP_DRV_WINC_STATE_SCAN_GET_RESULT;
        break;

    case APP_DRV_WINC_STATE_SCAN_GET_RESULT:
        app_drv_wincData.state = APP_DRV_WINC_STATE_SCAN_DONE;
        break;

    case APP_DRV_WINC_STATE_SCAN_DONE :
        app_drv_wincData.state = APP_DRV_WINC_STATE_CONNECTING;
        break;

    case APP_DRV_WINC_STATE_CONNECTING:
        break;
        
    case APP_DRV_WINC_STATE_CONNECTED:
        break;

    case APP_DRV_WINC_STATE_DISCONNECTED:
        app_drv_wincData.state = APP_DRV_WINC_STATE_CONNECTING;
        break;

    case APP_DRV_WINC_STATE_ERROR:
        app_drv_wincData.state = APP_DRV_WINC_STATE_IDLE;
        break;

    case APP_DRV_WINC_STATE_IDLE:
        break;
    }

---------------------------------------------------------------------
#include "app_drv_usart1.h"
#include "driver/spi/drv_spi.h"
#include "driver/winc/include/wdrv_winc_client_api.h"
#include <stdio.h>
#include <string.h>

---------------------------------------------------------------------
#define WLAN_SSID         "RTC_ROOM"
#define WLAN_AUTH_WPA_PSK
#define WLAN_PSK          "0800717718"
WDRV_WINC_AUTH_CONTEXT authCtx;
WDRV_WINC_BSS_CONTEXT  bssCtx;
WDRV_WINC_BSS_INFO     BSSInfo;
bool foundBSS;

DRV_HANDLE WINCHandle;

---------------------------------------------------------------------
void DHCPAddressEventCallback(DRV_HANDLE handle, uint32_t ipAddress)
{
    char s[20];

    USART1printf("IP address is %s\r\n", inet_ntop(AF_INET, &ipAddress, s, sizeof(s)));
}

void ConnectNotifyCallback(DRV_HANDLE handle, WDRV_WINC_ASSOC_HANDLE assocHandle, WDRV_WINC_CONN_STATE currentState, WDRV_WINC_CONN_ERROR errorCode)
{
    switch( currentState )
    {
    case WDRV_WINC_CONN_STATE_CONNECTED:
        USART1printf("Connected\r\n");

        app_drv_wincData.state = APP_DRV_WINC_STATE_CONNECTED;
        break;

    case WDRV_WINC_CONN_STATE_DISCONNECTED:
        USART1printf("Disconnected\r\n");

        app_drv_wincData.state = APP_DRV_WINC_STATE_DISCONNECTED;
        break;

#ifdef WDRV_WINC_DEVICE_BSS_ROAMING
    case WDRV_WINC_CONN_STATE_ROAMED:
        break;
#endif
    }
}

---------------------------------------------------------------------
        if(WDRV_WINC_Status(sysObj.drvWifiWinc) == SYS_STATUS_READY)
        {
            app_drv_wincData.state = APP_DRV_WINC_STATE_OPEN;
        }

---------------------------------------------------------------------
        WINCHandle = WDRV_WINC_Open(0, 0);
        if(WINCHandle == DRV_HANDLE_INVALID)
        {
            app_drv_wincData.state = APP_DRV_WINC_STATE_ERROR;
            break;
        }

---------------------------------------------------------------------
        USART1printf("DRV_WINC error!\r\n");

---------------------------------------------------------------------
        WDRV_WINC_IPUseDHCPSet( WINCHandle, &DHCPAddressEventCallback );
		
        if( WDRV_WINC_BSSFindFirst(WINCHandle, WDRV_WINC_ALL_CHANNELS, true, NULL, NULL) == WDRV_WINC_STATUS_OK )
        {
            app_drv_wincData.state = APP_DRV_WINC_STATE_SCANNING;
            foundBSS = false;
        }

---------------------------------------------------------------------
        if( WDRV_WINC_BSSFindInProgress(WINCHandle) == false )
        {
            USART1printf("Scan complete, %d AP(s) found\r\n", WDRV_WINC_BSSFindGetNumBSSResults(WINCHandle));
            app_drv_wincData.state = APP_DRV_WINC_STATE_SCAN_GET_RESULT;
        }

---------------------------------------------------------------------
        if( WDRV_WINC_BSSFindGetInfo(WINCHandle, &BSSInfo) == WDRV_WINC_STATUS_OK )
        {
            USART1printf("AP found: RSSI: %d %s\r\n", BSSInfo.rssi, BSSInfo.ctx.ssid.name);

            if( ((sizeof(WLAN_SSID)-1) == BSSInfo.ctx.ssid.length) && (0 == memcmp(BSSInfo.ctx.ssid.name, WLAN_SSID, BSSInfo.ctx.ssid.length)) )
            {
                foundBSS = true;
            }

        }

---------------------------------------------------------------------
            switch( WDRV_WINC_BSSFindNext(WINCHandle, NULL) )
            {
            case WDRV_WINC_STATUS_BSS_FIND_END:
                if( foundBSS == true )
                {
                    USART1printf("Target AP found, trying to connect\r\n");
                    app_drv_wincData.state = APP_DRV_WINC_STATE_SCAN_DONE;
                }
                else
                {
                    USART1printf("Target BSS not found\r\n");
                    app_drv_wincData.state = APP_DRV_WINC_STATE_IDLE;
                }
                break;
            case WDRV_WINC_STATUS_NOT_OPEN:
            case WDRV_WINC_STATUS_INVALID_ARG:
                app_drv_wincData.state = APP_DRV_WINC_STATE_ERROR;
                break;
            default:
                break;
            }

---------------------------------------------------------------------
        app_drv_wincData.state = APP_DRV_WINC_STATE_ERROR;

        if( WDRV_WINC_BSSCtxSetDefaults(&bssCtx) != WDRV_WINC_STATUS_OK )
        { break; }

        if( WDRV_WINC_BSSCtxSetSSID(&bssCtx, (uint8_t*)WLAN_SSID, strlen(WLAN_SSID) ) != WDRV_WINC_STATUS_OK )
        { break; }

#if defined(WLAN_AUTH_OPEN)
        if( WDRV_WINC_AuthCtxSetOpen(&authCtx) ) != WDRV_WINC_STATUS_OK )
#elif defined(WLAN_AUTH_WPA_PSK)
        if( WDRV_WINC_AuthCtxSetWPA(&authCtx, (uint8_t*)WLAN_PSK, strlen(WLAN_PSK) ) != WDRV_WINC_STATUS_OK )
#endif
        { break; }

        if( WDRV_WINC_BSSConnect(WINCHandle, &bssCtx, &authCtx, &ConnectNotifyCallback) == WDRV_WINC_STATUS_OK )
        {
            app_drv_wincData.state = APP_DRV_WINC_STATE_CONNECTING;
        }

---------------------------------------------------------------------
        WDRV_WINC_IPLinkActive( WINCHandle );

---------------------------------------------------------------------
        if( WDRV_WINC_BSSReconnect(WINCHandle, &ConnectNotifyCallback) == WDRV_WINC_STATUS_OK )
        {
            app_drv_wincData.state = APP_DRV_WINC_STATE_CONNECTING;
        }

---------------------------------------------------------------------



=====================================================================
---------------------------------------------------------------------
!! Add below code in main.c !!
---------------------------------------------------------------------
            LED2_Toggle(); // Modify this line 

---------------------------------------------------------------------



=====================================================================
---------------------------------------------------------------------
!! Add below code in app_drv_i2c2.c !!
---------------------------------------------------------------------
        for( int Inst = DRV_I2C_INDEX_0 ; Inst <= DRV_I2C_INDEX_0 ; Inst++ ) // Modify this line

---------------------------------------------------------------------
