support e220 for nuttx on xidatong

This commit is contained in:
wgzAIIT 2022-04-26 18:23:14 +08:00
parent 9ac84e7cb4
commit a09caa272f
8 changed files with 62 additions and 40 deletions

View File

@ -1,7 +1,7 @@
############################################################################
# APP_Framework/Framework/connection/lora/Make.defs
############################################################################
ifneq ($(CONFIG_ADAPTER_SX1278),)
ifneq ($(CONFIG_CONNECTION_ADAPTER_LORA),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/connection/lora
endif
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/connection/lora/*/Make.defs)

View File

@ -0,0 +1,6 @@
############################################################################
# APP_Framework/Framework/connection/lora/e220/Make.defs
############################################################################
ifneq ($(CONFIG_ADAPTER_E220),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/connection/lora/e220
endif

View File

@ -133,40 +133,9 @@ int PrivWrite(int fd, const void *buf, size_t len)
return write(fd, buf, len);
}
static int PrivSerialIoctl(int fd, int cmd, void *args)
int PrivIoctl(int fd, int cmd, unsigned long args)
{
struct SerialDataCfg *serial_cfg = (struct SerialDataCfg *)args;
return ioctl(fd, cmd, serial_cfg);
}
static int PrivPinIoctl(int fd, int cmd, void *args)
{
struct PinParam *pin_cfg = (struct PinParam *)args;
return ioctl(fd, cmd, pin_cfg);
}
int PrivIoctl(int fd, int cmd, void *args)
{
int ret = 0;
struct PrivIoctlCfg *ioctl_cfg = (struct PrivIoctlCfg *)args;
switch (ioctl_cfg->ioctl_driver_type)
{
case SERIAL_TYPE:
ret = PrivSerialIoctl(fd, cmd, ioctl_cfg->args);
break;
case PIN_TYPE:
ret = PrivPinIoctl(fd, cmd, ioctl_cfg->args);
break;
case I2C_TYPE:
ret = ioctl(fd, cmd, ioctl_cfg->args);
break;
default:
break;
}
return ret;
return ioctl(fd, cmd, args);
}
/********************memory api************/

View File

@ -28,6 +28,7 @@
#include <stddef.h>
#include <stdint.h>
#include <nuttx/wireless/lpwan/sx127x.h>
#include <nuttx/ioexpander/gpio.h>
typedef uint8_t uint8;
typedef uint16_t uint16;
@ -43,10 +44,11 @@ typedef int64_t int64;
extern "C" {
#endif
#define OPE_INT 0x0000
#define OPE_CFG 0x0001
#define OPE_INT 0x0000
#define OPE_CFG 0x0001
#define NAME_NUM_MAX 32
#define NAME_NUM_MAX 32
/*********************GPIO define*********************/
#define GPIO_LOW 0x00
@ -201,7 +203,7 @@ int PrivOpen(const char *path, int flags);
int PrivRead(int fd, void *buf, size_t len);
int PrivWrite(int fd, const void *buf, size_t len);
int PrivClose(int fd);
int PrivIoctl(int fd, int cmd, void *args);
int PrivIoctl(int fd, int cmd, unsigned long args);
/*********************memory***********************/

View File

@ -659,6 +659,14 @@ config NSH_DISABLE_ADAPTER_4GTEST
bool "Disable ec200t Adapter4GTest."
default n
config DISABLE_E220_LORATEST
bool "Disable e220 Lora test."
default n
config DISABLE_E220_LORASEND
bool "Disable e220 Lora send."
default n
config NSH_DISABLE_K210_FFT
bool "Disable the K210 fft device."
default n

View File

@ -1492,6 +1492,14 @@ int cmd_Ch438(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_Adapter4GTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_ADAPTER_LORA_E220) && !defined(CONFIG_NSH_DISABLE_E220_LORATEST)
int cmd_e220loraTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_ADAPTER_LORA_E220) && !defined(CONFIG_NSH_DISABLE_E220_LORASEND)
int cmd_e220loraSend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_K210_FFT_TEST) && !defined(CONFIG_NSH_DISABLE_K210_FFT)
int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif

View File

@ -42,7 +42,6 @@ extern void CH438Demo(void);
int cmd_Ch438(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
CH438Demo();
return OK;
}
@ -305,6 +304,28 @@ int cmd_Adapter4GTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
}
#endif
#if defined(CONFIG_ADAPTER_LORA_E220) && !defined(CONFIG_NSH_DISABLE_E220_LORATEST)
extern void LoraTest(void);
int cmd_e220loraTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
LoraTest();
return OK;
}
#endif
#if defined(CONFIG_ADAPTER_LORA_E220) && !defined(CONFIG_NSH_DISABLE_E220_LORASEND)
extern void LoraSend(int argc, char *argv[]);
int cmd_e220loraSend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
LoraSend(argc,argv);
return OK;
}
#endif
#if defined(CONFIG_K210_FFT_TEST) && !defined(CONFIG_NSH_DISABLE_K210_FFT)
extern void nuttx_k210_fft_test(void);
int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)

View File

@ -590,7 +590,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "xd", cmd_xd, 3, 3, "<hex-address> <byte-count>" },
#endif
{ "ch438", cmd_Ch438, 1, 1, "[get the concentration of formaldehyde with sensor tb600b_wq_hcho1os.]" },
{ "ch438", cmd_Ch438, 1, 1, "[ch438 demo cmd.]" },
#if defined(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS) && !defined(CONFIG_NSH_DISABLE_HCHO_TB600B_WQ_HCHO1OS)
{ "hcho1os", cmd_Hcho1os, 1, 1, "[get the concentration of formaldehyde with sensor tb600b_wq_hcho1os.]" },
@ -664,6 +664,14 @@ static const struct cmdmap_s g_cmdmap[] =
{ "Adapter4GTest", cmd_Adapter4GTest, 1, 1, "[4G ec200t test.]" },
#endif
#if defined(CONFIG_ADAPTER_LORA_E220) && !defined(CONFIG_NSH_DISABLE_E220_LORATEST)
{ "e220loraTest", cmd_e220loraTest, 1, 1, "[e220 lora test.]" },
#endif
#if defined(CONFIG_ADAPTER_LORA_E220) && !defined(CONFIG_NSH_DISABLE_E220_LORASEND)
{ "e220loraSend", cmd_e220loraSend, 1, 2, "[e220loraSend <message>]" },
#endif
#if defined(CONFIG_K210_FFT_TEST) && !defined(CONFIG_NSH_DISABLE_K210_FFT)
{ "fft", cmd_fft, 1, 1, "[K210 fft function.]" },
#endif