C

The next code is based on language C. This code would help us to connect and get the ip retrieved.

First we need to import the libraries of wifi module.

/* system header files */
#include "stdio.h"
/* additional interface header files */
#include "FreeRTOS.h"
#include "timers.h"

#include "BCDS_NetworkConfig.h"
#include "BCDS_WlanConnect.h"

#include "BCDS_CmdProcessor.h"
#include "BCDS_Assert.h"

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.

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.

Last updated

Was this helpful?