![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
2020/08/19
Diff: main.cpp
- Revision:
- 2:dfaf7126cf6b
- Parent:
- 1:0deed3031dfc
--- a/main.cpp Thu Jan 08 13:28:36 2015 +0000 +++ b/main.cpp Wed Aug 19 04:10:52 2020 +0000 @@ -3,7 +3,7 @@ DigitalOut myled(LED1); Serial pc(USBTX, USBRX); -IM920 im920(p28, p27, p29, p30); +IM920 im920(PA_2,PA_3,PA_0,PA_1);//tx, rx, busy, reset void callback () { int i; @@ -18,27 +18,18 @@ int i = 0; char buf[65]; - pc.baud(115200); + pc.baud(19200); pc.printf("*** IM920\r\n"); im920.init(); im920.attach(callback); myled = 1; + + for(i=0;i<64;i++){//bufにとりあえず値を入れてみる + buf[i]=i; + } + + //im920.poll(); + printf("send: %s\r\n", buf);//送信データの確認 + im920.send(buf,i);//データ送信 - for (;;) { - im920.poll(); - if (pc.readable()) { - char c = pc.getc(); - if (c == '\r') { - buf[i] = 0; - printf("send: %s\r\n", buf); - im920.send(buf, i); - i = 0; - } else - if (i < 64) { - buf[i] = c; - i ++; - } - } - } } -