esp_idf_bindgen/
lib.rs

1#![no_std]
2#![allow(non_upper_case_globals)]
3#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5
6#[cfg(any(target_device = "esp32", target_device = "esp8266"))]
7include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
8
9#[cfg(target_device = "esp8266")]
10mod esp8266 {
11  use super::*;
12
13  pub type BaseType_t = libc::c_long;
14  pub type UBaseType_t = libc::c_ulong;
15
16  pub type nvs_open_mode_t = nvs_open_mode;
17  pub type nvs_handle_t = nvs_handle;
18
19  pub const ESP_ERR_NVS_NEW_VERSION_FOUND: u32 = ESP_ERR_NVS_BASE + 0x10;
20
21  pub type wifi_scan_threshold_t = wifi_fast_scan_threshold_t;
22}
23
24#[cfg(target_device = "esp8266")]
25pub use esp8266::*;
26
27#[cfg(target_device = "esp8266")]
28impl Default for wifi_init_config_t {
29  fn default() -> Self {
30    Self {
31      event_handler: Some(esp_event_send),
32      osi_funcs: core::ptr::null_mut(),
33      qos_enable: WIFI_QOS_ENABLED as _,
34      ampdu_rx_enable: WIFI_AMPDU_RX_ENABLED as _,
35      rx_ampdu_buf_len: WIFI_AMPDU_RX_AMPDU_BUF_LEN,
36      rx_ampdu_buf_num: WIFI_AMPDU_RX_AMPDU_BUF_NUM as _,
37      amsdu_rx_enable: WIFI_AMSDU_RX_ENABLED as _,
38      rx_ba_win: WIFI_AMPDU_RX_BA_WIN as _,
39      rx_max_single_pkt_len: WIFI_RX_MAX_SINGLE_PKT_LEN,
40      rx_buf_len: WIFI_HW_RX_BUFFER_LEN,
41      rx_buf_num: CONFIG_ESP8266_WIFI_RX_BUFFER_NUM as _,
42      left_continuous_rx_buf_num: CONFIG_ESP8266_WIFI_LEFT_CONTINUOUS_RX_BUFFER_NUM as _,
43      rx_pkt_num: CONFIG_ESP8266_WIFI_RX_PKT_NUM as _,
44      tx_buf_num: CONFIG_ESP8266_WIFI_TX_PKT_NUM as _,
45      nvs_enable: WIFI_NVS_ENABLED as _,
46      nano_enable: 0,
47      magic: WIFI_INIT_CONFIG_MAGIC as _,
48    }
49  }
50}
51
52#[cfg(target_device = "esp32")]
53impl Default for wifi_init_config_t {
54  fn default() -> Self {
55    Self {
56      event_handler: Some(esp_event_send_internal),
57      osi_funcs: unsafe { &mut g_wifi_osi_funcs },
58      wpa_crypto_funcs: unsafe { g_wifi_default_wpa_crypto_funcs },
59      static_rx_buf_num: CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM as _,
60      dynamic_rx_buf_num: CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM as _,
61      tx_buf_type: CONFIG_ESP32_WIFI_TX_BUFFER_TYPE as _,
62      static_tx_buf_num: WIFI_STATIC_TX_BUFFER_NUM as _,
63      dynamic_tx_buf_num: WIFI_DYNAMIC_TX_BUFFER_NUM as _,
64      csi_enable: WIFI_CSI_ENABLED as _,
65      ampdu_rx_enable: WIFI_AMPDU_RX_ENABLED as _,
66      ampdu_tx_enable: WIFI_AMPDU_TX_ENABLED as _,
67      nvs_enable: WIFI_NVS_ENABLED as _,
68      nano_enable: WIFI_NANO_FORMAT_ENABLED as _,
69      tx_ba_win: WIFI_DEFAULT_TX_BA_WIN as _,
70      rx_ba_win: WIFI_DEFAULT_RX_BA_WIN as _,
71      wifi_task_core_id: WIFI_TASK_CORE_ID as _,
72      beacon_max_len: WIFI_SOFTAP_BEACON_MAX_LEN as _,
73      mgmt_sbuf_num: WIFI_MGMT_SBUF_NUM as _,
74      feature_caps: unsafe { g_wifi_feature_caps },
75      magic: WIFI_INIT_CONFIG_MAGIC as _,
76    }
77  }
78}