Microchip® Advanced Software Framework

winc3400/wifi_ble_provisioning_example/main21.c File Reference

WINC3400 WiFi BLE Provisioning Profile Demo Example.

Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "main.h"
#include "ble_manager.h"
#include "driver/include/m2m_wifi.h"
#include "driver/include/m2m_periph.h"
#include "m2m_ble.h"
#include "at_ble_api.h"
#include "provisioning_app.h"
#include "ble_profiles/wifi_provisioning/wifi_provisioning.h"

Macros

#define APP_BTN_EVENT_BTN1_LONG_PRESS   2
 
#define APP_BTN_EVENT_BTN1_SHORT_PRESS   1
 
#define APP_BTN_EVENT_BTN2_LONG_PRESS   8
 
#define APP_BTN_EVENT_BTN2_SHORT_PRESS   4
 
#define APP_STATE_COMPLETE   6
 
#define APP_STATE_IDLE   0
 
#define APP_STATE_PROVISIONING   2
 
#define APP_STATE_WAITING_FOR_BUTTON_PRESS   3
 
#define APP_STATE_WAITING_FOR_PROFIFE_SWITCH   5
 
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION   4
 
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION   1
 
#define APP_WIFI_PROV_DISPLAY_NAME   ("3400 DEMO")
 
#define CONF_STDIO_BAUDRATE   115200
 
#define CONF_STDIO_MUX_SETTING   EDBG_CDC_SERCOM_MUX_SETTING
 
#define CONF_STDIO_PINMUX_PAD0   EDBG_CDC_SERCOM_PINMUX_PAD0
 
#define CONF_STDIO_PINMUX_PAD1   EDBG_CDC_SERCOM_PINMUX_PAD1
 
#define CONF_STDIO_PINMUX_PAD2   EDBG_CDC_SERCOM_PINMUX_PAD2
 
#define CONF_STDIO_PINMUX_PAD3   EDBG_CDC_SERCOM_PINMUX_PAD3
 
#define CONF_STDIO_USART_MODULE   EDBG_CDC_MODULE
 
#define CONNECTION_ATTEMPT_CONNECTED   1
 
#define CONNECTION_ATTEMPT_CONNECTING   0
 
#define CONNECTION_ATTEMPT_DISCONNECTED   3
 
#define CONNECTION_ATTEMPT_FAILED   4
 
#define CONNECTION_ATTEMPT_PROVISIONED   2
 
#define HEX2ASCII(x)   (((x)>=10)? (((x)-10)+'A') : ((x)+'0'))
 
#define STRING_HEADER
 
#define WIFI_CONNECT_TIMEOUT   15000
 

Functions

static
at_ble_event_parameter_t
gu8BleParam 
__aligned (4)
 
static void app_ble_wifi_provisioning (void)
 
static void app_button_press_callback (uint8 btn, uint8 press)
 
static void app_main (void)
 
static void app_wifi_handle_event (uint8 u8MsgType, void *pvMsg)
 
static void app_wifi_init (tpfAppWifiCb wifi_cb_func)
 
static void configure_console (void)
 Configure UART console. More...
 
int main (void)
 
uint32 nmi_inet_addr (char *pcIpAddr)
 
static void wifi_connect_timeout (void)
 

Variables

uint8_t app_state = APP_STATE_WAITING_FOR_WIFI_DISCONNECTION
 
static struct usart_module cdc_uart_module
 UART module for debug. More...
 
static volatile uint8 gu8BtnEvent
 
static uint8_t gu8ConnectionAttempt
 
static uint8 gu8ScanIndex
 
static volatile uint8 gu8WiFiConnectionState = M2M_WIFI_UNDEF
 
static uint8_t led_toggle
 
bool volatile timer_cb_done
 

#define APP_BTN_EVENT_BTN1_LONG_PRESS   2
#define APP_BTN_EVENT_BTN1_SHORT_PRESS   1
#define APP_BTN_EVENT_BTN2_LONG_PRESS   8
#define APP_BTN_EVENT_BTN2_SHORT_PRESS   4
#define APP_STATE_COMPLETE   6
#define APP_STATE_IDLE   0
#define APP_STATE_PROVISIONING   2
#define APP_STATE_WAITING_FOR_BUTTON_PRESS   3
#define APP_STATE_WAITING_FOR_PROFIFE_SWITCH   5
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION   4
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION   1
#define APP_WIFI_PROV_DISPLAY_NAME   ("3400 DEMO")
#define CONF_STDIO_BAUDRATE   115200

Referenced by configure_console().

#define CONF_STDIO_MUX_SETTING   EDBG_CDC_SERCOM_MUX_SETTING

Referenced by configure_console().

#define CONF_STDIO_PINMUX_PAD0   EDBG_CDC_SERCOM_PINMUX_PAD0

Referenced by configure_console().

#define CONF_STDIO_PINMUX_PAD1   EDBG_CDC_SERCOM_PINMUX_PAD1

Referenced by configure_console().

#define CONF_STDIO_PINMUX_PAD2   EDBG_CDC_SERCOM_PINMUX_PAD2

Referenced by configure_console().

#define CONF_STDIO_PINMUX_PAD3   EDBG_CDC_SERCOM_PINMUX_PAD3

Referenced by configure_console().

#define CONF_STDIO_USART_MODULE   EDBG_CDC_MODULE

Referenced by configure_console().

#define CONNECTION_ATTEMPT_CONNECTED   1
#define CONNECTION_ATTEMPT_CONNECTING   0
#define CONNECTION_ATTEMPT_DISCONNECTED   3
#define CONNECTION_ATTEMPT_FAILED   4
#define CONNECTION_ATTEMPT_PROVISIONED   2
#define HEX2ASCII (   x)    (((x)>=10)? (((x)-10)+'A') : ((x)+'0'))

Referenced by app_wifi_init().

#define STRING_HEADER
Value:
"-- Wifi BLE Provisioning --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --\r\n"
#define BOARD_NAME
Definition: app_init.h:140

Referenced by main().

#define WIFI_CONNECT_TIMEOUT   15000

static at_ble_event_parameter_t gu8BleParam __aligned ( )
static
static void app_button_press_callback ( uint8  btn,
uint8  press 
)
static
static void app_main ( void  )
static
static void wifi_connect_timeout ( void  )
static

struct usart_module cdc_uart_module
static

UART module for debug.

volatile uint8 gu8BtnEvent
static
uint8_t gu8ConnectionAttempt
static
uint8 gu8ScanIndex
static

Referenced by app_wifi_handle_event().

volatile uint8 gu8WiFiConnectionState = M2M_WIFI_UNDEF
static
uint8_t led_toggle
static
bool volatile timer_cb_done