wifi8 2.0.0.0
main.c File Reference

WiFi8 Click example. More...

#include "board.h"
#include "log.h"
#include "wifi8.h"

Data Structures

struct  s_msg_wifi_product
 

Macros

#define MAIN_WLAN_SSID   "MikroE Public"
 
#define MAIN_WLAN_AUTH   M2M_WIFI_SEC_WPA_PSK
 
#define MAIN_WLAN_PSK   "mikroe.guest"
 
#define MAIN_TCP_SERVER_PORT   8080
 

Typedefs

typedef struct s_msg_wifi_product t_msg_wifi_product
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Variables

wifi8_sockaddr_in_t addr
 

Detailed Description

WiFi8 Click example.

Description

This application showcases capability of the WiFi 8 Click board. It initializes device, connects to local WiFi. Creates TCP, waits for connection and logs every message it receives for clients when it receives CR or LF flag it returns message back to Client.

The demo application is composed of two sections :

Application Init

Initializes Host logger, and communication module and pins. Then resets device and initializes devices firmware. If no error occurred it sets callback functions for WiFi and TCP socket, and checks current firmware version. After firmware is read it connects to local WiFi network set by user. When connected it initializes and creates socket.

Application Task

It loops function for handling events. Should notify and log messages when Client is connected/disconnected to TCP server and returns back when receives CR or LF flag.

Note
User should set MAIN_WLAN_SSID and MAIN_WLAN_PSK for connecting to local network. When devices connects to network it will log its IP that user need to connect to. After user connects it should get notification and it can send data to server. Server will return message "WiFi 8 Click" when Client sends CR or LF character in message.
Author
Luka Filipovic

Macro Definition Documentation

◆ MAIN_TCP_SERVER_PORT

#define MAIN_TCP_SERVER_PORT   8080

TCP Server port for client connection

◆ MAIN_WLAN_AUTH

#define MAIN_WLAN_AUTH   M2M_WIFI_SEC_WPA_PSK

Security type

◆ MAIN_WLAN_PSK

#define MAIN_WLAN_PSK   "mikroe.guest"

Password for Destination SSID

◆ MAIN_WLAN_SSID

#define MAIN_WLAN_SSID   "MikroE Public"

Wi-Fi Settings Destination SSID

Typedef Documentation

◆ t_msg_wifi_product

Function Documentation

◆ application_init()

void application_init ( void )

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )

Variable Documentation

◆ addr