fix: Fix all files when change to use standard typedef

This commit is contained in:
Wu Jian Gang
2018-05-24 17:39:25 +08:00
parent 27892430ee
commit 91f7080231
42 changed files with 435 additions and 372 deletions

View File

@ -35,11 +35,11 @@ extern "C" {
#define BIT(nr) (1UL << (nr))
#define REG_WRITE(_r, _v) (*(volatile uint32 *)(_r)) = (_v)
#define REG_READ(_r) (*(volatile uint32 *)(_r))
#define REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v)
#define REG_READ(_r) (*(volatile uint32_t *)(_r))
#define REG_SET_BIT(_r, _b) (*(volatile uint32 *)(_r) |= (_b))
#define REG_CLR_BIT(_r, _b) (*(volatile uint32 *)(_r) &= ~(_b))
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t *)(_r) |= (_b))
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t *)(_r) &= ~(_b))
#ifdef __cplusplus
}

View File

@ -27,6 +27,8 @@
#include <stdint.h>
#include "c_types.h"
/* interrupt related */
#define ETS_SPI_INUM 2
#define ETS_GPIO_INUM 4

View File

@ -25,6 +25,8 @@
#ifndef __ESP_MISC_H__
#define __ESP_MISC_H__
#include <stdint.h>
#include "lwip/ip_addr.h"
#ifdef __cplusplus
@ -52,11 +54,11 @@ extern "C" {
/**
* @brief Delay function, maximum value: 65535 us.
*
* @param uint16 us : delay time, uint: us, maximum value: 65535 us
* @param uint16_t us : delay time, uint: us, maximum value: 65535 us
*
* @return null
*/
void os_delay_us(uint16 us);
void os_delay_us(uint16_t us);
/**
* @brief Register the print output function.

View File

@ -25,6 +25,9 @@
#ifndef __ESP_SOFTAP_H__
#define __ESP_SOFTAP_H__
#include <stdint.h>
#include <stdbool.h>
#include "queue.h"
#ifdef __cplusplus
@ -49,20 +52,20 @@ extern "C" {
*/
struct softap_config {
uint8 ssid[32]; /**< SSID of ESP8266 soft-AP */
uint8 password[64]; /**< Password of ESP8266 soft-AP */
uint8 ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
uint8 channel; /**< Channel of ESP8266 soft-AP */
uint8_t ssid[32]; /**< SSID of ESP8266 soft-AP */
uint8_t password[64]; /**< Password of ESP8266 soft-AP */
uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
uint8_t channel; /**< Channel of ESP8266 soft-AP */
AUTH_MODE authmode; /**< Auth mode of ESP8266 soft-AP. Do not support AUTH_WEP in soft-AP mode */
uint8 ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8 max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */
uint16 beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 */
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */
uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 */
};
struct station_info {
STAILQ_ENTRY(station_info) next; /**< Information of next AP */
uint8 bssid[6]; /**< BSSID of AP */
uint8_t bssid[6]; /**< BSSID of AP */
struct ip4_addr ip; /**< IP address of AP */
};
@ -127,7 +130,7 @@ bool wifi_softap_set_config_current(struct softap_config *config);
*
* @return the number of stations connected to the ESP8266 soft-AP
*/
uint8 wifi_softap_get_station_num(void);
uint8_t wifi_softap_get_station_num(void);
/**
* @brief Get the information of stations connected to the ESP8266 soft-AP,
@ -230,7 +233,7 @@ bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please);
*
* @return lease time, uint: minute.
*/
uint32 wifi_softap_get_dhcps_lease_time(void);
uint32_t wifi_softap_get_dhcps_lease_time(void);
/**
* @brief Set ESP8266 soft-AP DHCP server lease time, default is 120 minutes.
@ -242,7 +245,7 @@ uint32 wifi_softap_get_dhcps_lease_time(void);
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_lease_time(uint32 minute);
bool wifi_softap_set_dhcps_lease_time(uint32_t minute);
/**
* @brief Reset ESP8266 soft-AP DHCP server lease time which is 120 minutes by default.
@ -273,7 +276,7 @@ bool wifi_softap_reset_dhcps_lease_time(void);
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_offer_option(uint8 level, void *optarg);
bool wifi_softap_set_dhcps_offer_option(uint8_t level, void *optarg);
/**
* @}

View File

@ -25,6 +25,8 @@
#ifndef __ESP_SSC_H__
#define __ESP_SSC_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -34,8 +36,8 @@ extern "C" {
typedef struct cmd_s {
char *cmd_str;
uint8 flag;
uint8 id;
uint8_t flag;
uint8_t id;
void (* cmd_func)(void);
void (* cmd_callback)(void *arg);
} ssc_cmd_t;
@ -112,7 +114,7 @@ int ssc_parse_param(char *pLine, char *argv[]);
*
* @return null
*/
void ssc_register(ssc_cmd_t *cmdset, uint8 cmdnum, void (* help)(void));
void ssc_register(ssc_cmd_t *cmdset, uint8_t cmdnum, void (* help)(void));
/**
* @}

View File

@ -25,8 +25,12 @@
#ifndef __ESP_STA_H__
#define __ESP_STA_H__
#include <stdbool.h>
#include <stdint.h>
#include "queue.h"
#include "esp_wifi.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -50,10 +54,10 @@ extern "C" {
*/
struct station_config {
uint8 ssid[32]; /**< SSID of target AP*/
uint8 password[64]; /**< password of target AP*/
uint8 bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8 bssid[6]; /**< MAC address of target AP*/
uint8_t ssid[32]; /**< SSID of target AP*/
uint8_t password[64]; /**< password of target AP*/
uint8_t bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8_t bssid[6]; /**< MAC address of target AP*/
};
/**
@ -162,12 +166,12 @@ typedef union {
} wifi_scan_time_t;
struct scan_config {
uint8 *ssid; /**< SSID of AP */
uint8 *bssid; /**< MAC address of AP */
uint8 channel; /**< channel, scan the specific channel */
uint8 show_hidden; /**< enable to scan AP whose SSID is hidden */
wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */
uint8_t *ssid; /**< SSID of AP */
uint8_t *bssid; /**< MAC address of AP */
uint8_t channel; /**< channel, scan the specific channel */
uint8_t show_hidden; /**< enable to scan AP whose SSID is hidden */
wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */
};
typedef enum {
@ -183,16 +187,16 @@ typedef enum {
struct bss_info {
STAILQ_ENTRY(bss_info) next; /**< information of next AP */
uint8 bssid[6]; /**< MAC address of AP */
uint8 ssid[32]; /**< SSID of AP */
uint8 ssid_len; /**< SSID length */
uint8 channel; /**< channel of AP */
sint8 rssi; /**< single strength of AP */
uint8_t bssid[6]; /**< MAC address of AP */
uint8_t ssid[32]; /**< SSID of AP */
uint8_t ssid_len; /**< SSID length */
uint8_t channel; /**< channel of AP */
int8_t rssi; /**< single strength of AP */
AUTH_MODE authmode; /**< authmode of AP */
uint8 is_hidden; /**< SSID of current AP is hidden or not. */
sint16 freq_offset; /**< frequency offset */
sint16 freqcal_val;
uint8 *esp_mesh_ie;
uint8_t is_hidden; /**< SSID of current AP is hidden or not. */
int16_t freq_offset; /**< frequency offset */
int16_t freqcal_val;
uint8_t *esp_mesh_ie;
CIPHER_TYPE pairwise_cipher; /**< pairwise cipher of AP */
CIPHER_TYPE group_cipher; /**< group cipher of AP */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
@ -313,17 +317,17 @@ STATION_STATUS wifi_station_get_connect_status(void);
*
* @return The number of APs recorded.
*/
uint8 wifi_station_get_current_ap_id(void);
uint8_t wifi_station_get_current_ap_id(void);
/**
* @brief Switch the ESP8266 station connection to a recorded AP.
*
* @param uint8 new_ap_id : AP's record id, start counting from 0.
* @param uint8_t new_ap_id : AP's record id, start counting from 0.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_ap_change(uint8 current_ap_id);
bool wifi_station_ap_change(uint8_t current_ap_id);
/**
* @brief Set the number of APs that can be recorded in the ESP8266 station.
@ -332,12 +336,12 @@ bool wifi_station_ap_change(uint8 current_ap_id);
*
* @attention This configuration will be saved in the Flash system parameter area if changed.
*
* @param uint8 ap_number : the number of APs that can be recorded (MAX: 5)
* @param uint8_t ap_number : the number of APs that can be recorded (MAX: 5)
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_ap_number_set(uint8 ap_number);
bool wifi_station_ap_number_set(uint8_t ap_number);
/**
* @brief Get the information of APs (5 at most) recorded by ESP8266 station.
@ -352,7 +356,7 @@ bool wifi_station_ap_number_set(uint8 ap_number);
*
* @return The number of APs recorded.
*/
uint8 wifi_station_get_ap_info(struct station_config config[]);
uint8_t wifi_station_get_ap_info(struct station_config config[]);
/**
* @brief Get rssi of the AP which ESP8266 station connected to.
@ -362,7 +366,7 @@ uint8 wifi_station_get_ap_info(struct station_config config[]);
* @return 31 : fail, invalid value.
* @return others : succeed, value of rssi. In general, rssi value < 10
*/
sint8 wifi_station_get_rssi(void);
int8_t wifi_station_get_rssi(void);
/**
* @brief Enable the ESP8266 station DHCP client.

View File

@ -25,7 +25,8 @@
#ifndef __ESP_SYSTEM_H__
#define __ESP_SYSTEM_H__
#include "c_types.h"
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@ -40,24 +41,24 @@ extern "C" {
*/
typedef enum {
REASON_DEFAULT_RST = 0, /**< normal startup by power on */
REASON_WDT_RST, /**< hardware watch dog reset */
REASON_EXCEPTION_RST, /**< exception reset, GPIO status won't change */
REASON_SOFT_WDT_RST, /**< software watch dog reset, GPIO status won't change */
REASON_SOFT_RESTART, /**< software restart ,system_restart , GPIO status won't change */
REASON_DEEP_SLEEP_AWAKE, /**< wake up from deep-sleep */
REASON_EXT_SYS_RST /**< external system reset */
REASON_DEFAULT_RST = 0, /**< normal startup by power on */
REASON_WDT_RST, /**< hardware watch dog reset */
REASON_EXCEPTION_RST, /**< exception reset, GPIO status won't change */
REASON_SOFT_WDT_RST, /**< software watch dog reset, GPIO status won't change */
REASON_SOFT_RESTART, /**< software restart ,system_restart , GPIO status won't change */
REASON_DEEP_SLEEP_AWAKE, /**< wake up from deep-sleep */
REASON_EXT_SYS_RST /**< external system reset */
} rst_reason;
struct rst_info {
rst_reason reason; /**< enum rst_reason */
uint32 exccause;
uint32 epc1;
uint32 epc2;
uint32 epc3;
uint32 excvaddr;
uint32 depc;
uint32 rtn_addr;
uint32_t exccause;
uint32_t epc1;
uint32_t epc2;
uint32_t epc3;
uint32_t excvaddr;
uint32_t depc;
uint32_t rtn_addr;
};
/**
@ -112,11 +113,11 @@ void system_restart(void);
* up, connect a GPIO to pin RST, the chip will wake up by a falling-edge
* on pin RST
*
* @param uint32 time_in_us : deep-sleep time, unit: microsecond
* @param uint32_t time_in_us : deep-sleep time, unit: microsecond
*
* @return null
*/
void system_deep_sleep(uint32 time_in_us);
void system_deep_sleep(uint32_t time_in_us);
/**
* @brief Call this API before system_deep_sleep to set the activity after the
@ -138,7 +139,7 @@ void system_deep_sleep(uint32 time_in_us);
* @return true : succeed
* @return false : fail
*/
bool system_deep_sleep_set_option(uint8 option);
bool system_deep_sleep_set_option(uint8_t option);
/**
* @brief Get system time, unit: microsecond.
@ -147,7 +148,7 @@ bool system_deep_sleep_set_option(uint8 option);
*
* @return System time, unit: microsecond.
*/
uint32 system_get_time(void);
uint32_t system_get_time(void);
/**
* @brief Print the system memory distribution, including data/rodata/bss/heap.
@ -165,7 +166,7 @@ void system_print_meminfo(void);
*
* @return Available heap size.
*/
uint32 system_get_free_heap_size(void);
uint32_t system_get_free_heap_size(void);
/**
* @brief Get the chip ID.
@ -174,7 +175,7 @@ uint32 system_get_free_heap_size(void);
*
* @return The chip ID.
*/
uint32 system_get_chip_id(void);
uint32_t system_get_chip_id(void);
/**
* @brief Get the RTC clock cycle.
@ -187,7 +188,7 @@ uint32 system_get_chip_id(void);
*
* @return RTC clock period (unit: microsecond), bit11~ bit0 are decimal.
*/
uint32 system_rtc_clock_cali_proc(void);
uint32_t system_rtc_clock_cali_proc(void);
/**
* @brief Get RTC time, unit: RTC clock cycle.
@ -210,7 +211,7 @@ uint32 system_rtc_clock_cali_proc(void);
*
* @return RTC time.
*/
uint32 system_get_rtc_time(void);
uint32_t system_get_rtc_time(void);
/**
* @brief Read user data from the RTC memory.
@ -231,7 +232,7 @@ uint32 system_get_rtc_time(void);
* @return true : succeed
* @return false : fail
*/
bool system_rtc_mem_read(uint8 src, void *dst, uint16 n);
bool system_rtc_mem_read(uint8_t src, void *dst, uint16_t n);
/**
* @brief Write user data to the RTC memory.
@ -254,7 +255,7 @@ bool system_rtc_mem_read(uint8 src, void *dst, uint16 n);
* @return true : succeed
* @return false : fail
*/
bool system_rtc_mem_write(uint8 dst, const void *src, uint16 n);
bool system_rtc_mem_write(uint8_t dst, const void *src, uint16_t n);
/**
* @brief UART0 swap.
@ -295,7 +296,7 @@ void system_uart_de_swap(void);
*
* @return Input voltage of TOUT pin 6, unit : 1/1024 V
*/
uint16 system_adc_read(void);
uint16_t system_adc_read(void);
/**
* @brief Measure the power voltage of VDD3P3 pin 3 and 4, unit : 1/1024 V.
@ -310,7 +311,7 @@ uint16 system_adc_read(void);
*
* @return Power voltage of VDD33, unit : 1/1024 V
*/
uint16 system_get_vdd33(void);
uint16_t system_get_vdd33(void);
/**
* @brief Write data into flash with protection.
@ -333,7 +334,7 @@ uint16 system_get_vdd33(void);
* @return true : succeed
* @return false : fail
*/
bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
bool system_param_save_with_protect(uint16_t start_sec, void *param, uint16_t len);
/**
* @brief Read the data saved into flash with the read/write protection.
@ -358,7 +359,7 @@ bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
* @return true : succeed
* @return false : fail
*/
bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len);
bool system_param_load(uint16_t start_sec, uint16_t offset, void *param, uint16_t len);
/**
* @brief Set the maximum value of RF TX Power, unit : 0.25dBm.
@ -369,7 +370,7 @@ bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len)
*
* @return null
*/
void system_phy_set_max_tpw(uint8 max_tpw);
void system_phy_set_max_tpw(uint8_t max_tpw);
/**
* @brief Adjust the RF TX Power according to VDD33, unit : 1/1024 V.
@ -382,7 +383,7 @@ void system_phy_set_max_tpw(uint8 max_tpw);
*
* @return null
*/
void system_phy_set_tpw_via_vdd33(uint16 vdd33);
void system_phy_set_tpw_via_vdd33(uint16_t vdd33);
/**
* @brief Enable RF or not when wakeup from deep-sleep.
@ -406,7 +407,7 @@ void system_phy_set_tpw_via_vdd33(uint16 vdd33);
*
* @return null
*/
void system_phy_set_rfoption(uint8 option);
void system_phy_set_rfoption(uint8_t option);
/** @addtogroup Upgrade_APIs
* @{
@ -420,7 +421,7 @@ void system_phy_set_rfoption(uint8 option);
* @return 0x00 : UPGRADE_FW_BIN1, i.e. user1.bin
* @return 0x01 : UPGRADE_FW_BIN2, i.e. user2.bin
*/
uint8 system_upgrade_userbin_check(void);
uint8_t system_upgrade_userbin_check(void);
/**
* @brief Reboot system to use the new software.
@ -440,7 +441,7 @@ void system_upgrade_reboot(void);
* @return #define UPGRADE_FLAG_START 0x01
* @return #define UPGRADE_FLAG_FINISH 0x02
*/
uint8 system_upgrade_flag_check();
uint8_t system_upgrade_flag_check();
/**
* @brief Set the upgrade status flag.
@ -456,7 +457,7 @@ uint8 system_upgrade_flag_check();
*
* @return null
*/
void system_upgrade_flag_set(uint8 flag);
void system_upgrade_flag_set(uint8_t flag);
/**
* @}
@ -486,7 +487,7 @@ void system_upgrade_flag_set(uint8 flag);
*
* @return Information of the boot version.
*/
uint8 system_get_boot_version(void);
uint8_t system_get_boot_version(void);
/**
* @brief Get the address of the current running user bin (user1.bin or user2.bin).
@ -495,7 +496,7 @@ uint8 system_get_boot_version(void);
*
* @return The address of the current running user bin.
*/
uint32 system_get_userbin_addr(void);
uint32_t system_get_userbin_addr(void);
/**
* @brief Get the boot mode.
@ -505,7 +506,7 @@ uint32 system_get_userbin_addr(void);
* @return #define SYS_BOOT_ENHANCE_MODE 0
* @return #define SYS_BOOT_NORMAL_MODE 1
*/
uint8 system_get_boot_mode(void);
uint8_t system_get_boot_mode(void);
/**
* @brief Restarts the system, and enters the enhanced boot mode.
@ -516,12 +517,12 @@ uint8 system_get_boot_mode(void);
* @param uint8 bin_type : type of bin
* - #define SYS_BOOT_NORMAL_BIN 0 // user1.bin or user2.bin
* - #define SYS_BOOT_TEST_BIN 1 // can only be Espressif test bin
* @param uint32 bin_addr : starting address of the bin file
* @param uint32_t bin_addr : starting address of the bin file
*
* @return true : succeed
* @return false : fail
*/
bool system_restart_enhance(uint8 bin_type, uint32 bin_addr);
bool system_restart_enhance(uint8_t bin_type, uint32_t bin_addr);
typedef enum {
FLASH_SIZE_4M_MAP_256_256 = 0, /**< Flash size : 4Mbits. Map : 256KBytes + 256KBytes */
@ -565,7 +566,7 @@ flash_size_map system_get_flash_size_map(void);
* @return true : succeed
* @return false : fail
*/
bool system_update_cpu_freq(uint8 freq);
bool system_update_cpu_freq(uint8_t freq);
/**
* @brief Get CPU frequency.
@ -574,7 +575,7 @@ bool system_update_cpu_freq(uint8 freq);
*
* @return CPU frequency, unit : MHz.
*/
uint8 system_get_cpu_freq(void);
uint8_t system_get_cpu_freq(void);
/**
* @}

View File

@ -25,6 +25,9 @@
#ifndef __ESP_TIMER_H__
#define __ESP_TIMER_H__
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -35,8 +38,8 @@ typedef void os_timer_func_t(void *timer_arg);
typedef struct _os_timer_t {
struct _os_timer_t *timer_next;
void *timer_handle;
uint32 timer_expire;
uint32 timer_period;
uint32_t timer_expire;
uint32_t timer_period;
os_timer_func_t *timer_func;
bool timer_repeat_flag;
void *timer_arg;
@ -79,7 +82,7 @@ void os_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg);
*
* @return null
*/
void os_timer_arm(os_timer_t *ptimer, uint32 msec, bool repeat_flag);
void os_timer_arm(os_timer_t *ptimer, uint32_t msec, bool repeat_flag);
/**
* @brief Disarm the timer

View File

@ -25,6 +25,8 @@
#ifndef __ESP_WIFI_H__
#define __ESP_WIFI_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -109,7 +111,7 @@ WIFI_MODE wifi_get_opmode_default(void);
*
* @attention This configuration will be saved in the Flash system parameter area if changed.
*
* @param uint8 opmode : WiFi operating modes:
* @param uint8_t opmode : WiFi operating modes:
* - 0x01: station mode;
* - 0x02: soft-AP mode
* - 0x03: station+soft-AP mode
@ -125,7 +127,7 @@ bool wifi_set_opmode(WIFI_MODE opmode);
* Set the WiFi operating mode as station, soft-AP or station+soft-AP, and
* the mode won't be saved to the Flash.
*
* @param uint8 opmode : WiFi operating modes:
* @param uint8_t opmode : WiFi operating modes:
* - 0x01: station mode;
* - 0x02: soft-AP mode
* - 0x03: station+soft-AP mode
@ -185,12 +187,12 @@ bool wifi_set_ip_info(WIFI_INTERFACE if_index, struct ip_info *info);
*
* @param WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface,
* 0x00 for STATION_IF, 0x01 for SOFTAP_IF.
* @param uint8 *macaddr : the MAC address.
* @param uint8_t *macaddr : the MAC address.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_get_macaddr(WIFI_INTERFACE if_index, uint8 *macaddr);
bool wifi_get_macaddr(WIFI_INTERFACE if_index, uint8_t *macaddr);
/**
* @brief Set MAC address of the ESP8266 WiFi station or the soft-AP interface.
@ -203,23 +205,23 @@ bool wifi_get_macaddr(WIFI_INTERFACE if_index, uint8 *macaddr);
*
* @param WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface,
* 0x00 for STATION_IF, 0x01 for SOFTAP_IF.
* @param uint8 *macaddr : the MAC address.
* @param uint8_t *macaddr : the MAC address.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_set_macaddr(WIFI_INTERFACE if_index, uint8 *macaddr);
bool wifi_set_macaddr(WIFI_INTERFACE if_index, uint8_t *macaddr);
/**
* @brief Install the WiFi status LED.
*
* @param uint8 gpio_id : GPIO ID
* @param uint8 gpio_name : GPIO mux name
* @param uint8 gpio_func : GPIO function
* @param uint8_t gpio_id : GPIO ID
* @param uint8_t gpio_name : GPIO mux name
* @param uint8_t gpio_func : GPIO function
*
* @return null
*/
void wifi_status_led_install(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func);
void wifi_status_led_install(uint8_t gpio_id, uint32_t gpio_name, uint8_t gpio_func);
/**
* @brief Uninstall the WiFi status LED.
@ -303,27 +305,27 @@ enum {
};
typedef struct {
uint32 status; /**< status of scanning APs*/
uint32_t status; /**< status of scanning APs*/
struct bss_info *bss; /**< list of APs found*/
} Event_StaMode_ScanDone_t;
typedef struct {
uint8 ssid[32]; /**< SSID of connected AP */
uint8 ssid_len; /**< SSID length of connected AP */
uint8 bssid[6]; /**< BSSID of connected AP*/
uint8 channel; /**< channel of connected AP*/
uint8_t ssid[32]; /**< SSID of connected AP */
uint8_t ssid_len; /**< SSID length of connected AP */
uint8_t bssid[6]; /**< BSSID of connected AP*/
uint8_t channel; /**< channel of connected AP*/
} Event_StaMode_Connected_t;
typedef struct {
uint8 ssid[32]; /**< SSID of disconnected AP */
uint8 ssid_len; /**< SSID length of disconnected AP */
uint8 bssid[6]; /**< BSSID of disconnected AP */
uint8 reason; /**< reason of disconnection */
uint8_t ssid[32]; /**< SSID of disconnected AP */
uint8_t ssid_len; /**< SSID length of disconnected AP */
uint8_t bssid[6]; /**< BSSID of disconnected AP */
uint8_t reason; /**< reason of disconnection */
} Event_StaMode_Disconnected_t;
typedef struct {
uint8 old_mode; /**< the old auth mode of AP */
uint8 new_mode; /**< the new auth mode of AP */
uint8_t old_mode; /**< the old auth mode of AP */
uint8_t new_mode; /**< the new auth mode of AP */
} Event_StaMode_AuthMode_Change_t;
typedef struct {
@ -333,18 +335,18 @@ typedef struct {
} Event_StaMode_Got_IP_t;
typedef struct {
uint8 mac[6]; /**< MAC address of the station connected to ESP8266 soft-AP */
uint8 aid; /**< the aid that ESP8266 soft-AP gives to the station connected to */
uint8_t mac[6]; /**< MAC address of the station connected to ESP8266 soft-AP */
uint8_t aid; /**< the aid that ESP8266 soft-AP gives to the station connected to */
} Event_SoftAPMode_StaConnected_t;
typedef struct {
uint8 mac[6]; /**< MAC address of the station disconnects to ESP8266 soft-AP */
uint8 aid; /**< the aid that ESP8266 soft-AP gave to the station disconnects to */
uint8_t mac[6]; /**< MAC address of the station disconnects to ESP8266 soft-AP */
uint8_t aid; /**< the aid that ESP8266 soft-AP gave to the station disconnects to */
} Event_SoftAPMode_StaDisconnected_t;
typedef struct {
int rssi; /**< Received probe request signal strength */
uint8 mac[6]; /**< MAC address of the station which send probe request */
uint8_t mac[6]; /**< MAC address of the station which send probe request */
} Event_SoftAPMode_ProbeReqRecved_t;
typedef union {
@ -388,11 +390,11 @@ bool wifi_set_event_handler_cb(wifi_event_handler_cb_t cb);
/**
* @brief Callback of sending user-define 802.11 packets.
*
* @param uint8 status : 0, packet sending succeed; otherwise, fail.
* @param uint8_t status : 0, packet sending succeed; otherwise, fail.
*
* @return null
*/
typedef void (*freedom_outside_cb_t)(uint8 status);
typedef void (*freedom_outside_cb_t)(uint8_t status);
/**
* @brief Register a callback for sending user-define 802.11 packets.
@ -405,7 +407,7 @@ typedef void (*freedom_outside_cb_t)(uint8 status);
* @return 0, succeed;
* @return -1, fail.
*/
sint32 wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb);
int32_t wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb);
/**
* @brief Unregister the callback for sending user-define 802.11 packets.
@ -429,8 +431,8 @@ void wifi_unregister_send_pkt_freedom_cb(void);
* the next packet is allowed to send. Otherwise, wifi_send_pkt_freedom
* will return fail.
*
* @param uint8 *buf : pointer of packet
* @param uint16 len : packet length
* @param uint8_t *buf : pointer of packet
* @param uint16_t len : packet length
* @param bool sys_seq : follow the system's 802.11 packets sequence number or not,
* if it is true, the sequence number will be increased 1 every
* time a packet sent.
@ -438,7 +440,7 @@ void wifi_unregister_send_pkt_freedom_cb(void);
* @return 0, succeed;
* @return -1, fail.
*/
sint32 wifi_send_pkt_freedom(uint8 *buf, uint16 len, bool sys_seq);
int32_t wifi_send_pkt_freedom(uint8_t *buf, uint16_t len, bool sys_seq);
/**
* @brief Enable RFID LOCP (Location Control Protocol) to receive WDS packets.
@ -448,7 +450,7 @@ sint32 wifi_send_pkt_freedom(uint8 *buf, uint16 len, bool sys_seq);
* @return 0, succeed;
* @return otherwise, fail.
*/
sint32 wifi_rfid_locp_recv_open(void);
int32_t wifi_rfid_locp_recv_open(void);
/**
* @brief Disable RFID LOCP (Location Control Protocol) .
@ -462,13 +464,13 @@ void wifi_rfid_locp_recv_close(void);
/**
* @brief RFID LOCP (Location Control Protocol) receive callback .
*
* @param uint8 *frm : point to the head of 802.11 packet
* @param uint8_t *frm : point to the head of 802.11 packet
* @param int len : packet length
* @param int rssi : signal strength
*
* @return null
*/
typedef void (*rfid_locp_cb_t)(uint8 *frm, int len, sint8 rssi);
typedef void (*rfid_locp_cb_t)(uint8_t *frm, int len, int8_t rssi);
/**
* @brief Register a callback of receiving WDS packets.
@ -481,7 +483,7 @@ typedef void (*rfid_locp_cb_t)(uint8 *frm, int len, sint8 rssi);
* @return 0, succeed;
* @return otherwise, fail.
*/
sint32 wifi_register_rfid_locp_recv_cb(rfid_locp_cb_t cb);
int32_t wifi_register_rfid_locp_recv_cb(rfid_locp_cb_t cb);
/**
* @brief Unregister the callback of receiving WDS packets.
@ -596,7 +598,7 @@ void wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
* in the system idle task. Please do not call other WiFi related function right
* after calling this API.
*
* @param uint32 sleep_time_in_us : sleep time, ESP8266 will wake up automatically
* @param uint32_t 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.
@ -606,7 +608,7 @@ void wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
* @return -1, fail to sleep, sleep status error;
* @return -2, fail to sleep, force sleep function is not enabled.
*/
sint8 wifi_fpm_do_sleep(uint32 sleep_time_in_us);
int8_t wifi_fpm_do_sleep(uint32_t sleep_time_in_us);
/**
* @brief Set sleep type for force sleep function.
@ -666,16 +668,16 @@ enum FIXED_RATE {
* @attention 3. ESP8266 station and soft-AP share the same rate, they can not be
* set into the different rate.
*
* @param uint8 enable_mask : 0x00 - disable the fixed rate
* @param uint8_t enable_mask : 0x00 - disable the fixed rate
* - 0x01 - use the fixed rate on ESP8266 station
* - 0x02 - use the fixed rate on ESP8266 soft-AP
* - 0x03 - use the fixed rate on ESP8266 station and soft-AP
* @param uint8 rate : value of the fixed rate
* @param uint8_t rate : value of the fixed rate
*
* @return 0 : succeed
* @return otherwise : fail
*/
sint32 wifi_set_user_fixed_rate(uint8 enable_mask, uint8 rate);
int32_t wifi_set_user_fixed_rate(uint8_t enable_mask, uint8_t rate);
/**
* @brief Get the fixed rate and mask of ESP8266.
@ -686,7 +688,7 @@ sint32 wifi_set_user_fixed_rate(uint8 enable_mask, uint8 rate);
* @return 0 : succeed
* @return otherwise : fail
*/
int wifi_get_user_fixed_rate(uint8 *enable_mask, uint8 *rate);
int wifi_get_user_fixed_rate(uint8_t *enable_mask, uint8_t *rate);
enum support_rate {
RATE_11B5M = 0,
@ -714,13 +716,13 @@ enum support_rate {
*
* @attention This API can only support 802.11g now, but it will support 802.11b in next version.
*
* @param uint8 min : the minimum value of the support rate, according to enum support_rate.
* @param uint8 max : the maximum value of the support rate, according to enum support_rate.
* @param uint8_t min : the minimum value of the support rate, according to enum support_rate.
* @param uint8_t max : the maximum value of the support rate, according to enum support_rate.
*
* @return 0 : succeed
* @return otherwise : fail
*/
sint32 wifi_set_user_sup_rate(uint8 min, uint8 max);
int32_t wifi_set_user_sup_rate(uint8_t min, uint8_t max);
enum RATE_11B_ID {
RATE_11B_B11M = 0,
@ -778,22 +780,22 @@ enum RATE_11N_ID {
*
* @attention The rate of retransmission is not limited by this API.
*
* @param uint8 mode : WiFi mode
* @param uint8_t mode : WiFi mode
* - #define RC_LIMIT_11B 0
* - #define RC_LIMIT_11G 1
* - #define RC_LIMIT_11N 2
* @param uint8 ifidx : interface of ESP8266
* - 0x00 - ESP8266 station
* - 0x01 - ESP8266 soft-AP
* @param uint8 max : the maximum value of the rate, according to the enum rate
* @param uint8_t max : the maximum value of the rate, according to the enum rate
* corresponding to the first parameter mode.
* @param uint8 min : the minimum value of the rate, according to the enum rate
* @param uint8_t min : the minimum value of the rate, according to the enum rate
* corresponding to the first parameter mode.
*
* @return 0 : succeed
* @return otherwise : fail
*/
bool wifi_set_user_rate_limit(uint8 mode, uint8 ifidx, uint8 max, uint8 min);
bool wifi_set_user_rate_limit(uint8_t mode, uint8_t ifidx, uint8_t max, uint8_t min);
/**
* @brief Get the interfaces of ESP8266 whose rate of sending data is limited by
@ -806,13 +808,13 @@ bool wifi_set_user_rate_limit(uint8 mode, uint8 ifidx, uint8 max, uint8 min);
* @return LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
* @return LIMIT_RATE_MASK_ALL - enable the limitation on both ESP8266 station and soft-AP
*/
uint8 wifi_get_user_limit_rate_mask(void);
uint8_t wifi_get_user_limit_rate_mask(void);
/**
* @brief Set the interfaces of ESP8266 whose rate of sending packets is limited by
* wifi_set_user_rate_limit.
*
* @param uint8 enable_mask :
* @param uint8_t enable_mask :
* - LIMIT_RATE_MASK_NONE - disable the limitation on both ESP8266 station and soft-AP
* - LIMIT_RATE_MASK_STA - enable the limitation on ESP8266 station
* - LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
@ -821,7 +823,7 @@ uint8 wifi_get_user_limit_rate_mask(void);
* @return true : succeed
* @return false : fail
*/
bool wifi_set_user_limit_rate_mask(uint8 enable_mask);
bool wifi_set_user_limit_rate_mask(uint8_t enable_mask);
/**
* @}
@ -848,13 +850,13 @@ typedef enum {
* @brief Vendor IE received callback.
*
* @param vendor_ie_type type : type of vendor IE.
* @param const uint8 sa[6] : source address of the packet.
* @param uint8 *vendor_ie : pointer of vendor IE.
* @param sint32 rssi : signal strength.
* @param const uint8_t sa[6] : source address of the packet.
* @param uint8_t *vendor_ie : pointer of vendor IE.
* @param int32_t rssi : signal strength.
*
* @return null
*/
typedef void (*vendor_ie_recv_cb_t)(vendor_ie_type type, const uint8 sa[6], const uint8 *vnd_ie, sint32 rssi);
typedef void (*vendor_ie_recv_cb_t)(vendor_ie_type type, const uint8_t sa[6], const uint8_t *vnd_ie, int32_t rssi);
/**
* @brief Set Vendor IE of ESP8266.
@ -884,7 +886,7 @@ bool wifi_set_vnd_ie(bool enable, vendor_ie_type type, uint8_t idx, uint8_t *vnd
* @return 0 : succeed
* @return -1 : fail
*/
sint32 wifi_register_vnd_ie_recv_cb(vendor_ie_recv_cb_t cb);
int32_t wifi_register_vnd_ie_recv_cb(vendor_ie_recv_cb_t cb);
/**
* @brief Unregister vendor IE received callback.
@ -920,15 +922,15 @@ typedef enum {
* @brief User IE received callback.
*
* @param user_ie_type type : type of user IE.
* @param const uint8 sa[6] : source address of the packet.
* @param const uint8 m_oui[3] : factory tag.
* @param uint8 *user_ie : pointer of user IE.
* @param uint8 ie_len : length of user IE.
* @param sint32 rssi : signal strength.
* @param const uint8_t sa[6] : source address of the packet.
* @param const uint8_t m_oui[3] : factory tag.
* @param uint8_t *user_ie : pointer of user IE.
* @param uint8_t ie_len : length of user IE.
* @param int32_t rssi : signal strength.
*
* @return null
*/
typedef void (*user_ie_manufacturer_recv_cb_t)(user_ie_type type, const uint8 sa[6], const uint8 m_oui[3], uint8 *ie, uint8 ie_len, sint32 rssi);
typedef void (*user_ie_manufacturer_recv_cb_t)(user_ie_type type, const uint8_t sa[6], const uint8_t m_oui[3], uint8_t *ie, uint8_t ie_len, int32_t rssi);
/**
* @brief Set user IE of ESP8266.
@ -939,19 +941,19 @@ typedef void (*user_ie_manufacturer_recv_cb_t)(user_ie_type type, const uint8 sa
* - true, enable the corresponding user IE function, all parameters below have to be set.
* - false, disable the corresponding user IE function and release the resource,
* only the parameter "type" below has to be set.
* @param uint8 *m_oui : factory tag, apply for it from Espressif System.
* @param uint8_t *m_oui : factory tag, apply for it from Espressif System.
* @param user_ie_type type : IE type. If it is USER_IE_BEACON, please disable the
* IE function and enable again to take the configuration
* effect immediately .
* @param uint8 *user_ie : user-defined information elements, need not input the whole
* @param uint8_t *user_ie : user-defined information elements, need not input the whole
* 802.11 IE, need only the user-define part.
* @param uint8 len : length of user IE, 247 bytes at most.
* @param uint8_t len : length of user IE, 247 bytes at most.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_set_user_ie(bool enable, uint8 *m_oui, user_ie_type type, uint8 *user_ie, uint8 len);
bool wifi_set_user_ie(bool enable, uint8_t *m_oui, user_ie_type type, uint8_t *user_ie, uint8_t len);
/**
* @brief Register user IE received callback.
@ -961,7 +963,7 @@ bool wifi_set_user_ie(bool enable, uint8 *m_oui, user_ie_type type, uint8 *user_
* @return 0 : succeed
* @return -1 : fail
*/
sint32 wifi_register_user_ie_manufacturer_recv_cb(user_ie_manufacturer_recv_cb_t cb);
int32_t wifi_register_user_ie_manufacturer_recv_cb(user_ie_manufacturer_recv_cb_t cb);
/**
* @brief Unregister user IE received callback.
@ -989,12 +991,12 @@ void wifi_unregister_user_ie_manufacturer_recv_cb(void);
*
* Each time a packet is received, the callback function will be called.
*
* @param uint8 *buf : the data received
* @param uint16 len : data length
* @param uint8_t *buf : the data received
* @param uint16_t len : data length
*
* @return null
*/
typedef void (* wifi_promiscuous_cb_t)(uint8 *buf, uint16 len);
typedef void (* wifi_promiscuous_cb_t)(uint8_t *buf, uint16_t len);
/**
* @brief Register the RX callback function in the promiscuous mode.
@ -1014,17 +1016,17 @@ void wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
*
* @return channel number
*/
uint8 wifi_get_channel(void);
uint8_t wifi_get_channel(void);
/**
* @brief Set the channel number for sniffer functions.
*
* @param uint8 channel : channel number
* @param uint8_t channel : channel number
*
* @return true : succeed
* @return false : fail
*/
bool wifi_set_channel(uint8 channel);
bool wifi_set_channel(uint8_t channel);
/**
* @brief Set the MAC address filter for the sniffer mode.
@ -1049,13 +1051,13 @@ bool wifi_promiscuous_set_mac(const uint8_t *address);
* @attention 4. Don't call any other APIs when in the promiscuous mode. Call
* wifi_promiscuous_enable(0) to quit sniffer before calling other APIs.
*
* @param uint8 promiscuous :
* @param uint8_t promiscuous :
* - 0: to disable the promiscuous mode
* - 1: to enable the promiscuous mode
*
* @return null
*/
void wifi_promiscuous_enable(uint8 promiscuous);
void wifi_promiscuous_enable(uint8_t promiscuous);
/**
* @}

View File

@ -22,8 +22,10 @@
*
*/
#ifndef __ESPWPS_H__
#define __ESPWPS_H__
#ifndef __ESP_WPS_H__
#define __ESP_WPS_H__
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {

View File

@ -25,6 +25,8 @@
#ifndef __ESPNOW_H__
#define __ESPNOW_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -66,13 +68,13 @@ enum esp_now_role {
* @attention The status will be OK, if ESP-NOW send packet successfully. But users
* need to make sure by themselves that key of communication is correct.
*
* @param uint8 *mac_addr : MAC address of target device
* @param uint8 *data : data received
* @param uint8 len : data length
* @param uint8_t *mac_addr : MAC address of target device
* @param uint8_t *data : data received
* @param uint8_t len : data length
*
* @return null
*/
typedef void (*esp_now_recv_cb_t)(uint8 *mac_addr, uint8 *data, uint8 len);
typedef void (*esp_now_recv_cb_t)(uint8_t *mac_addr, uint8_t *data, uint8_t len);
/**
* @brief ESP-NOW send callback.
@ -80,12 +82,12 @@ typedef void (*esp_now_recv_cb_t)(uint8 *mac_addr, uint8 *data, uint8 len);
* @attention The status will be OK, if ESP-NOW send packet successfully. But users
* need to make sure by themselves that key of communication is correct.
*
* @param uint8 *mac_addr : MAC address of target device
* @param uint8 status : status of ESP-NOW sending packet, 0, OK; 1, fail.
* @param uint8_t *mac_addr : MAC address of target device
* @param uint8_t status : status of ESP-NOW sending packet, 0, OK; 1, fail.
*
* @return null
*/
typedef void (*esp_now_send_cb_t)(uint8 *mac_addr, uint8 status);
typedef void (*esp_now_send_cb_t)(uint8_t *mac_addr, uint8_t status);
/**
* @brief ESP-NOW initialization.
@ -95,7 +97,7 @@ typedef void (*esp_now_send_cb_t)(uint8 *mac_addr, uint8 status);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_init(void);
int32_t esp_now_init(void);
/**
* @brief Deinitialize ESP-NOW.
@ -105,7 +107,7 @@ sint32 esp_now_init(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_deinit(void);
int32_t esp_now_deinit(void);
/**
* @brief Register ESP-NOW send callback.
@ -115,7 +117,7 @@ sint32 esp_now_deinit(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_register_send_cb(esp_now_send_cb_t cb);
int32_t esp_now_register_send_cb(esp_now_send_cb_t cb);
/**
* @brief Unregister ESP-NOW send callback.
@ -125,7 +127,7 @@ sint32 esp_now_register_send_cb(esp_now_send_cb_t cb);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_unregister_send_cb(void);
int32_t esp_now_unregister_send_cb(void);
/**
* @brief Register ESP-NOW receive callback.
@ -135,7 +137,7 @@ sint32 esp_now_unregister_send_cb(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_register_recv_cb(esp_now_recv_cb_t cb);
int32_t esp_now_register_recv_cb(esp_now_recv_cb_t cb);
/**
* @brief Unregister ESP-NOW receive callback.
@ -145,7 +147,7 @@ sint32 esp_now_register_recv_cb(esp_now_recv_cb_t cb);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_unregister_recv_cb(void);
int32_t esp_now_unregister_recv_cb(void);
/**
* @brief Send ESP-NOW packet.
@ -159,7 +161,7 @@ sint32 esp_now_unregister_recv_cb(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_send(uint8 *da, uint8 *data, uint8 len);
int32_t esp_now_send(uint8_t *da, uint8_t *data, uint8_t len);
/**
* @brief Add an ESP-NOW peer, store MAC address of target device into ESP-NOW MAC list.
@ -173,7 +175,7 @@ sint32 esp_now_send(uint8 *da, uint8 *data, uint8 len);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_add_peer(uint8 *mac_addr, uint8 role, uint8 channel, uint8 *key, uint8 key_len);
int32_t esp_now_add_peer(uint8_t *mac_addr, uint8_t role, uint8_t channel, uint8_t *key, uint8_t key_len);
/**
* @brief Delete an ESP-NOW peer, delete MAC address of the device from ESP-NOW MAC list.
@ -183,17 +185,17 @@ sint32 esp_now_add_peer(uint8 *mac_addr, uint8 role, uint8 channel, uint8 *key,
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_del_peer(uint8 *mac_addr);
int32_t esp_now_del_peer(uint8_t *mac_addr);
/**
* @brief Set ESP-NOW role of device itself.
*
* @param uint8 role : role type of device, enum esp_now_role.
* @param uint8_t role : role type of device, enum esp_now_role.
*
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_self_role(uint8 role);
int32_t esp_now_set_self_role(uint8_t role);
/**
* @brief Get ESP-NOW role of device itself.
@ -203,7 +205,7 @@ sint32 esp_now_set_self_role(uint8 role);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_get_self_role(void);
int32_t esp_now_get_self_role(void);
/**
* @brief Set ESP-NOW role for a target device. If it is set multiple times,
@ -215,18 +217,18 @@ sint32 esp_now_get_self_role(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_peer_role(uint8 *mac_addr, uint8 role);
int32_t esp_now_set_peer_role(uint8_t *mac_addr, uint8_t role);
/**
* @brief Get ESP-NOW role of a target device.
*
* @param uint8 *mac_addr : MAC address of device.
* @param uint8_t *mac_addr : MAC address of device.
*
* @return ESP_NOW_ROLE_CONTROLLER, role type : controller
* @return ESP_NOW_ROLE_SLAVE, role type : slave
* @return otherwise : fail
*/
sint32 esp_now_get_peer_role(uint8 *mac_addr);
int32_t esp_now_get_peer_role(uint8_t *mac_addr);
/**
* @brief Record channel information of a ESP-NOW device.
@ -235,55 +237,55 @@ sint32 esp_now_get_peer_role(uint8 *mac_addr);
* - call esp_now_get_peer_channel to get its channel first,
* - then call wifi_set_channel to be in the same channel and do communication.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8 channel : channel, usually to be 1 ~ 13, some area may use channel 14.
* @param uint8_t *mac_addr : MAC address of target device.
* @param uint8_t channel : channel, usually to be 1 ~ 13, some area may use channel 14.
*
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_peer_channel(uint8 *mac_addr, uint8 channel);
int32_t esp_now_set_peer_channel(uint8_t *mac_addr, uint8_t channel);
/**
* @brief Get channel information of a ESP-NOW device.
*
* @attention ESP-NOW communication needs to be at the same channel.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8_t *mac_addr : MAC address of target device.
*
* @return 1 ~ 13 (some area may get 14) : channel number
* @return Non-0 : fail
*/
sint32 esp_now_get_peer_channel(uint8 *mac_addr);
int32_t esp_now_get_peer_channel(uint8_t *mac_addr);
/**
* @brief Set ESP-NOW key for a target device.
*
* If it is set multiple times, new key will cover the old one.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8 *key : 16 bytes key which is needed for ESP-NOW communication,
* @param uint8_t *mac_addr : MAC address of target device.
* @param uint8_t *key : 16 bytes key which is needed for ESP-NOW communication,
* if it is NULL, current key will be reset to be none.
* @param uint8 key_len : key length, has to be 16 bytes now
* @param uint8_t key_len : key length, has to be 16 bytes now
*
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_peer_key(uint8 *mac_addr, uint8 *key, uint8 key_len);
int32_t esp_now_set_peer_key(uint8_t *mac_addr, uint8_t *key, uint8_t key_len);
/**
* @brief Get ESP-NOW key of a target device.
*
* If it is set multiple times, new key will cover the old one.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8 *key : pointer of key, buffer size has to be 16 bytes at least
* @param uint8 key_len : key length
* @param uint8_t *mac_addr : MAC address of target device.
* @param uint8_t *key : pointer of key, buffer size has to be 16 bytes at least
* @param uint8_t key_len : key length
*
* @return 0 : succeed
* @return > 0 : find target device but can't get key
* @return < 0 : fail
*/
sint32 esp_now_get_peer_key(uint8 *mac_addr, uint8 *key, uint8 *key_len);
int32_t esp_now_get_peer_key(uint8_t *mac_addr, uint8_t *key, uint8_t *key_len);
/**
* @brief Get MAC address of ESP-NOW device.
@ -301,7 +303,7 @@ sint32 esp_now_get_peer_key(uint8 *mac_addr, uint8 *key, uint8 *key_len);
* @return NULL, no ESP-NOW devices exist
* @return Otherwise, MAC address of ESP-NOW device which is pointed now
*/
uint8 *esp_now_fetch_peer(bool restart);
uint8_t *esp_now_fetch_peer(bool restart);
/**
* @brief Check if target device exists or not.
@ -312,7 +314,7 @@ uint8 *esp_now_fetch_peer(bool restart);
* @return < 0 : error occur, check fail
* @return > 0 : device exists
*/
sint32 esp_now_is_peer_exist(uint8 *mac_addr);
int32_t esp_now_is_peer_exist(uint8_t *mac_addr);
/**
* @brief Get the total number of ESP-NOW devices which are associated, and the
@ -324,7 +326,7 @@ sint32 esp_now_is_peer_exist(uint8 *mac_addr);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_get_cnt_info(uint8 *all_cnt, uint8 *encrypt_cnt);
int32_t esp_now_get_cnt_info(uint8_t *all_cnt, uint8_t *encrypt_cnt);
/**
* @brief Set the encrypt key of communication key.
@ -338,7 +340,7 @@ sint32 esp_now_get_cnt_info(uint8 *all_cnt, uint8 *encrypt_cnt);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_kok(uint8 *key, uint8 len);
int32_t esp_now_set_kok(uint8_t *key, uint8_t len);
/**
* @}

View File

@ -25,6 +25,8 @@
#ifndef __PWM_H__
#define __PWM_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -46,9 +48,9 @@ extern "C" {
*/
struct pwm_param {
uint32 period; /**< PWM period */
uint32 freq; /**< PWM frequency */
uint32 duty[8]; /**< PWM duty */
uint32_t period; /**< PWM period */
uint32_t freq; /**< PWM frequency */
uint32_t duty[8]; /**< PWM duty */
};
#define PWM_DEPTH 1023
@ -58,16 +60,16 @@ struct pwm_param {
*
* @attention This API can be called only once.
*
* @param uint32 period : pwm frequency
* @param uint32 *duty : duty cycle
* @param uint32 pwm_channel_num : PWM channel number
* @param uint32 (*pin_info_list)[3] : GPIO parameter of PWM channel, it is a pointer
* @param uint32_t period : pwm frequency
* @param uint32_t *duty : duty cycle
* @param uint32_t pwm_channel_num : PWM channel number
* @param uint32_t (*pin_info_list)[3] : GPIO parameter of PWM channel, it is a pointer
* of n x 3 array which defines GPIO register, IO
* reuse of corresponding pin and GPIO number.
*
* @return null
*/
void pwm_init(uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_info_list)[3]);
void pwm_init(uint32_t period, uint32_t *duty, uint32_t pwm_channel_num, uint32_t(*pin_info_list)[3]);
/**
* @brief Set the duty cycle of a PWM channel.
@ -78,21 +80,21 @@ void pwm_init(uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_i
*
* @attention After set configuration, pwm_start needs to be called to take effect.
*
* @param uint32 duty : duty cycle
* @param uint8 channel : PWM channel number
* @param uint32_t duty : duty cycle
* @param uint8_t channel : PWM channel number
*
* @return null
*/
void pwm_set_duty(uint32 duty, uint8 channel);
void pwm_set_duty(uint32_t duty, uint8_t channel);
/**
* @brief Get the duty cycle of a PWM channel.
*
* @param uint8 channel : PWM channel number
* @param uint8_t channel : PWM channel number
*
* @return Duty cycle of PWM output.
*/
uint32 pwm_get_duty(uint8 channel);
uint32_t pwm_get_duty(uint8_t channel);
/**
* @brief Set PWM period, unit : us.
@ -105,7 +107,7 @@ uint32 pwm_get_duty(uint8 channel);
*
* @return null
*/
void pwm_set_period(uint32 period);
void pwm_set_period(uint32_t period);
/**
* @brief Get PWM period, unit : us.
@ -114,7 +116,7 @@ void pwm_set_period(uint32 period);
*
* @return PWM period, unit : us.
*/
uint32 pwm_get_period(void);
uint32_t pwm_get_period(void);
/**
* @brief Starts PWM.

View File

@ -25,6 +25,9 @@
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -135,7 +138,7 @@ bool smartconfig_stop(void);
* @return true : succeed
* @return false : fail
*/
bool esptouch_set_timeout(uint8 time_s);
bool esptouch_set_timeout(uint8_t time_s);
/**
* @brief Set protocol type of SmartConfig.

View File

@ -25,6 +25,8 @@
#ifndef __SPI_FLASH_H__
#define __SPI_FLASH_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -52,12 +54,12 @@ typedef enum {
} SpiFlashOpResult;
typedef struct{
uint32 deviceId;
uint32 chip_size; // chip size in byte
uint32 block_size;
uint32 sector_size;
uint32 page_size;
uint32 status_mask;
uint32_t deviceId;
uint32_t chip_size; // chip size in byte
uint32_t block_size;
uint32_t sector_size;
uint32_t page_size;
uint32_t status_mask;
} SpiFlashChip;
#define SPI_FLASH_SEC_SIZE 4096 /**< SPI Flash sector size */
@ -69,56 +71,56 @@ typedef struct{
*
* @return SPI Flash ID
*/
uint32 spi_flash_get_id(void);
uint32_t spi_flash_get_id(void);
/**
* @brief Read state register of SPI Flash.
*
* @param uint32 *status : the read value (pointer) of state register.
* @param uint32_t *status : the read value (pointer) of state register.
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_read_status(uint32 *status);
SpiFlashOpResult spi_flash_read_status(uint32_t *status);
/**
* @brief Write state register of SPI Flash.
*
* @param uint32 status_value : Write state register value.
* @param uint32_t status_value : Write state register value.
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_write_status(uint32 status_value);
SpiFlashOpResult spi_flash_write_status(uint32_t status_value);
/**
* @brief Erase the Flash sector.
*
* @param uint16 sec : Sector number, the count starts at sector 0, 4KB per sector.
* @param uint16_t sec : Sector number, the count starts at sector 0, 4KB per sector.
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_erase_sector(uint16 sec);
SpiFlashOpResult spi_flash_erase_sector(uint16_t sec);
/**
* @brief Write data to Flash.
*
* @param uint32 des_addr : destination address in Flash.
* @param uint32 *src_addr : source address of the data.
* @param uint32 size : length of data
* @param uint32_t des_addr : destination address in Flash.
* @param uint32_t *src_addr : source address of the data.
* @param uint32_t size : length of data
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size);
SpiFlashOpResult spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size);
/**
* @brief Read data from Flash.
*
* @param uint32 src_addr : source address of the data.
* @param uint32 *des_addr : destination address in Flash.
* @param uint32 size : length of data
* @param uint32_t src_addr : source address of the data.
* @param uint32_t *des_addr : destination address in Flash.
* @param uint32_t size : length of data
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);
SpiFlashOpResult spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size);
/**
* @brief Registered function for spi_flash_set_read_func.
@ -126,17 +128,17 @@ SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);
* @attention used for sdk internal, don't need to care about params
*
* @param SpiFlashChip *spi : spi flash struct pointer.
* @param uint32 src_addr : source address of the data.
* @param uint32 *des_addr : destination address in Flash.
* @param uint32 size : length of data
* @param uint32_t src_addr : source address of the data.
* @param uint32_t *des_addr : destination address in Flash.
* @param uint32_t size : length of data
*
* @return SpiFlashOpResult
*/
typedef SpiFlashOpResult (* user_spi_flash_read)(
SpiFlashChip *spi,
uint32 src_addr,
uint32 *des_addr,
uint32 size);
uint32_t src_addr,
uint32_t *des_addr,
uint32_t size);
/**
* @brief Register user-define SPI flash read API.

View File

@ -25,7 +25,10 @@
#ifndef __UPGRADE_H__
#define __UPGRADE_H__
#include "lwip/sockets.h"
#include <stdbool.h>
#include <stdint.h>
#include <sys/socket.h>
#ifdef __cplusplus
extern "C" {
@ -73,12 +76,12 @@ typedef void (*upgrade_states_check_callback)(void *arg);
struct upgrade_server_info {
struct sockaddr_in sockaddrin; /**< socket of upgrading */
upgrade_states_check_callback check_cb; /**< callback of upgrading */
uint32 check_times; /**< time out of upgrading, unit : ms */
uint8 pre_version[16]; /**< previous version of firmware */
uint8 upgrade_version[16]; /**< the new version of firmware */
uint8 *url; /**< the url of upgrading server */
uint32_t check_times; /**< time out of upgrading, unit : ms */
uint8_t pre_version[16]; /**< previous version of firmware */
uint8_t upgrade_version[16]; /**< the new version of firmware */
uint8_t *url; /**< the url of upgrading server */
void *pclient_param;
uint8 upgrade_flag; /**< true, upgrade succeed; false, upgrade fail */
uint8_t upgrade_flag; /**< true, upgrade succeed; false, upgrade fail */
};
/**
@ -88,7 +91,7 @@ struct upgrade_server_info {
*
* @return null
*/
void system_upgrade_init();
void system_upgrade_init(void);
/**
* @brief Upgrade function de-initialization.
@ -97,7 +100,7 @@ void system_upgrade_init();
*
* @return null
*/
void system_upgrade_deinit();
void system_upgrade_deinit(void);
/**
* @brief Upgrade function de-initialization.
@ -107,7 +110,7 @@ void system_upgrade_deinit();
*
* @return null
*/
bool system_upgrade(uint8 *data, uint32 len);
bool system_upgrade(uint8_t *data, uint32_t len);
#ifdef UPGRADE_SSL_ENABLE