Microchip® Advanced Software Framework

winc1500/security_wps_example/main21.c File Reference

WINC1500 Security Connection with Wi-Fi Protected Setup(WPS) Example.

Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.

#include "asf.h"
#include "main.h"
#include "driver/include/m2m_wifi.h"
#include "driver/source/nmasic.h"

Macros

#define STRING_EOL   "\r\n"
 
#define STRING_HEADER
 

Functions

static void btn_init (void)
 Initialize buttons driver. More...
 
static void btn_press (uint8_t btn, uint8_t press)
 button pressed callback function. More...
 
static void configure_console (void)
 Configure UART console. More...
 
int main (void)
 Main application function. More...
 
static void wifi_cb (uint8_t u8MsgType, void *pvMsg)
 Callback to get the Wi-Fi status update. More...
 

Variables

static struct usart_module cdc_uart_module
 UART module for debug. More...
 
static bool gbPressButton = false
 

#define STRING_EOL   "\r\n"
#define STRING_HEADER
Value:
"-- WINC1500 security connection with Wi-Fi Protected Setup(WPS) example --"STRING_EOL \
"-- "BOARD_NAME " --"STRING_EOL \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
#define BOARD_NAME
Definition: app_init.h:140
#define STRING_EOL
Definition: winc1500/security_wps_example/main21.c:112

Referenced by main().

static void btn_init ( void  )
static

Initialize buttons driver.

References btn_press(), gbPressButton, MAIN_SW1, and port_pin_get_input_level().

Referenced by main().

static void btn_press ( uint8_t  btn,
uint8_t  press 
)
static

button pressed callback function.

References m2m_wifi_wps(), MAIN_SW1, NULL, printf, and WPS_PBC_TRIGGER.

Referenced by btn_init().

int main ( void  )

Main application function.

Application entry point. Initialize system, UART and board specific settings. Connect AP using WPS.

Returns
program return value.

References btn_init(), configure_console(), gbPressButton, M2M_SUCCESS, m2m_wifi_handle_events(), m2m_wifi_init(), m2m_wifi_set_device_name(), m2m_wifi_wps(), MAIN_WPS_PIN_NUMBER, MAIN_WPS_PUSH_BUTTON_FEATURE, nm_bsp_init(), NULL, tstrWifiInitParam::pfAppWifiCb, printf, ret, STRING_HEADER, system_init(), wifi_cb(), and WPS_PIN_TRIGGER.

static void wifi_cb ( uint8_t  u8MsgType,
void *  pvMsg 
)
static

Callback to get the Wi-Fi status update.

Parameters
[in]u8MsgTypetype of Wi-Fi notification. Possible types are:
[in]pvMsgA pointer to a buffer containing the notification parameters (if any). It should be casted to the correct data type corresponding to the notification type.

References tstrM2MWPSInfo::au8PSK, tstrM2MWPSInfo::au8SSID, m2m_strlen(), M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, M2M_WIFI_REQ_WPS, m2m_wifi_request_dhcp_client(), m2m_wifi_request_scan(), M2M_WIFI_RESP_CON_STATE_CHANGED, printf, tstrM2MWPSInfo::u8AuthType, tstrM2MWPSInfo::u8Ch, and tstrM2mWifiStateChanged::u8CurrState.

Referenced by main().

struct usart_module cdc_uart_module
static

UART module for debug.

bool gbPressButton = false
static

Referenced by btn_init(), and main().