forked from xuos/xiuos
upport e220 for stm32f4discovery on nuttx
This commit is contained in:
parent
36db2b9e9f
commit
a8f36fd085
|
@ -6,6 +6,10 @@ config ADAPTER_E220
|
|||
bool "Using lora adapter device E220-400T22S"
|
||||
default n
|
||||
|
||||
config ADAPTER_E22
|
||||
bool "Using lora adapter device E22-400T33D"
|
||||
default n
|
||||
|
||||
choice
|
||||
prompt "Lora device adapter select net role type "
|
||||
default AS_LORA_CLIENT_ROLE
|
||||
|
@ -39,4 +43,8 @@ endif
|
|||
|
||||
if ADAPTER_E220
|
||||
source "$APP_DIR/Framework/connection/lora/e220/Kconfig"
|
||||
endif
|
||||
|
||||
if ADAPTER_E22
|
||||
source "$APP_DIR/Framework/connection/lora/e22/Kconfig"
|
||||
endif
|
||||
|
|
|
@ -28,6 +28,10 @@ extern AdapterProductInfoType Sx1278Attach(struct Adapter *adapter);
|
|||
extern AdapterProductInfoType E220Attach(struct Adapter *adapter);
|
||||
#endif
|
||||
|
||||
#ifdef ADAPTER_E22
|
||||
extern AdapterProductInfoType E22Attach(struct Adapter *adapter);
|
||||
#endif
|
||||
|
||||
//#define CLIENT_UPDATE_MODE
|
||||
#define GATEWAY_CMD_MODE
|
||||
|
||||
|
@ -880,6 +884,19 @@ int AdapterLoraInit(void)
|
|||
adapter->done = product_info->model_done;
|
||||
#endif
|
||||
|
||||
#ifdef ADAPTER_E22
|
||||
AdapterProductInfoType product_info = E22Attach(adapter);
|
||||
if (!product_info) {
|
||||
printf("AdapterLoraInit e22 attach error\n");
|
||||
PrivFree(adapter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
adapter->product_info_flag = 1;
|
||||
adapter->info = product_info;
|
||||
adapter->done = product_info->model_done;
|
||||
#endif
|
||||
|
||||
PrivSemaphoreCreate(&adapter->sem, 0, 0);
|
||||
|
||||
PrivSemaphoreCreate(&gateway_recv_data_sem, 0, 0);
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
config ADAPTER_LORA_E22
|
||||
string "E22-400T33D adapter name"
|
||||
default "e22"
|
||||
|
||||
if ADD_XIZI_FETURES
|
||||
|
||||
endif
|
||||
|
||||
if ADD_NUTTX_FETURES
|
||||
|
||||
config ADAPTER_E22_M0_PATH
|
||||
string "E22 M0 pin device"
|
||||
default "/dev/gpout0"
|
||||
|
||||
config ADAPTER_E22_M1_PATH
|
||||
string "E22 M1 pin device"
|
||||
default "/dev/gpout1"
|
||||
|
||||
|
||||
config ADAPTER_E22_DRIVER
|
||||
string "E22 device uart driver path"
|
||||
default "/dev/ttyS3"
|
||||
|
||||
endif
|
||||
|
||||
if ADD_RTTHREAD_FETURES
|
||||
|
||||
endif
|
|
@ -0,0 +1,6 @@
|
|||
############################################################################
|
||||
# APP_Framework/Framework/connection/lora/e22/Make.defs
|
||||
############################################################################
|
||||
ifneq ($(CONFIG_ADAPTER_E22),)
|
||||
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/connection/lora/e22
|
||||
endif
|
|
@ -0,0 +1,7 @@
|
|||
include $(KERNEL_ROOT)/.config
|
||||
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
|
||||
include $(APPDIR)/Make.defs
|
||||
CSRCS += e22.c
|
||||
include $(APPDIR)/Application.mk
|
||||
|
||||
endif
|
|
@ -0,0 +1,501 @@
|
|||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file e22.c
|
||||
* @brief Implement the connection E22-400T22S lora adapter function
|
||||
* @version 2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022.4.20
|
||||
*/
|
||||
|
||||
#include <adapter.h>
|
||||
|
||||
#define E22_GATEWAY_ADDRESS 0xFFFF
|
||||
#define E22_CHANNEL 0x05
|
||||
|
||||
#ifdef AS_LORA_GATEWAY_ROLE
|
||||
#define E22_ADDRESS E22_GATEWAY_ADDRESS
|
||||
#endif
|
||||
|
||||
#ifdef AS_LORA_CLIENT_ROLE
|
||||
#define E22_ADDRESS ADAPTER_LORA_NET_ROLE_ID
|
||||
#endif
|
||||
|
||||
#define E22_UART_BAUD_RATE 115200
|
||||
|
||||
enum E22LoraMode
|
||||
{
|
||||
DATA_TRANSFER_MODE = 0, //M1 : M0 = 0 : 0
|
||||
WOR_SEND_MODE, //M1 : M0 = 0 : 1
|
||||
CONFIGURE_MODE, //M1 : M0 = 1 : 0
|
||||
SLEEP_MODE, //M1 : M0 = 1 : 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: Config E22 work mode by set M1/M0 pin
|
||||
* @param mode Lora working mode
|
||||
* @return NULL
|
||||
*/
|
||||
static void E22LoraModeConfig(enum E22LoraMode mode)
|
||||
{
|
||||
int m0_fd, m1_fd;
|
||||
|
||||
//delay 1s , wait AUX ready
|
||||
PrivTaskDelay(1000);
|
||||
m0_fd = PrivOpen(ADAPTER_E22_M0_PATH, O_RDWR);
|
||||
if (m0_fd < 0) {
|
||||
printf("open %s error\n", ADAPTER_E22_M0_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
m1_fd = PrivOpen(ADAPTER_E22_M1_PATH, O_RDWR);
|
||||
if (m1_fd < 0) {
|
||||
printf("open %s error\n", ADAPTER_E22_M1_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
//Both M0 and M1 GPIO are outputs mode, set M0 and M1 high or low
|
||||
switch (mode)
|
||||
{
|
||||
case DATA_TRANSFER_MODE:
|
||||
PrivIoctl(m1_fd, GPIOC_WRITE, (unsigned long)GPIO_LOW);
|
||||
PrivIoctl(m0_fd, GPIOC_WRITE, (unsigned long)GPIO_LOW);
|
||||
break;
|
||||
|
||||
case WOR_SEND_MODE:
|
||||
PrivIoctl(m1_fd, GPIOC_WRITE, (unsigned long)GPIO_LOW);
|
||||
PrivIoctl(m0_fd, GPIOC_WRITE, (unsigned long)GPIO_HIGH);
|
||||
break;
|
||||
|
||||
case CONFIGURE_MODE:
|
||||
PrivIoctl(m1_fd, GPIOC_WRITE, (unsigned long)GPIO_HIGH);
|
||||
PrivIoctl(m0_fd, GPIOC_WRITE,(unsigned long)GPIO_LOW);
|
||||
break;
|
||||
|
||||
case SLEEP_MODE:
|
||||
PrivIoctl(m1_fd, GPIOC_WRITE, (unsigned long)GPIO_HIGH);
|
||||
PrivIoctl(m0_fd, GPIOC_WRITE, (unsigned long)GPIO_HIGH);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PrivClose(m0_fd);
|
||||
PrivClose(m1_fd);
|
||||
|
||||
//delay 20ms , wait mode switch done
|
||||
PrivTaskDelay(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Switch baud rate to register bit
|
||||
* @param baud_rate - baud_rate
|
||||
* @return baud_rate_bit
|
||||
*/
|
||||
static uint8 E22BaudRateSwitch(uint32 baud_rate)
|
||||
{
|
||||
uint8 baud_rate_bit;
|
||||
|
||||
switch (baud_rate)
|
||||
{
|
||||
case 1200:
|
||||
baud_rate_bit = 0x0;
|
||||
break;
|
||||
|
||||
case 2400:
|
||||
baud_rate_bit = 0x1;
|
||||
break;
|
||||
|
||||
case 4800:
|
||||
baud_rate_bit = 0x2;
|
||||
break;
|
||||
|
||||
case 9600:
|
||||
baud_rate_bit = 0x3;
|
||||
break;
|
||||
|
||||
case 19200:
|
||||
baud_rate_bit = 0x4;
|
||||
break;
|
||||
|
||||
case 38400:
|
||||
baud_rate_bit = 0x5;
|
||||
break;
|
||||
|
||||
case 57600:
|
||||
baud_rate_bit = 0x6;
|
||||
break;
|
||||
|
||||
case 115200:
|
||||
baud_rate_bit = 0x7;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return baud_rate_bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Set E22 register, such as address、channel、baud rate...
|
||||
* @param adapter - lora adapter
|
||||
* @param address - address
|
||||
* @param channel - channel
|
||||
* @param baud_rate - baud_rate
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22SetRegisterParam(struct Adapter *adapter, uint16 address, uint8 channel, uint32 baud_rate)
|
||||
{
|
||||
int ret;
|
||||
uint8 buffer[50] = {0};
|
||||
uint8 baud_rate_bit = E22BaudRateSwitch(baud_rate);
|
||||
|
||||
E22LoraModeConfig(CONFIGURE_MODE);
|
||||
PrivTaskDelay(30);
|
||||
|
||||
buffer[0] = 0xC0; //write register order
|
||||
buffer[1] = 0x00; //register start-address
|
||||
buffer[2] = 0x09; //register length
|
||||
|
||||
buffer[3] = (address >> 8) & 0xFF; //high address
|
||||
buffer[4] = address & 0xFF; //low adderss
|
||||
|
||||
buffer[5] = 0x00; //net id
|
||||
|
||||
buffer[6] = ((baud_rate_bit << 5) & 0xE0) | 0x04; // baud、stop bits、air rate
|
||||
|
||||
buffer[7] = 0x00;
|
||||
buffer[8] = channel; //channel
|
||||
buffer[9] = 0x03;
|
||||
buffer[10] = 0; //high-cipher
|
||||
buffer[11] = 0; //low-cipher
|
||||
|
||||
ret = PrivWrite(adapter->fd, (void *)buffer, 12);
|
||||
if(ret < 0){
|
||||
printf("E22SetRegisterParam send failed %d!\n", ret);
|
||||
}
|
||||
|
||||
PrivRead(adapter->fd, buffer, 11);
|
||||
|
||||
E22LoraModeConfig(DATA_TRANSFER_MODE);
|
||||
PrivTaskDelay(1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Get E22 register, such as address、channel、baud rate...
|
||||
* @param buf - data buf
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22GetRegisterParam(uint8 *buf)
|
||||
{
|
||||
int ret;
|
||||
uint8 buffer[3] = {0};
|
||||
|
||||
struct Adapter *adapter = AdapterDeviceFindByName(ADAPTER_LORA_NAME);
|
||||
if (NULL == adapter) {
|
||||
printf("E22GetRegisterParam find lora adapter error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
E22LoraModeConfig(CONFIGURE_MODE);
|
||||
PrivTaskDelay(30);
|
||||
|
||||
buffer[0] = 0xC1; //read register order
|
||||
buffer[1] = 0x00; //register start-address
|
||||
buffer[2] = 0x09; //register length
|
||||
|
||||
ret = PrivWrite(adapter->fd, (void *)buffer, 3);
|
||||
if(ret < 0){
|
||||
printf("E22GetRegisterParam send failed %d!\n", ret);
|
||||
}
|
||||
|
||||
PrivRead(adapter->fd, buf, 11);
|
||||
|
||||
E22LoraModeConfig(DATA_TRANSFER_MODE);
|
||||
PrivTaskDelay(30);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Open E22 uart function
|
||||
* @param adapter - Lora device pointer
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Open(struct Adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
struct termios cfg;
|
||||
/*step1: open e22 uart port*/
|
||||
adapter->fd = PrivOpen(ADAPTER_E22_DRIVER, O_RDWR);
|
||||
if (adapter->fd < 0) {
|
||||
printf("E22Open get uart %s fd error\n", ADAPTER_E22_DRIVER);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tcgetattr(adapter->fd, &cfg);
|
||||
cfsetspeed(&cfg, BAUD_RATE_9600);
|
||||
tcsetattr(adapter->fd, TCSANOW, &cfg);
|
||||
|
||||
E22SetRegisterParam(adapter, E22_ADDRESS, E22_CHANNEL, E22_UART_BAUD_RATE);
|
||||
|
||||
|
||||
cfsetspeed(&cfg, E22_UART_BAUD_RATE);
|
||||
tcsetattr(adapter->fd, TCSANOW, &cfg);
|
||||
|
||||
ADAPTER_DEBUG("E22Open done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: Close E22 uart function
|
||||
* @param adapter - Lora device pointer
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Close(struct Adapter *adapter)
|
||||
{
|
||||
/*step1: close e22 uart port*/
|
||||
int ret;
|
||||
ret = PrivClose(adapter->fd);
|
||||
if(ret < 0) {
|
||||
printf("E22 close failed: %d!\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ADAPTER_DEBUG("E22 Close done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: E22 ioctl function
|
||||
* @param adapter - Lora device pointer
|
||||
* @param cmd - ioctl cmd
|
||||
* @param args - iotl params
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Ioctl(struct Adapter *adapter, int cmd, void *args)
|
||||
{
|
||||
/*to do*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: E22 join lora net group function
|
||||
* @param adapter - Lora device pointer
|
||||
* @param priv_net_group - priv_net_group params
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Join(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||
{
|
||||
int ret;
|
||||
struct AdapterData *priv_net_group_data = (struct AdapterData *)priv_net_group;
|
||||
|
||||
ret = PrivWrite(adapter->fd, (void *)priv_net_group_data->buffer, priv_net_group_data->len);
|
||||
if(ret < 0) {
|
||||
printf("E22 Join net group failed: %d!\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: E22 send data function
|
||||
* @param adapter - Lora device pointer
|
||||
* @param buf - data buffers
|
||||
* @param len - data len
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Send(struct Adapter *adapter, const void *buf, size_t len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = PrivWrite(adapter->fd, (void *)buf, len);
|
||||
if(ret < 0){
|
||||
printf("send failed %d!\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: E22 receive data function
|
||||
* @param adapter - Lora device pointer
|
||||
* @param buf - data buffers
|
||||
* @param len - data len
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Recv(struct Adapter *adapter, void *buf, size_t len)
|
||||
{
|
||||
int recv_len, recv_len_continue;
|
||||
|
||||
uint8 *recv_buf = PrivMalloc(len);
|
||||
|
||||
recv_len = PrivRead(adapter->fd, recv_buf, len);
|
||||
if (recv_len) {
|
||||
while (recv_len < len) {
|
||||
recv_len_continue = PrivRead(adapter->fd, recv_buf + recv_len, len - recv_len);
|
||||
if (recv_len_continue) {
|
||||
recv_len += recv_len_continue;
|
||||
} else {
|
||||
recv_len = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
memcpy(buf, recv_buf, len);
|
||||
}
|
||||
|
||||
PrivFree(recv_buf);
|
||||
|
||||
return recv_len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: E22 quit lora net group function
|
||||
* @param adapter - Lora device pointer
|
||||
* @param priv_net_group - priv_net_group params
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
static int E22Quit(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||
{
|
||||
int ret;
|
||||
|
||||
struct AdapterData *priv_net_group_data = (struct AdapterData *)priv_net_group;
|
||||
|
||||
ret = PrivWrite(adapter->fd, (void *)priv_net_group_data->buffer, priv_net_group_data->len);
|
||||
if(ret < 0){
|
||||
printf("E22 quit net group failed %d!\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct PrivProtocolDone e22_done =
|
||||
{
|
||||
.open = E22Open,
|
||||
.close = E22Close,
|
||||
.ioctl = E22Ioctl,
|
||||
.setup = NULL,
|
||||
.setdown = NULL,
|
||||
.setaddr = NULL,
|
||||
.setdns = NULL,
|
||||
.setdhcp = NULL,
|
||||
.ping = NULL,
|
||||
.netstat = NULL,
|
||||
.join = E22Join,
|
||||
.send = E22Send,
|
||||
.recv = E22Recv,
|
||||
.quit = E22Quit,
|
||||
};
|
||||
|
||||
AdapterProductInfoType E22Attach(struct Adapter *adapter)
|
||||
{
|
||||
struct AdapterProductInfo *product_info = malloc(sizeof(struct AdapterProductInfo));
|
||||
if (!product_info) {
|
||||
printf("E22Attach malloc product_info error\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy(product_info->model_name, ADAPTER_LORA_E22,sizeof(product_info->model_name));
|
||||
product_info->model_done = (void *)&e22_done;
|
||||
|
||||
return product_info;
|
||||
}
|
||||
|
||||
//###################TEST####################
|
||||
static void LoraOpen(void)
|
||||
{
|
||||
struct Adapter *adapter = AdapterDeviceFindByName(ADAPTER_LORA_NAME);
|
||||
if (NULL == adapter) {
|
||||
printf("LoraReceive find lora adapter error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
E22Open(adapter);
|
||||
}
|
||||
|
||||
static void LoraRead(void *parameter)
|
||||
{
|
||||
int RevLen;
|
||||
int i, cnt = 0;
|
||||
|
||||
uint8 buffer[256];
|
||||
|
||||
memset(buffer, 0, 256);
|
||||
|
||||
struct Adapter *adapter = AdapterDeviceFindByName(ADAPTER_LORA_NAME);
|
||||
if (NULL == adapter) {
|
||||
printf("LoraRead find lora adapter error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
printf("ready to read lora data\n");
|
||||
|
||||
RevLen = E22Recv(adapter, buffer, 256);
|
||||
if (RevLen) {
|
||||
printf("lora get data %u\n", RevLen);
|
||||
for (i = 0; i < RevLen; i ++) {
|
||||
printf("i %u data 0x%x\n", i, buffer[i]);
|
||||
}
|
||||
|
||||
memset(buffer, 0, 256);
|
||||
|
||||
PrivTaskDelay(1000);
|
||||
|
||||
cnt ++;
|
||||
E22Send(adapter, &cnt, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void E22LoraReceive(void)
|
||||
{
|
||||
int ret;
|
||||
pthread_t thread;
|
||||
pthread_attr_t attr = PTHREAD_ATTR_INITIALIZER;
|
||||
attr.priority = 80;
|
||||
attr.stacksize = 2048;
|
||||
|
||||
LoraOpen();
|
||||
|
||||
ret = PrivTaskCreate(&thread, &attr, (void*)LoraRead, NULL);
|
||||
if (ret < 0) {
|
||||
printf("task lora read create failed, status=%d\n", ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
void E22LoraSend(int argc, char *argv[])
|
||||
{
|
||||
struct Adapter *adapter = AdapterDeviceFindByName(ADAPTER_LORA_NAME);
|
||||
if (NULL == adapter) {
|
||||
printf("LoraRead find lora adapter error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (argc == 2) {
|
||||
char Msg[256] = {0};
|
||||
strncpy(Msg, argv[1], 256);
|
||||
|
||||
E22Open(adapter);
|
||||
E22Send(adapter, Msg, strlen(Msg));
|
||||
E22Close(adapter);
|
||||
}
|
||||
}
|
|
@ -672,6 +672,14 @@ config NSH_DISABLE_E220_LORA_SEND
|
|||
bool "Disable e220 Lora send."
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_E22_LORA_RECEIVE
|
||||
bool "Disable e22 Lora receive."
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_E22_LORA_SEND
|
||||
bool "Disable e22 Lora send."
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_ADAPTER_BLUETOOTH_TEST
|
||||
bool "Disable hc08 AdapterBlueToothTest."
|
||||
default n
|
||||
|
|
|
@ -1486,7 +1486,8 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb,
|
|||
int cmd_recvzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220)) && !defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
|
||||
#if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220) || defined(CONFIG_ADAPTER_LORA_E22)) && \
|
||||
!defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
|
||||
int cmd_AdapterLoraTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
|
@ -1502,6 +1503,14 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb,
|
|||
int cmd_E220LoraSend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_LORA_E22) && !defined(CONFIG_NSH_DISABLE_E22_LORA_RECEIVE)
|
||||
int cmd_E22LoraReceive(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_LORA_E22) && !defined(CONFIG_NSH_DISABLE_E22_LORA_SEND)
|
||||
int cmd_E22LoraSend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_BLUETOOTH_HC08) && !defined(CONFIG_NSH_DISABLE_ADAPTER_BLUETOOTH_TEST)
|
||||
int cmd_AdapterBlueToothTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
|
|
@ -283,7 +283,8 @@ int cmd_recvzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220)) && !defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
|
||||
#if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220) || defined(CONFIG_ADAPTER_LORA_E22)) && \
|
||||
!defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
|
||||
extern int AdapterLoraTest(void);
|
||||
int cmd_AdapterLoraTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
|
@ -327,6 +328,28 @@ int cmd_E220LoraSend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_LORA_E22) && !defined(CONFIG_NSH_DISABLE_E22_LORA_RECEIVE)
|
||||
void E22LoraReceive(void);
|
||||
int cmd_E22LoraReceive(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
nsh_output(vtbl, "Hello, world!\n");
|
||||
FrameworkInit();
|
||||
E22LoraReceive();
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_LORA_E22) && !defined(CONFIG_NSH_DISABLE_E22_LORA_SEND)
|
||||
extern void E22LoraSend(int argc, char *argv[]);
|
||||
int cmd_E22LoraSend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
nsh_output(vtbl, "Hello, world!\n");
|
||||
FrameworkInit();
|
||||
E22LoraSend(argc,argv);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_BLUETOOTH_HC08) && !defined(CONFIG_NSH_DISABLE_ADAPTER_BLUETOOTH_TEST)
|
||||
extern int AdapterBlueToothTest(void);
|
||||
int cmd_AdapterBlueToothTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
|
|
|
@ -658,8 +658,9 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
{ "recvzigbee", cmd_recvzigbee, 1, 1, "[receive message.]" },
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220)) && !defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
|
||||
{ "AdapterLoraTest", cmd_AdapterLoraTest, 1, 1, "[Lora sx128 test.]" },
|
||||
#if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220) || defined(CONFIG_ADAPTER_LORA_E22)) && \
|
||||
!defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
|
||||
{ "AdapterLoraTest", cmd_AdapterLoraTest, 1, 1, "[Lora test.]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_4G_EC200T) && !defined(CONFIG_NSH_DISABLE_ADAPTER_4GTEST)
|
||||
|
@ -674,6 +675,14 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
{ "E220Send", cmd_E220LoraSend, 1, 2, "[e220loraSend <message>]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_LORA_E22) && !defined(CONFIG_NSH_DISABLE_E22_LORA_RECEIVE)
|
||||
{ "E22Receive", cmd_E22LoraReceive, 1, 1, "[e22 lora receive.]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_LORA_E22) && !defined(CONFIG_NSH_DISABLE_E22_LORA_SEND)
|
||||
{ "E22Send", cmd_E22LoraSend, 1, 2, "[e22loraSend <message>]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ADAPTER_BLUETOOTH_HC08) && !defined(CONFIG_NSH_DISABLE_ADAPTER_BLUETOOTH_TEST)
|
||||
{ "AdapterBlueToothTest", cmd_AdapterBlueToothTest, 1, 1, "[BlueTooth hc08 test.]" },
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
# CONFIG_NSH_CMDPARMS is not set
|
||||
CONFIG_ADD_NUTTX_FETURES=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32"
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32F407VG=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LATE_INITIALIZE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CLOCK_MONOTONIC=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_HOST_WINDOWS=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART3=y
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_DEV_GPIO=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_READLINE_CMD_HISTORY_LEN=100
|
||||
CONFIG_READLINE_CMD_HISTORY_LINELEN=120
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_SUPPORT_CONNECTION_FRAMEWORK=y
|
||||
CONFIG_CONNECTION_FRAMEWORK_DEBUG=y
|
||||
CONFIG_CONNECTION_ADAPTER_LORA=y
|
||||
CONFIG_ADAPTER_E22=y
|
||||
CONFIG_ADAPTER_LORA_E22="e22"
|
||||
CONFIG_ADAPTER_E22_M0_PATH="/dev/gpout0"
|
||||
CONFIG_ADAPTER_E22_M1_PATH="/dev/gpout1"
|
||||
CONFIG_ADAPTER_E22_DRIVER="/dev/ttyS3"
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
Loading…
Reference in New Issue