Commit 3944b2da authored by 黄振令's avatar 黄振令

【修改内容】9531板子上运行ncp程序串口无法通信,参照老版本程序复位一下底板(gpio11)

parent 92ffcb69
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "yjq_ezsp.h" #include "yjq_ezsp.h"
#include "./rpc_api/inc/rpc_interface_parse.h" #include "./rpc_api/inc/rpc_interface_parse.h"
#include <pthread.h> #include <pthread.h>
#include <fcntl.h>
pthread_mutex_t g_mutex_lock; pthread_mutex_t g_mutex_lock;
...@@ -481,8 +483,58 @@ void emAfResetAndInitNCP(void) ...@@ -481,8 +483,58 @@ void emAfResetAndInitNCP(void)
// ******************************************************************* // *******************************************************************
// The main() loop and the application's contribution. // The main() loop and the application's contribution.
static void gpio_output_set(int val, int gpio_num)
{
char str[120] = {0};
int re = 0;
memset(str, 0, sizeof(str));
snprintf(str, sizeof(str), "/sys/class/gpio/gpio%d", gpio_num);
if ((access(str, F_OK)) == -1)
{
snprintf(str, sizeof(str), "echo %d > /sys/class/gpio/export", gpio_num);
re = system(str);
if (re != 0)
{
return;
}
}
snprintf(str, sizeof(str), "echo out > /sys/class/gpio/gpio%d/direction", gpio_num);
re = system(str);
if (re != 0)
{
return;
}
snprintf(str, sizeof(str), "echo %d > /sys/class/gpio/gpio%d/value", val == false ? 0 : 1, gpio_num);
re = system(str);
if (re != 0)
{
return;
}
}
void chip_reset()
{
printf("try reset chip\n");
gpio_output_set(false, 11);
sleep(1);
gpio_output_set(true, 11);
sleep(1);
}
void emberAfMainInit(void) void emberAfMainInit(void)
{ {
chip_reset();
} }
int emberAfMain(MAIN_FUNCTION_PARAMETERS) int emberAfMain(MAIN_FUNCTION_PARAMETERS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment