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"
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 |
Referenced by app_ble_wifi_provisioning(), and app_button_press_callback().
#define APP_BTN_EVENT_BTN1_SHORT_PRESS 1 |
Referenced by app_button_press_callback().
#define APP_BTN_EVENT_BTN2_LONG_PRESS 8 |
Referenced by app_button_press_callback().
#define APP_BTN_EVENT_BTN2_SHORT_PRESS 4 |
Referenced by app_button_press_callback().
#define APP_STATE_COMPLETE 6 |
#define APP_STATE_IDLE 0 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_PROVISIONING 2 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_WAITING_FOR_BUTTON_PRESS 3 |
#define APP_STATE_WAITING_FOR_PROFIFE_SWITCH 5 |
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION 4 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION 1 |
Referenced by app_ble_wifi_provisioning().
#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 |
Referenced by app_ble_wifi_provisioning(), and app_wifi_handle_event().
#define CONNECTION_ATTEMPT_CONNECTING 0 |
Referenced by app_ble_wifi_provisioning(), and app_wifi_handle_event().
#define CONNECTION_ATTEMPT_DISCONNECTED 3 |
Referenced by app_ble_wifi_provisioning(), and app_wifi_handle_event().
#define CONNECTION_ATTEMPT_FAILED 4 |
Referenced by app_ble_wifi_provisioning(), app_wifi_handle_event(), and wifi_connect_timeout().
#define CONNECTION_ATTEMPT_PROVISIONED 2 |
Referenced by app_ble_wifi_provisioning(), and app_wifi_handle_event().
#define HEX2ASCII | ( | x | ) | (((x)>=10)? (((x)-10)+'A') : ((x)+'0')) |
Referenced by app_wifi_init().
#define STRING_HEADER |
Referenced by main().
#define WIFI_CONNECT_TIMEOUT 15000 |
Referenced by app_ble_wifi_provisioning().
|
static |
|
static |
References APP_BTN_EVENT_BTN1_LONG_PRESS, app_state, APP_STATE_IDLE, APP_STATE_PROVISIONING, APP_STATE_WAITING_FOR_WIFI_CONNECTION, APP_STATE_WAITING_FOR_WIFI_DISCONNECTION, AT_BLE_SUCCESS, ble_device_init(), ble_event_manager(), ble_prov_stop(), CONNECTION_ATTEMPT_CONNECTED, CONNECTION_ATTEMPT_CONNECTING, CONNECTION_ATTEMPT_DISCONNECTED, CONNECTION_ATTEMPT_FAILED, CONNECTION_ATTEMPT_PROVISIONED, CREDENTIALS_VALID, DEFAULT_AUTH, DEFAULT_KEY, DEFAULT_SSID, gu8BtnEvent, gu8ConnectionAttempt, gu8WiFiConnectionState, initialise_provisioning_app(), m2m_ble_event_get(), m2m_ble_init(), M2M_INFO, M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_DISCONNECTED, M2M_WIFI_UNDEF, nm_bsp_sleep(), nm_bsp_start_timer(), nm_bsp_stop_timer(), NULL, credentials::passphrase, provision_app_ble_disconnect(), provisioning_app_processing(), retrieve_credentials(), credentials::sec_type, credentials::ssid, credentials::ssid_length, start_provisioning_app(), WIFI_CONNECT_TIMEOUT, wifi_connect_timeout(), WIFI_CONNECTION_STATE_CONNECTING, WIFI_CONNECTION_STATE_PROVISIONED, WIFI_CONNECTION_STATE_PROVISIONFAILED, WIFI_PROVISION_STATE_FAILED, WIFI_PROVISION_STATE_HAVE_CREDENTIAL, and wifi_state_update().
Referenced by app_main().
References APP_BTN_EVENT_BTN1_LONG_PRESS, APP_BTN_EVENT_BTN1_SHORT_PRESS, APP_BTN_EVENT_BTN2_LONG_PRESS, APP_BTN_EVENT_BTN2_SHORT_PRESS, gu8BtnEvent, SW1, and SW2.
Referenced by app_main().
|
static |
References app_ble_wifi_provisioning(), app_button_press_callback(), app_wifi_handle_event(), app_wifi_init(), and nm_bsp_btn_init().
Referenced by main().
|
static |
References CONNECTION_ATTEMPT_CONNECTED, CONNECTION_ATTEMPT_CONNECTING, CONNECTION_ATTEMPT_DISCONNECTED, CONNECTION_ATTEMPT_FAILED, CONNECTION_ATTEMPT_PROVISIONED, gu8ConnectionAttempt, gu8ScanIndex, gu8WiFiConnectionState, M2M_ERR, M2M_INFO, M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, m2m_wifi_get_num_ap_found(), M2M_WIFI_REQ_DHCP_CONF, m2m_wifi_req_scan_result(), M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_RESP_CURRENT_RSSI, M2M_WIFI_RESP_SCAN_DONE, M2M_WIFI_RESP_SCAN_RESULT, M2M_WIFI_RESP_SET_GAIN_TABLE, NM_BSP_TIME_MSEC, tstrM2MGainTableRsp::s8ErrorCode, send_scan_result(), tstrM2MIPConfig::u32StaticIP, tstrM2mWifiStateChanged::u8CurrState, and tstrM2mScanDone::u8NumofCh.
Referenced by app_main().
|
static |
References tstrEthInitParam::au8ethRcvBuf, HEX2ASCII, len, m2m_ble_wifi_init(), M2M_DEVICE_NAME, M2M_ERR, M2M_INFO, M2M_LISTEN_INTERVAL, m2m_memset(), M2M_NO_PS, m2m_periph_pullup_ctrl(), M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP, M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK, M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD, M2M_PS_DEEP_AUTOMATIC, M2M_PS_MANUAL, m2m_strlen(), M2M_SUCCESS, m2m_wifi_get_mac_address(), m2m_wifi_get_otp_mac_address(), m2m_wifi_set_device_name(), m2m_wifi_set_lsn_int(), m2m_wifi_set_mac_address(), m2m_wifi_set_sleep_mode(), mac_addr, MAC_ADDRESS, tstrEthInitParam::pfAppEthCb, tstrWifiInitParam::pfAppWifiCb, PS_SLEEP_TIME_MS, ret, tstrWifiInitParam::strEthInitParam, system_reset(), tstrEthInitParam::u16ethRcvBufSize, and tstrM2mLsnInt::u16LsnInt.
Referenced by app_main().
|
static |
Configure UART console.
References usart_config::baudrate, cdc_uart_module, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, CONF_STDIO_USART_MODULE, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
int main | ( | void | ) |
References app_main(), configure_console(), nm_bsp_app_init(), nm_bsp_init(), STRING_HEADER, and system_init().
|
static |
References CONNECTION_ATTEMPT_FAILED, gu8ConnectionAttempt, M2M_INFO, and nm_bsp_stop_timer().
Referenced by app_ble_wifi_provisioning().
uint8_t app_state = APP_STATE_WAITING_FOR_WIFI_DISCONNECTION |
|
static |
UART module for debug.
|
static |
Referenced by app_ble_wifi_provisioning(), and app_button_press_callback().
|
static |
Referenced by app_ble_wifi_provisioning(), app_wifi_handle_event(), and wifi_connect_timeout().
|
static |
Referenced by app_wifi_handle_event().
|
static |
Referenced by app_ble_wifi_provisioning(), and app_wifi_handle_event().
|
static |
Referenced by ble_heart_rate_handle_timer_event(), and ble_heart_rate_value_init().
bool volatile timer_cb_done |