diff --git a/src/hal/ln882h/hal_adc_ln882h.c b/src/hal/ln882h/hal_adc_ln882h.c new file mode 100644 index 000000000..a42e754cf --- /dev/null +++ b/src/hal/ln882h/hal_adc_ln882h.c @@ -0,0 +1,10 @@ +#include "../hal_adc.h" + +void HAL_ADC_Init(int pinNumber) { + +} +int HAL_ADC_Read(int pinNumber) +{ + return -1; +} + diff --git a/src/hal/ln882h/hal_flashConfig_ln882h.c b/src/hal/ln882h/hal_flashConfig_ln882h.c new file mode 100644 index 000000000..312ba3595 --- /dev/null +++ b/src/hal/ln882h/hal_flashConfig_ln882h.c @@ -0,0 +1,18 @@ +#include "../hal_flashConfig.h" + + +int HAL_Configuration_ReadConfigMemory(void *target, int dataLen){ + + return 0; +} + + + + + +int HAL_Configuration_SaveConfigMemory(void *src, int dataLen){ + return 0; +} + + + diff --git a/src/hal/ln882h/hal_flashVars_ln882h.c b/src/hal/ln882h/hal_flashVars_ln882h.c new file mode 100644 index 000000000..e5b946768 --- /dev/null +++ b/src/hal/ln882h/hal_flashVars_ln882h.c @@ -0,0 +1,72 @@ + +#ifndef PLATFORM_XR809 + + +#include "../../new_common.h" +#include "../hal_flashVars.h" + + +//#define DISABLE_FLASH_VARS_VARS + + +// call at startup +void HAL_FlashVars_IncreaseBootCount() { + +} +void HAL_FlashVars_SaveChannel(int index, int value) { + +} +void HAL_FlashVars_ReadLED(byte* mode, short* brightness, short* temperature, byte* rgb, byte* bEnableAll) { + +} + + +void HAL_FlashVars_SaveLED(byte mode, short brightness, short temperature, byte r, byte g, byte b, byte bEnableAll) { + +} + +short HAL_FlashVars_ReadUsage() { + return 0; +} +void HAL_FlashVars_SaveTotalUsage(short usage) { + +} +// call once started (>30s?) +void HAL_FlashVars_SaveBootComplete() { + +} + +// call to return the number of boots since a HAL_FlashVars_SaveBootComplete +int HAL_FlashVars_GetBootFailures() { + int diff = 0; + + return diff; +} + +int HAL_FlashVars_GetBootCount() { + return 0; +} +int HAL_FlashVars_GetChannelValue(int ch) { + + return 0; +} + +int HAL_GetEnergyMeterStatus(ENERGY_METERING_DATA* data) +{ + + return 0; +} + +int HAL_SetEnergyMeterStatus(ENERGY_METERING_DATA* data) +{ + + return 0; +} + +void HAL_FlashVars_SaveTotalConsumption(float total_consumption) +{ + +} + +#endif + diff --git a/src/hal/ln882h/hal_generic_ln882h.c b/src/hal/ln882h/hal_generic_ln882h.c new file mode 100644 index 000000000..0ed16556e --- /dev/null +++ b/src/hal/ln882h/hal_generic_ln882h.c @@ -0,0 +1,5 @@ + + + +void HAL_RebootModule() { +} \ No newline at end of file diff --git a/src/hal/ln882h/hal_main_ln882h.c b/src/hal/ln882h/hal_main_ln882h.c new file mode 100644 index 000000000..16b93e36b --- /dev/null +++ b/src/hal/ln882h/hal_main_ln882h.c @@ -0,0 +1,6 @@ + +#include "../../new_common.h" +#include "../../logging/logging.h" +#include "../../quicktick.h" + + diff --git a/src/hal/ln882h/hal_pins_ln882h.c b/src/hal/ln882h/hal_pins_ln882h.c new file mode 100644 index 000000000..58f130acf --- /dev/null +++ b/src/hal/ln882h/hal_pins_ln882h.c @@ -0,0 +1,48 @@ + +#include "../../new_common.h" +#include "../../logging/logging.h" +#include "../../new_cfg.h" +#include "../../new_pins.h" + + +int PIN_GetPWMIndexForPinIndex(int pin) { + return -1; +} + +const char *HAL_PIN_GetPinNameAlias(int index) { + + return "N/A"; +} + +int HAL_PIN_CanThisPinBePWM(int index) { + + return 1; +} +void HAL_PIN_SetOutputValue(int index, int iVal) { +} + +int HAL_PIN_ReadDigitalInput(int index) { + return 0; +} +void HAL_PIN_Setup_Input_Pullup(int index) { +} +void HAL_PIN_Setup_Input_Pulldown(int index) { +} +void HAL_PIN_Setup_Input(int index) { +} +void HAL_PIN_Setup_Output(int index) { +} +void HAL_PIN_PWM_Stop(int index) { + +} + +void HAL_PIN_PWM_Start(int index) { + +} +void HAL_PIN_PWM_Update(int index, float value) { + +} + +unsigned int HAL_GetGPIOPin(int index) { + return index; +} diff --git a/src/hal/ln882h/hal_wifi_ln882h.c b/src/hal/ln882h/hal_wifi_ln882h.c new file mode 100644 index 000000000..85489d6c5 --- /dev/null +++ b/src/hal/ln882h/hal_wifi_ln882h.c @@ -0,0 +1,77 @@ +#include "../hal_wifi.h" + + +static void (*g_wifiStatusCallback)(int code); + +// lenght of "192.168.103.103" is 15 but we also need a NULL terminating character +static char g_IP[32] = "unknown"; +static int g_bOpenAccessPointMode = 0; + +// This must return correct IP for both SOFT_AP and STATION modes, +// because, for example, javascript control panel requires it +const char* HAL_GetMyIPString() { + + + return g_IP; +} +const char* HAL_GetMyGatewayString() { + return g_IP; +} +const char* HAL_GetMyDNSString() { + return g_IP; +} +const char* HAL_GetMyMaskString() { + return g_IP; +} + + +int WiFI_SetMacAddress(char* mac) +{ + return 0; // error +} + +void WiFI_GetMacAddress(char* mac) +{ +} + +const char* HAL_GetMACStr(char* macstr) +{ + unsigned char mac[6]; + sprintf(macstr, MACSTR, MAC2STR(mac)); + return macstr; +} + + +void HAL_PrintNetworkInfo() +{ + + +} + +int HAL_GetWifiStrength() +{ + return 0; +} + + +void HAL_WiFi_SetupStatusCallback(void (*cb)(int code)) +{ + g_wifiStatusCallback = cb; + +} +void HAL_ConnectToWiFi(const char* oob_ssid, const char* connect_key, obkStaticIP_t *ip) +{ + g_bOpenAccessPointMode = 0; + + +} + +void HAL_DisconnectFromWifi() +{ +} + +int HAL_SetupWiFiOpenAccessPoint(const char* ssid) +{ + return 0; +} + diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index b6309ccd7..421bc2751 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -2782,6 +2782,9 @@ void OTA_RequestDownloadFromHTTP(const char* s) { #elif PLATFORM_BL602 +#elif PLATFORM_LN882H + + #elif PLATFORM_W600 || PLATFORM_W800 t_http_fwup(s); #elif PLATFORM_XR809 diff --git a/src/httpserver/rest_interface.c b/src/httpserver/rest_interface.c index db308fc7c..4ede510f9 100644 --- a/src/httpserver/rest_interface.c +++ b/src/httpserver/rest_interface.c @@ -1254,6 +1254,8 @@ static int http_rest_post_flash(http_request_t* request, int startaddr, int maxa socket_fwup_err(0, nRetCode); return http_rest_error(request, nRetCode, error_message); } +#elif PLATFORM_LN882H + #elif PLATFORM_BL602 int sockfd, i; diff --git a/src/mqtt/new_mqtt.c b/src/mqtt/new_mqtt.c index 40b5b827e..c0116f208 100644 --- a/src/mqtt/new_mqtt.c +++ b/src/mqtt/new_mqtt.c @@ -1540,7 +1540,7 @@ static void mqtt_timer_thread(void* param) MQTT_Test_Tick(param); } } -#elif PLATFORM_XR809 +#elif PLATFORM_XR809 || PLATFORM_LN882H static OS_Timer_t timer; #else static beken_timer_t g_mqtt_timer; @@ -1575,7 +1575,7 @@ commandResult_t MQTT_StartMQTTTestThread(const void* context, const char* cmd, c xTaskCreate(mqtt_timer_thread, "mqtt", 1024, (void*)info, 15, NULL); #elif PLATFORM_W600 || PLATFORM_W800 xTaskCreate(mqtt_timer_thread, "mqtt", 1024, (void*)info, 15, NULL); -#elif PLATFORM_XR809 +#elif PLATFORM_XR809 || PLATFORM_LN882H OS_TimerSetInvalid(&timer); if (OS_TimerCreate(&timer, OS_TIMER_PERIODIC, MQTT_Test_Tick, (void*)info, MQTT_TMR_DURATION) != OS_OK) { diff --git a/src/user_main.c b/src/user_main.c index 43bb60654..eae233a84 100644 --- a/src/user_main.c +++ b/src/user_main.c @@ -122,7 +122,18 @@ void extended_app_waiting_for_launch2(void) { } #endif -#if defined(PLATFORM_BL602) || defined(PLATFORM_W800) || defined(PLATFORM_W600) + +#if defined(PLATFORM_LN882H) + +int LWIP_GetMaxSockets() { + return 0; +} +int LWIP_GetActiveSockets() { + return 0; +} +#endif + +#if defined(PLATFORM_BL602) || defined(PLATFORM_W800) || defined(PLATFORM_W600)|| defined(PLATFORM_LN882H)