mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 09:05:59 +08:00
Merge branch 'feature/remove_unused_library' into 'master'
Remove unused or unsupported library See merge request sdk/ESP8266_RTOS_SDK!419
This commit is contained in:
@ -11,8 +11,8 @@ register_component()
|
||||
|
||||
target_link_libraries(${COMPONENT_NAME} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
if(NOT CONFIG_NO_BLOBS)
|
||||
target_link_libraries(${COMPONENT_NAME} airkiss crypto espnow gcc hal core mirom
|
||||
net80211 phy pp pwm smartconfig ssc wpa cirom)
|
||||
target_link_libraries(${COMPONENT_NAME} crypto gcc hal core
|
||||
net80211 phy pp smartconfig ssc wpa)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${COMPONENT_NAME} "-u call_user_start")
|
||||
|
@ -11,8 +11,8 @@ COMPONENT_SRCDIRS := driver source
|
||||
|
||||
LIBS ?=
|
||||
ifndef CONFIG_NO_BLOBS
|
||||
LIBS += airkiss crypto espnow gcc hal core net80211 \
|
||||
phy pp pwm smartconfig ssc wpa
|
||||
LIBS += crypto gcc hal core net80211 \
|
||||
phy pp smartconfig ssc wpa
|
||||
endif
|
||||
|
||||
#Linker scripts used to link the final application.
|
||||
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* airkiss.h
|
||||
*
|
||||
* Created on: 2015-1-26
|
||||
* Author: peterfan
|
||||
*/
|
||||
|
||||
#ifndef AIRKISS_H_
|
||||
#define AIRKISS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef void* (*airkiss_memset_fn) (void* ptr, int value, unsigned int num);
|
||||
typedef void* (*airkiss_memcpy_fn) (void* dst, const void* src, unsigned int num);
|
||||
typedef int (*airkiss_memcmp_fn) (const void* ptr1, const void* ptr2, unsigned int num);
|
||||
typedef int (*airkiss_printf_fn) (const char* format, ...);
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
airkiss_memset_fn memset;
|
||||
airkiss_memcpy_fn memcpy;
|
||||
airkiss_memcmp_fn memcmp;
|
||||
airkiss_printf_fn printf;
|
||||
|
||||
} airkiss_config_t;
|
||||
|
||||
/** \defgroup WiFi_APIs WiFi Related APIs
|
||||
* @brief WiFi APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup WiFi_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup AirKiss_APIs AirKiss APIs
|
||||
* @brief AirKiss APIs
|
||||
*
|
||||
* API airkiss_lan_recv and airkiss_lan_pack are provided for the function that AirKiss can detect
|
||||
* the ESP8266 devices in LAN, more details about AirKiss please refer to WeChat : http://iot.weixin.qq.com.
|
||||
*
|
||||
* Workflow : Create a UDP transmission. When UDP data is received, call API airkiss_lan_recv and
|
||||
* input the UDP data, if the airkiss_lan_recv returns AIRKISS_LAN_SSDP_REQ, airkiss_lan_pack
|
||||
* can be called to make a response packet.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup AirKiss_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the version information of AirKiss lib.
|
||||
*
|
||||
* @attention The lenth of version is unknown
|
||||
*
|
||||
* @param null.
|
||||
*
|
||||
* @return the version information of AirKiss lib
|
||||
*/
|
||||
|
||||
const char* airkiss_version(void);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/** the length of the data buffer is lack*/
|
||||
AIRKISS_LAN_ERR_OVERFLOW = -5,
|
||||
|
||||
/** Do not support the type of instruction */
|
||||
AIRKISS_LAN_ERR_CMD = -4,
|
||||
|
||||
/** Error reading data package */
|
||||
AIRKISS_LAN_ERR_PAKE = -3,
|
||||
|
||||
/** Error function passing parameters */
|
||||
AIRKISS_LAN_ERR_PARA = -2,
|
||||
|
||||
/** Packet data error */
|
||||
AIRKISS_LAN_ERR_PKG = -1,
|
||||
|
||||
/** Message format is correct */
|
||||
AIRKISS_LAN_CONTINUE = 0,
|
||||
|
||||
/** Find equipment request packet is received */
|
||||
AIRKISS_LAN_SSDP_REQ = 1,
|
||||
|
||||
/** Packet packaging complete */
|
||||
AIRKISS_LAN_PAKE_READY = 2
|
||||
|
||||
|
||||
} airkiss_lan_ret_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AIRKISS_LAN_SSDP_REQ_CMD = 0x1,
|
||||
AIRKISS_LAN_SSDP_RESP_CMD = 0x1001,
|
||||
AIRKISS_LAN_SSDP_NOTIFY_CMD = 0x1002
|
||||
} airkiss_lan_cmdid_t;
|
||||
|
||||
/**
|
||||
* @brief Parse the UDP packet sent by AirKiss.
|
||||
*
|
||||
* @param const void* body : the start of the UDP message body data pointer.
|
||||
* @param unsigned short length : the effective length of data.
|
||||
* @param const airkiss_config_t* config : input struct airkiss_config_t
|
||||
*
|
||||
* @return >=0 : succeed (reference airkiss_lan_ret_t)
|
||||
* @return <0 : error code (reference airkiss_lan_ret_t)
|
||||
*/
|
||||
|
||||
int airkiss_lan_recv(const void* body, unsigned short length, const airkiss_config_t* config);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Packaging the UDP packet.
|
||||
*
|
||||
* @param airkiss_lan_cmdid_t ak_lan_cmdid : type of the packet.
|
||||
* @param void* appid : Vendor's Wechat public number id, got from WeChat.
|
||||
* @param void* deviceid : device model id, got from WeChat.
|
||||
* @param void* _datain : user data waiting for packet assembly.
|
||||
* @param unsigned short inlength : the lenth of user data.
|
||||
* @param void* _dataout : data buffer addr, to store the packet got by _datain packet assembly.
|
||||
* @param unsigned short* outlength : the size of data buffer.
|
||||
* @param const airkiss_config_t* config : input struct airkiss_config_t
|
||||
*
|
||||
* @return >=0 : succeed (reference airkiss_lan_ret_t)
|
||||
* @return <0 : error code (reference airkiss_lan_ret_t)
|
||||
*/
|
||||
|
||||
int airkiss_lan_pack(airkiss_lan_cmdid_t ak_lan_cmdid, void* appid, void* deviceid, void* _datain, unsigned short inlength, void* _dataout, unsigned short* outlength, const airkiss_config_t* config);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AIRKISS_H_ */
|
@ -1,353 +0,0 @@
|
||||
/*
|
||||
* ESPRSSIF MIT License
|
||||
*
|
||||
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
*
|
||||
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
|
||||
* it is free of charge, to any person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ESPNOW_H__
|
||||
#define __ESPNOW_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup ESPNow_APIs ESP-NOW APIs
|
||||
* @brief ESP-NOW APIs
|
||||
*
|
||||
* @attention 1. ESP-NOW do not support broadcast and multicast.
|
||||
* @attention 2. ESP-NOW is targeted to Smart-Light project, so it is suggested
|
||||
* that slave role corresponding to soft-AP or soft-AP+station mode,
|
||||
* controller role corresponding to station mode.
|
||||
* @attention 3. When ESP8266 is in soft-AP+station mode, it will communicate through
|
||||
* station interface if it is in slave role, and communicate through
|
||||
* soft-AP interface if it is in controller role.
|
||||
* @attention 4. ESP-NOW can not wake ESP8266 up from sleep, so if the target ESP8266
|
||||
* station is in sleep, ESP-NOW communication will fail.
|
||||
* @attention 5. In station mode, ESP8266 supports 10 encrypt ESP-NOW peers at most,
|
||||
* with the unencrypted peers, it can be 20 peers in total at most.
|
||||
* @attention 6. In the soft-AP mode or soft-AP + station mode, the ESP8266 supports
|
||||
* 6 encrypt ESP-NOW peers at most, with the unencrypted peers, it can
|
||||
* be 20 peers in total at most.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup ESPNow_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum esp_now_role {
|
||||
ESP_NOW_ROLE_IDLE = 0,
|
||||
ESP_NOW_ROLE_CONTROLLER,
|
||||
ESP_NOW_ROLE_SLAVE,
|
||||
ESP_NOW_ROLE_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief ESP-NOW send callback.
|
||||
*
|
||||
* @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_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_t *mac_addr, uint8_t *data, uint8_t len);
|
||||
|
||||
/**
|
||||
* @brief ESP-NOW send callback.
|
||||
*
|
||||
* @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_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_t *mac_addr, uint8_t status);
|
||||
|
||||
/**
|
||||
* @brief ESP-NOW initialization.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_init(void);
|
||||
|
||||
/**
|
||||
* @brief Deinitialize ESP-NOW.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Register ESP-NOW send callback.
|
||||
*
|
||||
* @param esp_now_send_cb_t cb : send callback
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_register_send_cb(esp_now_send_cb_t cb);
|
||||
|
||||
/**
|
||||
* @brief Unregister ESP-NOW send callback.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_unregister_send_cb(void);
|
||||
|
||||
/**
|
||||
* @brief Register ESP-NOW receive callback.
|
||||
*
|
||||
* @param esp_now_recv_cb_t cb : receive callback
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_register_recv_cb(esp_now_recv_cb_t cb);
|
||||
|
||||
/**
|
||||
* @brief Unregister ESP-NOW receive callback.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_unregister_recv_cb(void);
|
||||
|
||||
/**
|
||||
* @brief Send ESP-NOW packet.
|
||||
*
|
||||
* @param uint8 *da : destination MAC address.
|
||||
* If it's NULL, send packet to all MAC addresses recorded
|
||||
* by ESP-NOW; otherwise, send packet to target MAC address.
|
||||
* @param uint8 *data : data need to send
|
||||
* @param uint8 len : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param uint8 *mac_addr : MAC address of device
|
||||
* @param uint8 role : role type of device, enum esp_now_role
|
||||
* @param uint8 channel : channel of device
|
||||
* @param uint8 *key : 16 bytes key which is needed for ESP-NOW communication
|
||||
* @param uint8 key_len : length of key, has to be 16 bytes now
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param u8 *mac_addr : MAC address of device
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_del_peer(uint8_t *mac_addr);
|
||||
|
||||
/**
|
||||
* @brief Set ESP-NOW role of device itself.
|
||||
*
|
||||
* @param uint8_t role : role type of device, enum esp_now_role.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_set_self_role(uint8_t role);
|
||||
|
||||
/**
|
||||
* @brief Get ESP-NOW role of device itself.
|
||||
*
|
||||
* @param uint8 role : role type of device, enum esp_now_role.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_get_self_role(void);
|
||||
|
||||
/**
|
||||
* @brief Set ESP-NOW role for a target device. If it is set multiple times,
|
||||
* new role will cover the old one.
|
||||
*
|
||||
* @param uint8 *mac_addr : MAC address of device.
|
||||
* @param uint8 role : role type, enum esp_now_role.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
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_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
|
||||
*/
|
||||
int32_t esp_now_get_peer_role(uint8_t *mac_addr);
|
||||
|
||||
/**
|
||||
* @brief Record channel information of a ESP-NOW device.
|
||||
*
|
||||
* When communicate with this device,
|
||||
* - 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_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
|
||||
*/
|
||||
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_t *mac_addr : MAC address of target device.
|
||||
*
|
||||
* @return 1 ~ 13 (some area may get 14) : channel number
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
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_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_t key_len : key length, has to be 16 bytes now
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
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_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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* Get MAC address of ESP-NOW device which is pointed now, and move
|
||||
* the pointer to next one in ESP-NOW MAC list or move the pointer to
|
||||
* the first one in ESP-NOW MAC list.
|
||||
*
|
||||
* @attention 1. This API can not re-entry
|
||||
* @attention 2. Parameter has to be true when you call it the first time.
|
||||
*
|
||||
* @param bool restart : true, move pointer to the first one in ESP-NOW MAC list;
|
||||
* false, move pointer to the next one in ESP-NOW MAC list
|
||||
*
|
||||
* @return NULL, no ESP-NOW devices exist
|
||||
* @return Otherwise, MAC address of ESP-NOW device which is pointed now
|
||||
*/
|
||||
uint8_t *esp_now_fetch_peer(bool restart);
|
||||
|
||||
/**
|
||||
* @brief Check if target device exists or not.
|
||||
*
|
||||
* @param uint8 *mac_addr : MAC address of target device.
|
||||
*
|
||||
* @return 0 : device does not exist
|
||||
* @return < 0 : error occur, check fail
|
||||
* @return > 0 : device exists
|
||||
*/
|
||||
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
|
||||
* number count of encrypted devices.
|
||||
*
|
||||
* @param uint8 *all_cnt : total number of ESP-NOW devices which are associated.
|
||||
* @param uint8 *encryp_cnt : number count of encrypted devices
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_get_cnt_info(uint8_t *all_cnt, uint8_t *encrypt_cnt);
|
||||
|
||||
/**
|
||||
* @brief Set the encrypt key of communication key.
|
||||
*
|
||||
* All ESP-NOW devices share the same encrypt key. If users do not set
|
||||
* the encrypt key, ESP-NOW communication key will be encrypted by a default key.
|
||||
*
|
||||
* @param uint8 *key : pointer of encrypt key.
|
||||
* @param uint8 len : key length, has to be 16 bytes now.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : fail
|
||||
*/
|
||||
int32_t esp_now_set_kok(uint8_t *key, uint8_t len);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* ESPRSSIF MIT License
|
||||
*
|
||||
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
*
|
||||
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
|
||||
* it is free of charge, to any person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PWM_H__
|
||||
#define __PWM_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup Driver_APIs Driver APIs
|
||||
* @brief Driver APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup Driver_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup PWM_Driver_APIs PWM Driver APIs
|
||||
* @brief PWM driver APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup PWM_Driver_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
struct pwm_param {
|
||||
uint32_t period; /**< PWM period */
|
||||
uint32_t freq; /**< PWM frequency */
|
||||
uint32_t duty[8]; /**< PWM duty */
|
||||
};
|
||||
|
||||
#define PWM_DEPTH 1023
|
||||
|
||||
/**
|
||||
* @brief PWM function initialization, including GPIO, frequency and duty cycle.
|
||||
*
|
||||
* @attention This API can be called only once.
|
||||
*
|
||||
* @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_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.
|
||||
*
|
||||
* Set the time that high level signal will last, duty depends on period,
|
||||
* the maximum value can be 1023.
|
||||
*
|
||||
*
|
||||
* @attention After set configuration, pwm_start needs to be called to take effect.
|
||||
*
|
||||
* @param uint32_t duty : duty cycle
|
||||
* @param uint8_t channel : PWM channel number
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void pwm_set_duty(uint32_t duty, uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Get the duty cycle of a PWM channel.
|
||||
*
|
||||
* @param uint8_t channel : PWM channel number
|
||||
*
|
||||
* @return Duty cycle of PWM output.
|
||||
*/
|
||||
uint32_t pwm_get_duty(uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Set PWM period, unit : us.
|
||||
*
|
||||
* For example, for 1KHz PWM, period is 1000 us.
|
||||
*
|
||||
* @attention After set configuration, pwm_start needs to be called to take effect.
|
||||
*
|
||||
* @param uint32 period : PWM period, unit : us.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void pwm_set_period(uint32_t period);
|
||||
|
||||
/**
|
||||
* @brief Get PWM period, unit : us.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return PWM period, unit : us.
|
||||
*/
|
||||
uint32_t pwm_get_period(void);
|
||||
|
||||
/**
|
||||
* @brief Starts PWM.
|
||||
*
|
||||
* @attention This function needs to be called after PWM configuration is changed.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void pwm_start(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,152 +0,0 @@
|
||||
/*
|
||||
* ESPRSSIF MIT License
|
||||
*
|
||||
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
*
|
||||
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
|
||||
* it is free of charge, to any person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UPGRADE_H__
|
||||
#define __UPGRADE_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup System_APIs System APIs
|
||||
* @brief System APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup System_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup Upgrade_APIs Upgrade APIs
|
||||
* @brief Firmware upgrade (FOTA) APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup Upgrade_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_FLASH_SEC_SIZE 4096 /**< SPI Flash sector size */
|
||||
|
||||
#define USER_BIN1 0x00 /**< firmware, user1.bin */
|
||||
#define USER_BIN2 0x01 /**< firmware, user2.bin */
|
||||
|
||||
#define UPGRADE_FLAG_IDLE 0x00 /**< flag of upgrading firmware, idle */
|
||||
#define UPGRADE_FLAG_START 0x01 /**< flag of upgrading firmware, start upgrade */
|
||||
#define UPGRADE_FLAG_FINISH 0x02 /**< flag of upgrading firmware, finish upgrading */
|
||||
|
||||
#define UPGRADE_FW_BIN1 0x00 /**< firmware, user1.bin */
|
||||
#define UPGRADE_FW_BIN2 0x01 /**< firmware, user2.bin */
|
||||
|
||||
/**
|
||||
* @brief Callback of upgrading firmware through WiFi.
|
||||
*
|
||||
* @param void * arg : information about upgrading server
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (*upgrade_states_check_callback)(void *arg);
|
||||
|
||||
//#define UPGRADE_SSL_ENABLE
|
||||
|
||||
struct upgrade_server_info {
|
||||
struct sockaddr_in sockaddrin; /**< socket of upgrading */
|
||||
upgrade_states_check_callback check_cb; /**< callback of upgrading */
|
||||
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_t upgrade_flag; /**< true, upgrade succeed; false, upgrade fail */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Upgrade function initialization.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void system_upgrade_init(void);
|
||||
|
||||
/**
|
||||
* @brief Upgrade function de-initialization.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void system_upgrade_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Upgrade function de-initialization.
|
||||
*
|
||||
* @param uint8 *data : segment of the firmware bin data
|
||||
* @param uint32 len : length of the segment bin data
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
bool system_upgrade(uint8_t *data, uint32_t len);
|
||||
|
||||
#ifdef UPGRADE_SSL_ENABLE
|
||||
|
||||
/**
|
||||
* @brief Start upgrade firmware through WiFi with SSL connection.
|
||||
*
|
||||
* @param struct upgrade_server_info *server : the firmware upgrade server info
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool system_upgrade_start_ssl(struct upgrade_server_info *server);
|
||||
#else
|
||||
|
||||
/**
|
||||
* @brief Start upgrade firmware through WiFi with normal connection.
|
||||
*
|
||||
* @param struct upgrade_server_info *server : the firmware upgrade server info
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
|
||||
bool system_upgrade_start(struct upgrade_server_info *server);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,10 +1,8 @@
|
||||
gwen:
|
||||
crypto: eca7811
|
||||
espnow: 8943c89
|
||||
core: 8ee40dd
|
||||
net80211: eca7811
|
||||
pp: eca7811
|
||||
pwm: 0181338
|
||||
smartconfig:eca7811
|
||||
wpa: eca7811
|
||||
phy: 1055_8
|
||||
phy: 1055_8
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user