We need to set up the SSID and the password with your respective credentials.
/* macros ******************************************************************* */
#warning Set these Macros accordingly, before running this application
#define USE_DHCP 1 // 1: DHCP; 0: Static IP
#define USE_WPA 1 // 1: WPA; 0: Open Access point
#define SSID "yourWifiNetworkSSID"
#define PW "yourWifiNetworkPW"
/* local functions ********************************************************** */
We define a function to initialized the wifi, and use the method of WlanConnect_Init()
* If the Wi-Fi is initialized, it is possible to scan for surrounding Wi-Fi networks before connecting to them. In order to do that, three variable types are of particular interest.
Retcode_T - Return state for programable request logics
WlanConnect_ScanInterval_T - Defined time period in which intervals the scan occurs
WlanConnect_ScanList_T - A struct which contains the scanned network informations.
/* local functions ********************************************************** */
static void initWifi(void)
{
/* initialize the Wi-Fi module */
WlanConnect_Init();
}
The function NetworkConfig_Ipv4Value() converts the committed decimal IP parameters to hexadecimal IP parameters.
The NetworkConfig_SetIpStatic() function sets the committed IP parameters in the interface.