ESP8266_RTOS_SDK v1.4.0

- Main Page
- Modules
- Data Structures
- Files

Typedefs | Functions
Force Sleep APIs
WiFi Related APIs

WiFi Force Sleep APIs. More...

## Typedefs
typedef void(* | fpm_wakeup_cb) (void)

## Functions
void | wifi_fpm_open (void)
| Enable force sleep function. More...
void | wifi_fpm_close (void)
| Disable force sleep function. More...
void | wifi_fpm_do_wakeup (void)
| Wake ESP8266 up from MODEM_SLEEP_T force sleep. More...
void | wifi_fpm_set_wakeup_cb (fpm_wakeup_cb cb)
| Set a callback of waken up from force sleep because of time out. More...
sint8 | wifi_fpm_do_sleep (uint32 sleep_time_in_us)
| Force ESP8266 enter sleep mode, and it will wake up automatically when time out. More...
void | wifi_fpm_set_sleep_type (sleep_type type)
| Set sleep type for force sleep function. More...
sleep_type | wifi_fpm_get_sleep_type (void)
| Get sleep type of force sleep function. More...

## Detailed Description

WiFi Force Sleep APIs.

## Function Documentation

void wifi_fpm_close | ( | void |  | ) |

Disable force sleep function.

Parameters

  null |

Returns
  null

sint8 wifi_fpm_do_sleep | ( | uint32 | sleep_time_in_us | ) |

Force ESP8266 enter sleep mode, and it will wake up automatically when time out.

Attention
  1. This API can only be called when force sleep function is enabled, after calling wifi_fpm_open. This API can not be called after calling wifi_fpm_close.
  2. If this API returned 0 means that the configuration is set successfully, but the ESP8266 will not enter sleep mode immediately, it is going to sleep in the system idle task. Please do not call other WiFi related function right after calling this API.

Parameters

  uint32 | sleep_time_in_us : sleep time, ESP8266 will wake up automatically when time out. Unit: us. Range: 10000 ~ 268435455(0xFFFFFFF). If sleep_time_in_us is 0xFFFFFFF, the ESP8266 will sleep till if wifi_fpm_set_sleep_type is set to be LIGHT_SLEEP_T, ESP8266 can wake up by GPIO. if wifi_fpm_set_sleep_type is set to be MODEM_SLEEP_T, ESP8266 can wake up by wifi_fpm_do_wakeup.

Returns
  0, setting succeed;
  -1, fail to sleep, sleep status error;
  -2, fail to sleep, force sleep function is not enabled.

void wifi_fpm_do_wakeup | ( | void |  | ) |

Wake ESP8266 up from MODEM_SLEEP_T force sleep.

Attention
  This API can only be called when MODEM_SLEEP_T force sleep function is enabled, after calling wifi_fpm_open. This API can not be called after calling wifi_fpm_close.

Parameters

  null |

Returns
  null

sleep_type wifi_fpm_get_sleep_type | ( | void |  | ) |

Get sleep type of force sleep function.

Parameters

  null |

Returns
  sleep type

void wifi_fpm_open | ( | void |  | ) |

Enable force sleep function.

Attention
  Force sleep function is disabled by default.

Parameters

  null |

Returns
  null

void wifi_fpm_set_sleep_type | ( | sleep_type | type | ) |

Set sleep type for force sleep function.

Attention
  This API can only be called before wifi_fpm_open.

Parameters

  sleep_type | type : sleep type

Returns
  null

void wifi_fpm_set_wakeup_cb | ( | fpm_wakeup_cb | cb | ) |

Set a callback of waken up from force sleep because of time out.

Attention
  1. This API can only be called when force sleep function is enabled, after calling wifi_fpm_open. This API can not be called after calling wifi_fpm_close.
  2. fpm_wakeup_cb_func will be called after system woke up only if the force sleep time out (wifi_fpm_do_sleep and the parameter is not 0xFFFFFFF).
  3. fpm_wakeup_cb_func will not be called if woke up by wifi_fpm_do_wakeup from MODEM_SLEEP_T type force sleep.

Parameters

  void | (*fpm_wakeup_cb_func)(void) : callback of waken up

Returns
  null