diff --git a/src/httpserver/new_http.h b/src/httpserver/new_http.h index 2f9b4ed6a..d4625d837 100644 --- a/src/httpserver/new_http.h +++ b/src/httpserver/new_http.h @@ -43,7 +43,7 @@ void misc_formatUpTimeString(int totalSeconds, char *o); // poststr with format - for results LESS THAN 128 int hprintf128(http_request_t *request, const char *fmt, ...); -enum { +typedef enum { HTTP_ANY = -1, HTTP_GET = 0, HTTP_PUT = 1, diff --git a/src/new_cfg.c b/src/new_cfg.c index 6f18716bf..43c19e6a7 100644 --- a/src/new_cfg.c +++ b/src/new_cfg.c @@ -5,6 +5,8 @@ #if WINDOWS +#elif PLATFORM_XR809 + #else #include "../../beken378/func/include/net_param_pub.h" #include "../../beken378/app/config/param_config.h" @@ -35,6 +37,8 @@ void CFG_CreateDeviceNameUnique() unsigned char mac[32]; #if WINDOWS +#elif PLATFORM_XR809 + mac[0] = 'A'; mac[1] = 'B'; mac[2] = 'A'; mac[3] = 'B'; mac[4] = 'A'; mac[5] = 'B'; #else wifi_get_mac_address((char *)mac, CONFIG_ROLE_STA); #endif @@ -94,6 +98,8 @@ void CFG_SetMQTTPass(const char *s) { void CFG_SaveWiFi() { #if WINDOWS +#elif PLATFORM_XR809 + #else ITEM_NEW_WIFI_CONFIG container; strcpy_safe(container.ssid, g_wifi_ssid, sizeof(container.ssid)); @@ -104,6 +110,8 @@ void CFG_SaveWiFi() { void CFG_LoadWiFi() { #if WINDOWS +#elif PLATFORM_XR809 + #else ITEM_NEW_WIFI_CONFIG container; if(get_info_item(NEW_WIFI_CONFIG,(UINT8 *)&container, 0, 0) != 0) { @@ -116,6 +124,8 @@ void CFG_LoadWiFi() { void CFG_SaveMQTT() { #if WINDOWS +#elif PLATFORM_XR809 + #else ITEM_NEW_MQTT_CONFIG container; strcpy_safe(container.userName, g_mqtt_userName, sizeof(container.userName)); @@ -130,6 +140,8 @@ void CFG_SaveMQTT() { void CFG_LoadMQTT() { #if WINDOWS +#elif PLATFORM_XR809 + #else ITEM_NEW_MQTT_CONFIG container; if(get_info_item(NEW_MQTT_CONFIG,(UINT8 *)&container, 0, 0) != 0) { diff --git a/src/new_common.h b/src/new_common.h index 416dc553b..645e7d236 100644 --- a/src/new_common.h +++ b/src/new_common.h @@ -17,6 +17,23 @@ typedef unsigned char u8; typedef unsigned char uint8_t; typedef unsigned int uint32_t; +#elif PLATFORM_XR809 + +typedef int bool; +#define true 1 +#define false 0 + +#define PR_NOTICE printf + +#include +#include +#include +#include + +#include "common/framework/platform_init.h" + +#include "kernel/os/os.h" + #else #define _TUYA_DEVICE_GLOBAL diff --git a/src/new_pins.c b/src/new_pins.c index 10b9f266a..4c9172a19 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -8,6 +8,8 @@ #if WINDOWS +#elif PLATFORM_XR809 + #else #include @@ -64,6 +66,8 @@ unsigned char g_channelValues[GPIO_MAX] = { 0 }; #ifdef WINDOWS +#elif PLATFORM_XR809 + #else BUTTON_S g_buttons[GPIO_MAX]; @@ -76,6 +80,9 @@ void (*g_doubleClickCallback)(int pinIndex) = 0; void PIN_SaveToFlash() { #if WINDOWS + +#elif PLATFORM_XR809 + #else save_info_item(NEW_PINS_CONFIG,(UINT8 *)&g_pins, 0, 0); #endif @@ -88,6 +95,9 @@ void PIN_LoadFromFlash() { PR_NOTICE("UART log breaking after that means that you changed the role of TX pin to digital IO or smth else.\r\n"); #if WINDOWS + +#elif PLATFORM_XR809 + #else get_info_item(NEW_PINS_CONFIG,(UINT8 *)&g_pins, 0, 0); #endif @@ -108,6 +118,8 @@ int PIN_GetPinChannelForPinIndex(int index) { void RAW_SetPinValue(int index, int iVal){ #if WINDOWS +#elif PLATFORM_XR809 + #else bk_gpio_output(index, iVal); #endif @@ -135,6 +147,8 @@ unsigned char button_generic_get_gpio_value(void *param) { #if WINDOWS return 0; +#elif PLATFORM_XR809 + return 0; #else int index = ((BUTTON_S*)param) - g_buttons; return bk_gpio_input(index); @@ -160,6 +174,8 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { case IOR_Button_n: #if WINDOWS +#elif PLATFORM_XR809 + #else { //BUTTON_S *bt = &g_buttons[index]; @@ -173,6 +189,8 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { case IOR_Relay_n: #if WINDOWS +#elif PLATFORM_XR809 + #else // TODO: disable? #endif @@ -186,6 +204,8 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { pwmIndex = PIN_GetPWMIndexForPinIndex(index); #if WINDOWS +#elif PLATFORM_XR809 + #elif PLATFORM_BK7231N #else @@ -207,6 +227,8 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { case IOR_Button_n: #if WINDOWS +#elif PLATFORM_XR809 + #else { BUTTON_S *bt = &g_buttons[index]; @@ -225,6 +247,8 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { case IOR_Relay_n: #if WINDOWS +#elif PLATFORM_XR809 + #else bk_gpio_config_output(index); bk_gpio_output(index, 0); @@ -240,6 +264,8 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { channelIndex = PIN_GetPinChannelForPinIndex(index); #if WINDOWS +#elif PLATFORM_XR809 + #elif PLATFORM_BK7231N #else @@ -293,6 +319,8 @@ void Channel_OnChanged(int ch) { #if WINDOWS +#elif PLATFORM_XR809 + #elif PLATFORM_BK7231N #else @@ -348,6 +376,8 @@ bool CHANNEL_Check(int ch) { #if WINDOWS +#elif PLATFORM_XR809 + #else #define EVENT_CB(ev) if(handle->cb[ev])handle->cb[ev]((BUTTON_S*)handle)