forked from xuos/xiuos
support E18 zigbee for nuttx on xidatong-riscv64
This commit is contained in:
parent
31f03a56d6
commit
c4ab73350b
|
@ -47,29 +47,25 @@ if ADD_XIZI_FETURES
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ADD_NUTTX_FETURES
|
if ADD_NUTTX_FETURES
|
||||||
config ADAPTER_E18_MODEPIN
|
config ADAPTER_E18_MODE_PATH
|
||||||
int "E18 MODE pin number"
|
string "E18 MODE pin device"
|
||||||
default "61"
|
default "/dev/gpio2"
|
||||||
|
|
||||||
config ADAPTER_E18_PIN_DRIVER
|
config ADAPTER_E18_DRIVER_EXTUART
|
||||||
string "E18 device pin driver path"
|
bool "Using extra uart to support zigbee"
|
||||||
default "/dev/pin_dev"
|
default y
|
||||||
|
|
||||||
|
config ADAPTER_E18_DRIVER
|
||||||
|
string "E18 device uart driver path"
|
||||||
|
default "/dev/ttyS1"
|
||||||
|
depends on !ADAPTER_E18_DRIVER_EXTUART
|
||||||
|
---help---
|
||||||
|
If USART1 is selected, then fill in /dev/ttyS1 here.
|
||||||
|
|
||||||
config ADAPTER_E18_DRIVER
|
if ADAPTER_E18_DRIVER_EXTUART
|
||||||
string "E18 device uart driver path"
|
config ADAPTER_E18_DRIVER
|
||||||
default "/dev/ttyS1"
|
string "E18 device extra uart driver path"
|
||||||
depends on !ADAPTER_E18_DRIVER_EXTUART
|
default "/dev/extuart_dev1"
|
||||||
---help---
|
|
||||||
If USART1 is selected, then fill in /dev/ttyS1 here.
|
|
||||||
|
|
||||||
if ADAPTER_E18_DRIVER_EXTUART
|
|
||||||
config ADAPTER_E18_DRIVER
|
|
||||||
string "E18 device extra uart driver path"
|
|
||||||
default "/dev/extuart_dev1"
|
|
||||||
|
|
||||||
config ADAPTER_E18_DRIVER_EXT_PORT
|
|
||||||
int "if E18 device using extuart, choose port"
|
|
||||||
default "1"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -42,6 +42,9 @@ char *cmd_set_ch = "AT+CH=11"; /*set channel as 11*/
|
||||||
|
|
||||||
static int E18HardwareModeGet()
|
static int E18HardwareModeGet()
|
||||||
{
|
{
|
||||||
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
return E18_AS_HEX_MODE;
|
||||||
|
#else
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int pin_fd;
|
int pin_fd;
|
||||||
|
|
||||||
|
@ -62,7 +65,8 @@ static int E18HardwareModeGet()
|
||||||
} else {
|
} else {
|
||||||
printf(" E18 as HEX mode\n");
|
printf(" E18 as HEX mode\n");
|
||||||
return E18_AS_HEX_MODE;
|
return E18_AS_HEX_MODE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ADD_NUTTX_FETURES
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
@ -175,9 +179,15 @@ static int E18NetworkModeConfig(struct Adapter *adapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if(E18_AS_AT_MODE == mode){
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
if(E18_AS_HEX_MODE == mode)
|
||||||
|
#else
|
||||||
|
if(E18_AS_AT_MODE == mode)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +252,12 @@ static int E18NetRoleConfig(struct Adapter *adapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if(E18_AS_AT_MODE == mode) {
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
if(E18_AS_HEX_MODE == mode)
|
||||||
|
#else
|
||||||
|
if(E18_AS_AT_MODE == mode)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +399,12 @@ static int E18Join(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||||
|
|
||||||
// }
|
// }
|
||||||
if(!ret){
|
if(!ret){
|
||||||
if(E18_AS_AT_MODE == mode) {
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
if(E18_AS_HEX_MODE == mode)
|
||||||
|
#else
|
||||||
|
if(E18_AS_AT_MODE == mode)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
ret = AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
ret = AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
printf("%s %d cmd[%s] config failed!\n",__func__,__LINE__,cmd_exit);
|
printf("%s %d cmd[%s] config failed!\n",__func__,__LINE__,cmd_exit);
|
||||||
|
|
Loading…
Reference in New Issue