Added the (possibly modified) Espressif SDK to the project to avoid problems with building. This may not be OK license wise, but who cares
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#ifndef __I2C_MASTER_H__
|
||||
#define __I2C_MASTER_H__
|
||||
|
||||
#define I2C_MASTER_SDA_MUX PERIPHS_IO_MUX_GPIO2_U
|
||||
#define I2C_MASTER_SCL_MUX PERIPHS_IO_MUX_MTMS_U
|
||||
#define I2C_MASTER_SDA_GPIO 2
|
||||
#define I2C_MASTER_SCL_GPIO 14
|
||||
#define I2C_MASTER_SDA_FUNC FUNC_GPIO2
|
||||
#define I2C_MASTER_SCL_FUNC FUNC_GPIO14
|
||||
|
||||
//#define I2C_MASTER_SDA_MUX PERIPHS_IO_MUX_GPIO2_U
|
||||
//#define I2C_MASTER_SCL_MUX PERIPHS_IO_MUX_GPIO0_U
|
||||
//#define I2C_MASTER_SDA_GPIO 2
|
||||
//#define I2C_MASTER_SCL_GPIO 0
|
||||
//#define I2C_MASTER_SDA_FUNC FUNC_GPIO2
|
||||
//#define I2C_MASTER_SCL_FUNC FUNC_GPIO0
|
||||
|
||||
#if 0
|
||||
#define I2C_MASTER_GPIO_SET(pin) \
|
||||
gpio_output_set(1<<pin,0,1<<pin,0)
|
||||
|
||||
#define I2C_MASTER_GPIO_CLR(pin) \
|
||||
gpio_output_set(0,1<<pin,1<<pin,0)
|
||||
|
||||
#define I2C_MASTER_GPIO_OUT(pin,val) \
|
||||
if(val) I2C_MASTER_GPIO_SET(pin);\
|
||||
else I2C_MASTER_GPIO_CLR(pin)
|
||||
#endif
|
||||
|
||||
#define I2C_MASTER_SDA_HIGH_SCL_HIGH() \
|
||||
gpio_output_set(1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
|
||||
|
||||
#define I2C_MASTER_SDA_HIGH_SCL_LOW() \
|
||||
gpio_output_set(1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
|
||||
|
||||
#define I2C_MASTER_SDA_LOW_SCL_HIGH() \
|
||||
gpio_output_set(1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
|
||||
|
||||
#define I2C_MASTER_SDA_LOW_SCL_LOW() \
|
||||
gpio_output_set(0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
|
||||
|
||||
void i2c_master_gpio_init(void);
|
||||
void i2c_master_init(void);
|
||||
|
||||
#define i2c_master_wait os_delay_us
|
||||
void i2c_master_stop(void);
|
||||
void i2c_master_start(void);
|
||||
void i2c_master_setAck(uint8 level);
|
||||
uint8 i2c_master_getAck(void);
|
||||
uint8 i2c_master_readByte(void);
|
||||
void i2c_master_writeByte(uint8 wrdata);
|
||||
|
||||
bool i2c_master_checkAck(void);
|
||||
void i2c_master_send_ack(void);
|
||||
void i2c_master_send_nack(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef __KEY_H__
|
||||
#define __KEY_H__
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
typedef void (* key_function)(void);
|
||||
|
||||
struct single_key_param {
|
||||
uint8 key_level;
|
||||
uint8 gpio_id;
|
||||
uint8 gpio_func;
|
||||
uint32 gpio_name;
|
||||
os_timer_t key_5s;
|
||||
os_timer_t key_50ms;
|
||||
key_function short_press;
|
||||
key_function long_press;
|
||||
};
|
||||
|
||||
struct keys_param {
|
||||
uint8 key_num;
|
||||
struct single_key_param **single_key;
|
||||
};
|
||||
|
||||
struct single_key_param *key_init_single(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func, key_function long_press, key_function short_press);
|
||||
void key_init(struct keys_param *key);
|
||||
|
||||
#endif
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
unsigned char default_certificate[] = {
|
||||
0x30, 0x82, 0x01, 0x82, 0x30, 0x81, 0xec, 0x02, 0x09, 0x00, 0x88, 0xf2,
|
||||
0x5f, 0x46, 0x12, 0x2e, 0x3d, 0x3a, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
|
||||
0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x1c, 0x31,
|
||||
0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x77, 0x77,
|
||||
0x77, 0x2e, 0x65, 0x73, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x66, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x36, 0x32,
|
||||
0x34, 0x31, 0x30, 0x32, 0x32, 0x33, 0x33, 0x5a, 0x17, 0x0d, 0x32, 0x38,
|
||||
0x30, 0x33, 0x30, 0x32, 0x31, 0x30, 0x32, 0x32, 0x33, 0x33, 0x5a, 0x30,
|
||||
0x34, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x09,
|
||||
0x65, 0x73, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x66, 0x31, 0x1e, 0x30,
|
||||
0x1c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x65, 0x73, 0x70, 0x72,
|
||||
0x65, 0x73, 0x73, 0x69, 0x66, 0x20, 0x49, 0x6f, 0x54, 0x20, 0x70, 0x72,
|
||||
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a,
|
||||
0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b,
|
||||
0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0xb9, 0x83, 0x30, 0xca, 0xfb, 0xec,
|
||||
0x11, 0x9e, 0x94, 0xb7, 0x89, 0xf2, 0x84, 0x2c, 0xda, 0xe1, 0x9a, 0x53,
|
||||
0x3a, 0x1b, 0x6e, 0xc9, 0x85, 0x81, 0xf9, 0xa3, 0x41, 0xdb, 0xe2, 0x82,
|
||||
0x3b, 0xfa, 0x80, 0x22, 0x3b, 0x81, 0x6d, 0x25, 0x73, 0x7e, 0xf6, 0x49,
|
||||
0xcc, 0x69, 0x3c, 0x6c, 0xd8, 0x05, 0xfb, 0x92, 0x02, 0xcf, 0x19, 0x2a,
|
||||
0x10, 0x7d, 0x69, 0x7a, 0xd8, 0x9d, 0xd3, 0xcf, 0x6c, 0xef, 0x02, 0x03,
|
||||
0x01, 0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
|
||||
0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x2d, 0x63,
|
||||
0x58, 0x21, 0xe3, 0x8b, 0x37, 0x0d, 0x28, 0x68, 0x11, 0x0e, 0x4d, 0xdd,
|
||||
0xf3, 0xea, 0xdb, 0xec, 0xd7, 0x09, 0x47, 0x2c, 0xa1, 0xd8, 0xd1, 0x71,
|
||||
0x83, 0x11, 0xb4, 0x17, 0xbc, 0x83, 0xea, 0x5a, 0xd6, 0x73, 0x02, 0x25,
|
||||
0x87, 0x01, 0x76, 0xfc, 0x59, 0x1a, 0xcf, 0xd9, 0x49, 0xc9, 0xf9, 0x1f,
|
||||
0x5c, 0x3b, 0x24, 0x6a, 0x5c, 0xa5, 0xca, 0xe6, 0x5d, 0x34, 0x5b, 0x5f,
|
||||
0xcf, 0x56, 0x9c, 0x71, 0xd2, 0x6b, 0xdd, 0x1f, 0x15, 0xae, 0x4d, 0xf1,
|
||||
0xca, 0x35, 0xc8, 0xdd, 0x93, 0x1b, 0x58, 0x1e, 0x94, 0x08, 0xcf, 0xa0,
|
||||
0x20, 0xb9, 0x75, 0xa5, 0x4c, 0x77, 0xf5, 0x7f, 0xed, 0xd5, 0xcd, 0x53,
|
||||
0xaa, 0x87, 0xa6, 0x3c, 0xf5, 0x72, 0xd8, 0xd2, 0xb0, 0xf7, 0x11, 0xb0,
|
||||
0x0e, 0xe9, 0x41, 0xd6, 0x8e, 0xd9, 0x07, 0xf8, 0xed, 0xf8, 0x67, 0x7f,
|
||||
0x28, 0x18, 0xf0, 0x1b, 0x29, 0x11
|
||||
};
|
||||
unsigned int default_certificate_len = 390;
|
||||
@@ -0,0 +1,30 @@
|
||||
unsigned char default_private_key[] = {
|
||||
0x30, 0x82, 0x01, 0x3a, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00, 0xb9, 0x83,
|
||||
0x30, 0xca, 0xfb, 0xec, 0x11, 0x9e, 0x94, 0xb7, 0x89, 0xf2, 0x84, 0x2c,
|
||||
0xda, 0xe1, 0x9a, 0x53, 0x3a, 0x1b, 0x6e, 0xc9, 0x85, 0x81, 0xf9, 0xa3,
|
||||
0x41, 0xdb, 0xe2, 0x82, 0x3b, 0xfa, 0x80, 0x22, 0x3b, 0x81, 0x6d, 0x25,
|
||||
0x73, 0x7e, 0xf6, 0x49, 0xcc, 0x69, 0x3c, 0x6c, 0xd8, 0x05, 0xfb, 0x92,
|
||||
0x02, 0xcf, 0x19, 0x2a, 0x10, 0x7d, 0x69, 0x7a, 0xd8, 0x9d, 0xd3, 0xcf,
|
||||
0x6c, 0xef, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x40, 0x1d, 0x13, 0x92,
|
||||
0xf2, 0x3d, 0xca, 0x22, 0x78, 0xd8, 0x96, 0x6b, 0xe8, 0xb7, 0x0e, 0xd0,
|
||||
0xbf, 0xcb, 0x90, 0x7f, 0xeb, 0x0c, 0xd2, 0x49, 0x3a, 0xb6, 0x06, 0x00,
|
||||
0xac, 0x96, 0x34, 0x13, 0x72, 0x4b, 0x8c, 0xd2, 0xb9, 0x35, 0xf5, 0x64,
|
||||
0x18, 0xb2, 0x47, 0x5b, 0x9f, 0xbb, 0xf2, 0x5b, 0x2f, 0x66, 0x78, 0x2d,
|
||||
0x0a, 0x76, 0x44, 0xc5, 0x4f, 0xdb, 0x7d, 0x13, 0xcf, 0xa5, 0x08, 0xdc,
|
||||
0x01, 0x02, 0x21, 0x00, 0xdf, 0x9a, 0x89, 0xd0, 0xef, 0x23, 0xcf, 0x12,
|
||||
0xac, 0x8a, 0x63, 0x1a, 0x8c, 0xc0, 0x3f, 0xf4, 0x38, 0x52, 0x3c, 0x9f,
|
||||
0x19, 0x0a, 0x37, 0xd2, 0xcb, 0x5d, 0xeb, 0xb6, 0x2a, 0x33, 0xb0, 0x91,
|
||||
0x02, 0x21, 0x00, 0xd4, 0x63, 0xd9, 0x6a, 0x18, 0x5b, 0xe8, 0xa8, 0x57,
|
||||
0x4d, 0xd1, 0x9a, 0xa8, 0xd7, 0xe1, 0x65, 0x75, 0xb3, 0xb9, 0x5c, 0x94,
|
||||
0x14, 0xca, 0x98, 0x41, 0x47, 0x9c, 0x0a, 0x22, 0x38, 0x05, 0x7f, 0x02,
|
||||
0x20, 0x6a, 0xce, 0xfd, 0xef, 0xe0, 0x9b, 0x61, 0x49, 0x91, 0x43, 0x95,
|
||||
0x6d, 0x54, 0x38, 0x6d, 0x14, 0x32, 0x67, 0x0d, 0xf0, 0x0d, 0x5c, 0xf5,
|
||||
0x27, 0x6a, 0xdf, 0x55, 0x3d, 0xb1, 0xd0, 0xf9, 0x11, 0x02, 0x21, 0x00,
|
||||
0xba, 0x94, 0xa0, 0xf9, 0xb0, 0x3e, 0x85, 0x8b, 0xe5, 0x6e, 0x4a, 0x95,
|
||||
0x88, 0x80, 0x65, 0xd5, 0x00, 0xea, 0x8b, 0x0b, 0x46, 0x57, 0x61, 0x87,
|
||||
0x11, 0xc9, 0xfb, 0xcd, 0x77, 0x34, 0x29, 0xb7, 0x02, 0x20, 0x06, 0x8d,
|
||||
0x41, 0x11, 0x47, 0x93, 0xcb, 0xad, 0xda, 0x5d, 0xe1, 0x9d, 0x49, 0x8d,
|
||||
0xe0, 0xab, 0x48, 0xe6, 0x18, 0x28, 0x4a, 0x94, 0xae, 0xf9, 0xad, 0xc5,
|
||||
0x5b, 0x0b, 0x15, 0xc6, 0x73, 0x17
|
||||
};
|
||||
unsigned int default_private_key_len = 318;
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef __USER_CONFIG_H__
|
||||
#define __USER_CONFIG_H__
|
||||
|
||||
#define ESP_PLATFORM 1
|
||||
#define LEWEI_PLATFORM 0
|
||||
|
||||
#define USE_OPTIMIZE_PRINTF
|
||||
|
||||
#if ESP_PLATFORM
|
||||
#define PLUG_DEVICE 0
|
||||
#define LIGHT_DEVICE 1
|
||||
#define SENSOR_DEVICE 0
|
||||
|
||||
#if SENSOR_DEVICE
|
||||
#define HUMITURE_SUB_DEVICE 1
|
||||
#define FLAMMABLE_GAS_SUB_DEVICE 0
|
||||
#endif
|
||||
|
||||
//#define SERVER_SSL_ENABLE
|
||||
//#define CLIENT_SSL_ENABLE
|
||||
//#define UPGRADE_SSL_ENABLE
|
||||
|
||||
#define USE_DNS
|
||||
|
||||
#ifdef USE_DNS
|
||||
#define ESP_DOMAIN "iot.espressif.cn"
|
||||
#endif
|
||||
|
||||
//#define SOFTAP_ENCRYPT
|
||||
|
||||
#ifdef SOFTAP_ENCRYPT
|
||||
#define PASSWORD "v*%W>L<@i&Nxe!"
|
||||
#endif
|
||||
|
||||
#if SENSOR_DEVICE
|
||||
#define SENSOR_DEEP_SLEEP
|
||||
|
||||
#if HUMITURE_SUB_DEVICE
|
||||
#define SENSOR_DEEP_SLEEP_TIME 30000000
|
||||
#elif FLAMMABLE_GAS_SUB_DEVICE
|
||||
#define SENSOR_DEEP_SLEEP_TIME 60000000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LIGHT_DEVICE
|
||||
#define USE_US_TIMER
|
||||
#endif
|
||||
|
||||
#if PLUG_DEVICE || LIGHT_DEVICE
|
||||
#define BEACON_TIMEOUT 150000000
|
||||
#define BEACON_TIME 50000
|
||||
#endif
|
||||
|
||||
#define AP_CACHE 1
|
||||
|
||||
#if AP_CACHE
|
||||
#define AP_CACHE_NUMBER 5
|
||||
#endif
|
||||
|
||||
#elif LEWEI_PLATFORM
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __USER_DEVICEFIND_H__
|
||||
#define __USER_DEVICEFIND_H__
|
||||
|
||||
void user_devicefind_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef __USER_DEVICE_H__
|
||||
#define __USER_DEVICE_H__
|
||||
|
||||
/* NOTICE---this is for 512KB spi flash.
|
||||
* you can change to other sector if you use other size spi flash. */
|
||||
#define ESP_PARAM_START_SEC 0x3D
|
||||
|
||||
#define packet_size (2 * 1024)
|
||||
|
||||
#define token_size 41
|
||||
|
||||
struct esp_platform_saved_param {
|
||||
uint8 devkey[40];
|
||||
uint8 token[40];
|
||||
uint8 activeflag;
|
||||
uint8 pad[3];
|
||||
};
|
||||
|
||||
enum {
|
||||
DEVICE_CONNECTING = 40,
|
||||
DEVICE_ACTIVE_DONE,
|
||||
DEVICE_ACTIVE_FAIL,
|
||||
DEVICE_CONNECT_SERVER_FAIL
|
||||
};
|
||||
|
||||
struct dhcp_client_info {
|
||||
ip_addr_t ip_addr;
|
||||
ip_addr_t netmask;
|
||||
ip_addr_t gw;
|
||||
uint8 flag;
|
||||
uint8 pad[3];
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __USER_DEVICEFIND_H__
|
||||
#define __USER_DEVICEFIND_H__
|
||||
|
||||
void user_platform_timer_start(char* pbuffer, struct espconn *pespconn);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef __USER_IOT_VERSION_H__
|
||||
#define __USER_IOT_VERSION_H__
|
||||
|
||||
#include "user_config.h"
|
||||
|
||||
#define IOT_VERSION_MAJOR 1U
|
||||
#define IOT_VERSION_MINOR 0U
|
||||
#define IOT_VERSION_REVISION 5U
|
||||
|
||||
#define VERSION_NUM (IOT_VERSION_MAJOR * 1000 + IOT_VERSION_MINOR * 100 + IOT_VERSION_REVISION)
|
||||
|
||||
//#define VERSION_TYPE "b"
|
||||
#define VERSION_TYPE "v"
|
||||
|
||||
#if LIGHT_DEVICE
|
||||
#define device_type 45772
|
||||
#elif PLUG_DEVICE
|
||||
#define device_type 23701
|
||||
#elif SENSOR_DEVICE
|
||||
#define device_type 12335
|
||||
#endif
|
||||
|
||||
|
||||
#define ONLINE_UPGRADE 0
|
||||
#define LOCAL_UPGRADE 0
|
||||
#define ALL_UPGRADE 1
|
||||
#define NONE_UPGRADE 0
|
||||
|
||||
#if ONLINE_UPGRADE
|
||||
#define UPGRADE_FALG "O"
|
||||
#elif LOCAL_UPGRADE
|
||||
#define UPGRADE_FALG "l"
|
||||
#elif ALL_UPGRADE
|
||||
#define UPGRADE_FALG "a"
|
||||
#elif NONE_UPGRADE
|
||||
#define UPGRADE_FALG "n"
|
||||
#endif
|
||||
|
||||
#define IOT_VERSION
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef __USER_JSON_H__
|
||||
#define __USER_JSON_H__
|
||||
|
||||
#include "json/jsonparse.h"
|
||||
#include "json/jsontree.h"
|
||||
|
||||
#define jsonSize 2*1024
|
||||
|
||||
void json_parse(struct jsontree_context *json, char *ptrJSONMessage);
|
||||
|
||||
void json_ws_send(struct jsontree_value *tree, const char *path, char *pbuf);
|
||||
|
||||
int json_putchar(int c);
|
||||
|
||||
struct jsontree_value *find_json_path(struct jsontree_context *json, const char *path);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef __USER_LIGHT_H__
|
||||
#define __USER_LIGHT_H__
|
||||
/*pwm.h: function and macro definition of PWM API , driver level */
|
||||
/*user_light.h: user interface for light API, user level*/
|
||||
/*user_light_adj: API for color changing and lighting effects, user level*/
|
||||
|
||||
|
||||
#include "pwm.h"
|
||||
|
||||
|
||||
/* NOTICE !!! ---this is for 512KB spi flash.*/
|
||||
/* You can change to other sector if you use other size spi flash. */
|
||||
/* Refer to the documentation about OTA support and flash mapping*/
|
||||
#define PRIV_PARAM_START_SEC 0x3C
|
||||
#define PRIV_PARAM_SAVE 0
|
||||
|
||||
|
||||
|
||||
/*Define the channel number of PWM*/
|
||||
/*In this demo, we can set 3 for 3 PWM channels: RED, GREEN, BLUE*/
|
||||
/*Or , we can choose 5 channels : RED,GREEN,BLUE,COLD-WHITE,WARM-WHITE*/
|
||||
#define PWM_CHANNEL 5 // 5:5channel ; 3:3channel
|
||||
|
||||
#define LIGHT_RED 0
|
||||
#define LIGHT_GREEN 1
|
||||
#define LIGHT_BLUE 2
|
||||
#define LIGHT_COLD_WHITE 3
|
||||
#define LIGHT_WARM_WHITE 4
|
||||
|
||||
|
||||
/*Definition of GPIO PIN params, for GPIO initialization*/
|
||||
#define PWM_0_OUT_IO_MUX PERIPHS_IO_MUX_MTDI_U
|
||||
#define PWM_0_OUT_IO_NUM 12
|
||||
#define PWM_0_OUT_IO_FUNC FUNC_GPIO12
|
||||
|
||||
#define PWM_1_OUT_IO_MUX PERIPHS_IO_MUX_MTDO_U
|
||||
#define PWM_1_OUT_IO_NUM 15
|
||||
#define PWM_1_OUT_IO_FUNC FUNC_GPIO15
|
||||
|
||||
#define PWM_2_OUT_IO_MUX PERIPHS_IO_MUX_MTCK_U
|
||||
#define PWM_2_OUT_IO_NUM 13
|
||||
#define PWM_2_OUT_IO_FUNC FUNC_GPIO13
|
||||
|
||||
#define PWM_3_OUT_IO_MUX PERIPHS_IO_MUX_MTMS_U
|
||||
#define PWM_3_OUT_IO_NUM 14
|
||||
#define PWM_3_OUT_IO_FUNC FUNC_GPIO14
|
||||
|
||||
#define PWM_4_OUT_IO_MUX PERIPHS_IO_MUX_GPIO5_U
|
||||
#define PWM_4_OUT_IO_NUM 5
|
||||
#define PWM_4_OUT_IO_FUNC FUNC_GPIO5
|
||||
|
||||
struct light_saved_param {
|
||||
uint32 pwm_period;
|
||||
uint32 pwm_duty[PWM_CHANNEL];
|
||||
};
|
||||
|
||||
void user_light_init(void);
|
||||
uint32 user_light_get_duty(uint8 channel);
|
||||
void user_light_set_duty(uint32 duty, uint8 channel);
|
||||
uint32 user_light_get_period(void);
|
||||
void user_light_set_period(uint32 period);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef __USER_LIGHT_ADJ_H__
|
||||
#define __USER_LIGHT_ADJ_H__
|
||||
/*pwm.h: function and macro definition of PWM API , driver level */
|
||||
/*user_light.h: user interface for light setting, user level*/
|
||||
/*user_light_adj: API for color changing and lighting effects, user level*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*save RGB params to flash when calling light_set_aim*/
|
||||
#define SAVE_LIGHT_PARAM 0 //set to 0: do not save color params
|
||||
|
||||
/*check current consumption and limit the total current for LED driver IC*/
|
||||
/*NOTE: YOU SHOULD REPLACE WIHT THE LIMIT CURRENT OF YOUR OWN APPLICATION*/
|
||||
#define LIGHT_CURRENT_LIMIT 0 //set to 0: do not limit total current
|
||||
#if LIGHT_CURRENT_LIMIT
|
||||
#define LIGHT_TOTAL_CURRENT_MAX (450*1000) //450000/1000 MA AT MOST
|
||||
#define LIGHT_CURRENT_MARGIN (80*1000) //80000/1000 MA CURRENT RAISES WHILE TEMPERATURE INCREASING
|
||||
#define LIGHT_CURRENT_MARGIN_L2 (110*1000) //110000/1000 MA
|
||||
#define LIGHT_CURRENT_MARGIN_L3 (140*1000) //140000/1000 MA
|
||||
#endif
|
||||
|
||||
|
||||
/*set target duty for PWM channels, change each channel duty gradually */
|
||||
void light_set_aim(uint32 r,uint32 g,uint32 b,uint32 cw,uint32 ww,uint32 period);//'white' channel is not used in default demo
|
||||
void light_set_aim_r(uint32 r);
|
||||
void light_set_aim_g(uint32 g);
|
||||
void light_set_aim_b(uint32 b);
|
||||
void light_set_aim_cw(uint32 cw);
|
||||
void light_set_aim_ww(uint32 ww);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef __USER_ESPSWITCH_H__
|
||||
#define __USER_ESPSWITCH_H__
|
||||
|
||||
#include "driver/key.h"
|
||||
|
||||
/* NOTICE---this is for 512KB spi flash.
|
||||
* you can change to other sector if you use other size spi flash. */
|
||||
#define PRIV_PARAM_START_SEC 0x3C
|
||||
|
||||
#define PRIV_PARAM_SAVE 0
|
||||
|
||||
#define PLUG_KEY_NUM 1
|
||||
|
||||
#define PLUG_KEY_0_IO_MUX PERIPHS_IO_MUX_MTCK_U
|
||||
#define PLUG_KEY_0_IO_NUM 13
|
||||
#define PLUG_KEY_0_IO_FUNC FUNC_GPIO13
|
||||
|
||||
#define PLUG_WIFI_LED_IO_MUX PERIPHS_IO_MUX_GPIO0_U
|
||||
#define PLUG_WIFI_LED_IO_NUM 0
|
||||
#define PLUG_WIFI_LED_IO_FUNC FUNC_GPIO0
|
||||
|
||||
#define PLUG_LINK_LED_IO_MUX PERIPHS_IO_MUX_MTDI_U
|
||||
#define PLUG_LINK_LED_IO_NUM 12
|
||||
#define PLUG_LINK_LED_IO_FUNC FUNC_GPIO12
|
||||
|
||||
#define PLUG_RELAY_LED_IO_MUX PERIPHS_IO_MUX_MTDO_U
|
||||
#define PLUG_RELAY_LED_IO_NUM 15
|
||||
#define PLUG_RELAY_LED_IO_FUNC FUNC_GPIO15
|
||||
|
||||
#define PLUG_STATUS_OUTPUT(pin, on) GPIO_OUTPUT_SET(pin, on)
|
||||
|
||||
struct plug_saved_param {
|
||||
uint8_t status;
|
||||
uint8_t pad[3];
|
||||
};
|
||||
|
||||
void user_plug_init(void);
|
||||
uint8 user_plug_get_status(void);
|
||||
void user_plug_set_status(bool status);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef __USER_SENSOR_H__
|
||||
#define __USER_SENSOR_H__
|
||||
|
||||
#include "user_config.h"
|
||||
#include "driver/key.h"
|
||||
|
||||
#define SENSOR_KEY_NUM 1
|
||||
|
||||
#define SENSOR_KEY_IO_MUX PERIPHS_IO_MUX_MTCK_U
|
||||
#define SENSOR_KEY_IO_NUM 13
|
||||
#define SENSOR_KEY_IO_FUNC FUNC_GPIO13
|
||||
|
||||
#define SENSOR_WIFI_LED_IO_MUX PERIPHS_IO_MUX_GPIO0_U
|
||||
#define SENSOR_WIFI_LED_IO_NUM 0
|
||||
#define SENSOR_WIFI_LED_IO_FUNC FUNC_GPIO0
|
||||
|
||||
#define SENSOR_LINK_LED_IO_MUX PERIPHS_IO_MUX_MTDI_U
|
||||
#define SENSOR_LINK_LED_IO_NUM 12
|
||||
#define SENSOR_LINK_LED_IO_FUNC FUNC_GPIO12
|
||||
|
||||
#define SENSOR_UNUSED_LED_IO_MUX PERIPHS_IO_MUX_MTDO_U
|
||||
#define SENSOR_UNUSED_LED_IO_NUM 15
|
||||
#define SENSOR_UNUSED_LED_IO_FUNC FUNC_GPIO15
|
||||
|
||||
#if HUMITURE_SUB_DEVICE
|
||||
bool user_mvh3004_read_th(uint8 *data);
|
||||
void user_mvh3004_init(void);
|
||||
#endif
|
||||
|
||||
void user_sensor_init(uint8 active);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef __USER_WEBSERVER_H__
|
||||
#define __USER_WEBSERVER_H__
|
||||
|
||||
#define SERVER_PORT 80
|
||||
#define SERVER_SSL_PORT 443
|
||||
|
||||
#define URLSize 10
|
||||
|
||||
typedef enum Result_Resp {
|
||||
RespFail = 0,
|
||||
RespSuc,
|
||||
} Result_Resp;
|
||||
|
||||
typedef enum ProtocolType {
|
||||
GET = 0,
|
||||
POST,
|
||||
} ProtocolType;
|
||||
|
||||
typedef enum _ParmType {
|
||||
SWITCH_STATUS = 0,
|
||||
INFOMATION,
|
||||
WIFI,
|
||||
SCAN,
|
||||
REBOOT,
|
||||
DEEP_SLEEP,
|
||||
LIGHT_STATUS,
|
||||
CONNECT_STATUS,
|
||||
USER_BIN
|
||||
} ParmType;
|
||||
|
||||
typedef struct URL_Frame {
|
||||
enum ProtocolType Type;
|
||||
char pSelect[URLSize];
|
||||
char pCommand[URLSize];
|
||||
char pFilename[URLSize];
|
||||
} URL_Frame;
|
||||
|
||||
typedef struct _rst_parm {
|
||||
ParmType parmtype;
|
||||
struct espconn *pespconn;
|
||||
} rst_parm;
|
||||
|
||||
void user_webserver_init(uint32 port);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user