mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Merge branch 'master' into master
This commit is contained in:
commit
858d6fd15b
@ -897,6 +897,43 @@ void ESP8266WiFiClass::_smartConfigCallback(uint32_t st, void* result)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* set Sleep mode
|
||||
* @param type sleep_type_t
|
||||
* @return bool
|
||||
*/
|
||||
bool ESP8266WiFiClass::setSleepMode(WiFiSleepType_t type) {
|
||||
return wifi_set_sleep_type((sleep_type_t)type);
|
||||
}
|
||||
|
||||
/**
|
||||
* get Sleep mode
|
||||
* @return sleep_type_t
|
||||
*/
|
||||
WiFiSleepType_t ESP8266WiFiClass::getSleepMode() {
|
||||
return (WiFiSleepType_t)wifi_get_sleep_type();
|
||||
}
|
||||
|
||||
/**
|
||||
* set phy Mode
|
||||
* @param mode phy_mode_t
|
||||
* @return bool
|
||||
*/
|
||||
bool ESP8266WiFiClass::setPhyMode(WiFiPhyMode_t mode) {
|
||||
return wifi_set_phy_mode((phy_mode_t)mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* get phy Mode
|
||||
* @return phy_mode_t
|
||||
*/
|
||||
WiFiPhyMode_t ESP8266WiFiClass::getPhyMode() {
|
||||
return (WiFiPhyMode_t)wifi_get_phy_mode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
void ESP8266WiFiClass::_eventCallback(void* arg)
|
||||
|
@ -36,8 +36,21 @@ extern "C" {
|
||||
#define WIFI_SCAN_RUNNING (-1)
|
||||
#define WIFI_SCAN_FAILED (-2)
|
||||
|
||||
|
||||
// Note:
|
||||
// this enums need to be in sync with the SDK!
|
||||
|
||||
enum WiFiMode { WIFI_OFF = 0, WIFI_STA = 1, WIFI_AP = 2, WIFI_AP_STA = 3 };
|
||||
|
||||
typedef enum {
|
||||
WIFI_PHY_MODE_11B = 1, WIFI_PHY_MODE_11G = 2, WIFI_PHY_MODE_11N = 3
|
||||
} WiFiPhyMode_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_NONE_SLEEP = 0, WIFI_LIGHT_SLEEP = 2, WIFI_MODEM_SLEEP = 3
|
||||
} WiFiSleepType_t;
|
||||
|
||||
|
||||
class ESP8266WiFiClass
|
||||
{
|
||||
public:
|
||||
@ -375,6 +388,32 @@ public:
|
||||
friend class WiFiClient;
|
||||
friend class WiFiServer;
|
||||
|
||||
/**
|
||||
* set Sleep mode
|
||||
* @param type WiFiPhyMode_t
|
||||
* @return bool
|
||||
*/
|
||||
bool setSleepMode(WiFiSleepType_t type);
|
||||
|
||||
/**
|
||||
* get Sleep mode
|
||||
* @return sleep_type_t
|
||||
*/
|
||||
WiFiSleepType_t getSleepMode();
|
||||
|
||||
/**
|
||||
* set phy Mode
|
||||
* @param mode phy_mode_t
|
||||
* @return bool
|
||||
*/
|
||||
bool setPhyMode(WiFiPhyMode_t mode);
|
||||
|
||||
/**
|
||||
* get phy Mode
|
||||
* @return phy_mode_t
|
||||
*/
|
||||
WiFiPhyMode_t getPhyMode();
|
||||
|
||||
protected:
|
||||
void _mode(WiFiMode);
|
||||
static void _scanDone(void* result, int status);
|
||||
|
@ -333,30 +333,30 @@ void wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
|
||||
|
||||
void wifi_promiscuous_set_mac(const uint8_t *address);
|
||||
|
||||
enum phy_mode {
|
||||
typedef enum {
|
||||
PHY_MODE_11B = 1,
|
||||
PHY_MODE_11G = 2,
|
||||
PHY_MODE_11N = 3
|
||||
};
|
||||
} phy_mode_t;
|
||||
|
||||
enum phy_mode wifi_get_phy_mode(void);
|
||||
bool wifi_set_phy_mode(enum phy_mode mode);
|
||||
phy_mode_t wifi_get_phy_mode(void);
|
||||
bool wifi_set_phy_mode(phy_mode_t mode);
|
||||
|
||||
enum sleep_type {
|
||||
typedef enum {
|
||||
NONE_SLEEP_T = 0,
|
||||
LIGHT_SLEEP_T,
|
||||
MODEM_SLEEP_T
|
||||
};
|
||||
} sleep_type_t;
|
||||
|
||||
bool wifi_set_sleep_type(enum sleep_type type);
|
||||
enum sleep_type wifi_get_sleep_type(void);
|
||||
bool wifi_set_sleep_type(sleep_type_t type);
|
||||
sleep_type_t wifi_get_sleep_type(void);
|
||||
|
||||
void wifi_fpm_open(void);
|
||||
void wifi_fpm_close(void);
|
||||
void wifi_fpm_do_wakeup(void);
|
||||
sint8 wifi_fpm_do_sleep(uint32 sleep_time_in_us);
|
||||
void wifi_fpm_set_sleep_type(enum sleep_type type);
|
||||
enum sleep_type wifi_fpm_get_sleep_type(void);
|
||||
void wifi_fpm_set_sleep_type(sleep_type_t type);
|
||||
sleep_type_t wifi_fpm_get_sleep_type(void);
|
||||
|
||||
enum {
|
||||
EVENT_STAMODE_CONNECTED = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user