lpwifi 2.0.0.0
main.c File Reference

LP WiFi Click Example. More...

#include "board.h"
#include "log.h"
#include "lpwifi.h"
#include "string.h"
#include "generic_pointer.h"

Macros

#define AP_SSID   ""
 
#define AP_PASSWORD   ""
 
#define LOCAL_PORT   1
 
#define APP_OK   0
 
#define APP_ERROR_DRIVER   -1
 
#define APP_ERROR_OVERFLOW   -2
 
#define APP_ERROR_TIMEOUT   -3
 
#define RSP_OK   "OK"
 
#define RSP_ERROR   "ERROR"
 
#define PROCESS_BUFFER_SIZE   400
 
#define WAIT_FOR_CONNECTION   0
 
#define CONNECTED_TO_AP   1
 
#define NOT_CONNECTED_TO_AP   2
 
#define CONNECTED   "+WFJAP:1"
 
#define NOT_CONNECTED   "+WFJAP:0"
 
#define IP_DELIMITER   "',"
 

Functions

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

Detailed Description

LP WiFi Click Example.

Description

This example reads and processes data from LP WiFi clicks.

The demo application is composed of two sections :

Application Init

Initializes the driver and powers up the module, then connects to the desired AP and creates TCP and UDP servers on the desired local port.

Application Task

Logs all the data received from TCP/UDP clients on the USB UART.

Additional Function

  • static void lpwifi_clear_app_buf ( void )
  • static err_t lpwifi_process ( void )
  • static void lpwifi_error_check( err_t error_flag )
  • static void lpwifi_log_app_buf ( void )
  • static err_t lpwifi_rsp_check ( void )
  • static void lpwifi_check_connection( void )
Note
In order for the example to work, user needs to set the AP SSID, password, and Local port on which the TCP server and UDP socket will be created. Enter valid data for the following macros: AP_SSID, AP_PASSWORD and LOCAL_PORT.
Author
Stefan Filipovic

Macro Definition Documentation

◆ AP_PASSWORD

#define AP_PASSWORD   ""

◆ AP_SSID

#define AP_SSID   ""

◆ APP_ERROR_DRIVER

#define APP_ERROR_DRIVER   -1

◆ APP_ERROR_OVERFLOW

#define APP_ERROR_OVERFLOW   -2

◆ APP_ERROR_TIMEOUT

#define APP_ERROR_TIMEOUT   -3

◆ APP_OK

#define APP_OK   0

◆ CONNECTED

#define CONNECTED   "+WFJAP:1"

◆ CONNECTED_TO_AP

#define CONNECTED_TO_AP   1

◆ IP_DELIMITER

#define IP_DELIMITER   "',"

◆ LOCAL_PORT

#define LOCAL_PORT   1

◆ NOT_CONNECTED

#define NOT_CONNECTED   "+WFJAP:0"

◆ NOT_CONNECTED_TO_AP

#define NOT_CONNECTED_TO_AP   2

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   400

◆ RSP_ERROR

#define RSP_ERROR   "ERROR"

◆ RSP_OK

#define RSP_OK   "OK"

◆ WAIT_FOR_CONNECTION

#define WAIT_FOR_CONNECTION   0

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

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 )