修改gpio初始化输入时报错问题
Change-Id: I33407f7bf4ae7d4cc14dff572db649bc76f1e00e
diff --git a/mbtk/ql_lib/src/ql_gpio.c b/mbtk/ql_lib/src/ql_gpio.c
index 85e254b..2d3cae6 100755
--- a/mbtk/ql_lib/src/ql_gpio.c
+++ b/mbtk/ql_lib/src/ql_gpio.c
@@ -398,12 +398,13 @@
return RES_IO_ERROR;
}
- if(gpio_value_set(gpio, level))
- {
- LOGE("gpio_value_set() fail.");
- return RES_IO_ERROR;
+ if(dir == PINDIRECTION_OUT){
+ if(gpio_value_set(gpio, level))
+ {
+ LOGE("gpio_value_set() fail.");
+ return RES_IO_ERROR;
+ }
}
-
// No support pull mode now.
return RES_OK;
@@ -545,9 +546,9 @@
LOGE("gpio_direct_get() fail.");
return RES_IO_NOT_SUPPORT;
} else {
- if(strcmp(buff, "in") == 0) {
+ if(strncmp(buff, "in",2) == 0) {
return PINDIRECTION_IN;
- } else if(strcmp(buff, "out") == 0) {
+ } else if(strncmp(buff, "out",3) == 0) {
return PINDIRECTION_OUT;
} else {
return RES_IO_NOT_SUPPORT;