add support for luat air724UG module

This commit is contained in:
mculover666
2020-07-03 10:53:43 +08:00
parent 26afeca15d
commit 66a674d73e
8 changed files with 753 additions and 35 deletions

View File

@@ -1,8 +1,17 @@
#include "esp8266.h"
#include "mcu_init.h"
#include "cmsis_os.h"
#include "tos_at_socket.h"
#define USE_ESP8266
//#define USE_AIR724
#if defined(USE_ESP8266)
#include "esp8266.h"
#elif defined(USE_AIR724)
#include "air724.h"
#endif
#define TCP_TEST_TASK_STK_SIZE 4096
void tcp_test(void);
osThreadDef(tcp_test, osPriorityNormal, 1, TCP_TEST_TASK_STK_SIZE);
@@ -19,8 +28,8 @@ void tcp_test(void)
bzero(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("39.108.190.129");
addr.sin_port = htons(8080);
addr.sin_addr.s_addr = inet_addr("117.50.111.72");
addr.sin_port = htons(8001);
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
@@ -58,7 +67,7 @@ void tcp_test(void)
close(fd);
}
#define USE_ESP8266
void application_entry(void *arg)
{
@@ -71,6 +80,10 @@ void application_entry(void *arg)
sim800a_power_on();
sim800a_sal_init(HAL_UART_PORT_2);
#endif
#ifdef USE_AIR724
air724_sal_init(HAL_UART_PORT_0);
#endif
osThreadCreate(osThread(tcp_test), NULL);
}

View File

@@ -1,8 +1,17 @@
#include "esp8266.h"
#include "mcu_init.h"
#include "sal_module_wrapper.h"
#include "cmsis_os.h"
#define USE_ESP8266
//#define USE_AIR724
#if defined(USE_ESP8266)
#include "esp8266.h"
#elif defined(USE_AIR724)
#include "air724.h"
#endif
#define UDP_TEST_TASK0_STK_SIZE 4096
void udp_test0(void);
osThreadDef(udp_test0, osPriorityNormal, 1, UDP_TEST_TASK0_STK_SIZE);
@@ -62,28 +71,28 @@ void udp_test1(void)
}
}
#define USE_ESP8266
void application_entry(void *arg)
{
#ifdef USE_ESP8266
#if defined(USE_ESP8266)
esp8266_sal_init(HAL_UART_PORT_0);
esp8266_join_ap("SheldonDai", "srnr6x9xbhmb0");
#endif
#ifdef USE_SIM800A
#elif defined(USE_SIM800A)
sim800a_power_on();
sim800a_sal_init(HAL_UART_PORT_2);
#elif defined(USE_AIR724)
air724_sal_init(HAL_UART_PORT_0);
#endif
socket_id_0 = tos_sal_module_connect("47.107.78.107", "1234", TOS_SAL_PROTO_UDP);
socket_id_0 = tos_sal_module_connect("117.50.111.72", "8081", TOS_SAL_PROTO_UDP);
if (socket_id_0 == -1) {
printf("UDP0 connect failed\r\n");
} else {
printf("UDP0 connect success! fd: %d\n", socket_id_0);
}
socket_id_1 = tos_sal_module_connect("47.107.78.107", "4321", TOS_SAL_PROTO_UDP);
socket_id_1 = tos_sal_module_connect("117.50.111.72", "8002", TOS_SAL_PROTO_UDP);
if (socket_id_1 == -1) {
printf("UDP1 connect failed\r\n");
} else {