WINC1500 Power Save Mode Example.
Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include "main.h"
#include "driver/include/m2m_periph.h"
#include "driver/include/m2m_wifi.h"
#include "driver/source/nmasic.h"
Macros | |
#define | STRING_EOL "\r\n" |
#define | STRING_HEADER |
Functions | |
static void | configure_console (void) |
Configure UART console. More... | |
static void | configure_timer (void) |
Configure Timer module. More... | |
static void | disable_pullups (void) |
int | main (void) |
Main application function. More... | |
static void | timer_callback (struct tcc_module *const module) |
Timer callback function for the Request RSSI. 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... | |
struct tcc_module | deep_sleep_tcc_module |
Instance of Timer module. More... | |
static uint8 | gu8SleepStatus |
Wi-Fi Sleep status. More... | |
#define STRING_EOL "\r\n" |
#define STRING_HEADER |
Referenced by main().
|
static |
Configure UART console.
References usart_config::baudrate, cdc_uart_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().
Referenced by main().
|
static |
Configure Timer module.
Timer period is 1s = Prescaler(1024) * Period(46875) / Clock(48Mhz).
References tcc_counter_config::clock_prescaler, tcc_config::counter, deep_sleep_tcc_module, tcc_counter_config::period, TCC_CLOCK_PRESCALER_DIV1024, tcc_enable(), tcc_get_config_defaults(), tcc_init(), tcc_register_callback(), and timer_callback.
Referenced by main().
|
static |
int main | ( | void | ) |
Main application function.
Application entry point.
References configure_console(), configure_timer(), disable_pullups(), gu8SleepStatus, M2M_LISTEN_INTERVAL, M2M_PS_DEEP_AUTOMATIC, M2M_PS_MANUAL, M2M_SUCCESS, M2M_WIFI_CH_ALL, m2m_wifi_connect(), m2m_wifi_handle_events(), m2m_wifi_init(), m2m_wifi_request_sleep(), m2m_wifi_set_lsn_int(), m2m_wifi_set_sleep_mode(), MAIN_PS_REQ_SLEEP, MAIN_PS_SLEEP, MAIN_PS_SLEEP_MODE, MAIN_REQUEST_SLEEP_TIME, MAIN_WLAN_AUTH, MAIN_WLAN_PSK, MAIN_WLAN_SSID, nm_bsp_init(), NULL, tstrWifiInitParam::pfAppWifiCb, STRING_HEADER, system_init(), tstrM2mLsnInt::u16LsnInt, and wifi_cb().
|
static |
Timer callback function for the Request RSSI.
References m2m_wifi_req_curr_rssi().
|
static |
Callback to get the Wi-Fi status update.
[in] | u8MsgType | type of Wi-Fi notification. Possible types are: |
[in] | pvMsg | A 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 deep_sleep_tcc_module, gu8SleepStatus, M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, m2m_wifi_request_dhcp_client(), M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_RESP_CURRENT_RSSI, MAIN_PS_REQ_SLEEP, MAIN_PS_WAKE, MAIN_WLAN_AUTH, MAIN_WLAN_PSK, MAIN_WLAN_SSID, tcc_enable_callback(), and tstrM2mWifiStateChanged::u8CurrState.
Referenced by main().
|
static |
UART module for debug.
struct tcc_module deep_sleep_tcc_module |
Instance of Timer module.
Referenced by configure_timer(), and wifi_cb().