update spi test code
Change-Id: If3a2684397ea7ec461718930cc5a671235c6fa17
diff --git a/mbtk/test/others/mbtk_spi_write.c b/mbtk/test/others/mbtk_spi_write.c
index 19a0a44..be15742 100755
--- a/mbtk/test/others/mbtk_spi_write.c
+++ b/mbtk/test/others/mbtk_spi_write.c
@@ -44,7 +44,7 @@
* Created on: 2013-5-28
* Author: lzy
*/
-static const char *device = "/dev/spidev1.0";
+static char device[64] = {0};
static uint8_t mode = 0; /* SPI通信使用全双工,设置CPOL=0,CPHA=0。 */
static uint8_t bits = 8; /* 8bits读写,MSB first。*/
static uint32_t speed = 12 * 1000 * 1000;/* 设置12M传输速度 */
@@ -291,7 +291,18 @@
int main(int argc, char *argv[])
{
int ret = 0;
-
+
+ if(argc == 2)
+ {
+ memset(device, 0x0, 64);
+ memcpy(device, argv[1], strlen(argv[1]));
+ printf("device: %s\n", device);
+ }
+ else
+ {
+ printf("format: mbtk_spi_write <dev>\n");
+ return -1;
+ }
ret = SPI_Open();
if (ret)
return ret;