SPI to Ethernet Master
Dependencies: WIZnetInterface mbed
Fork of SPI_HelloWorld_Mbed by
Diff: main.cpp
- Revision:
- 4:1b4fc2571fd4
- Parent:
- 3:feec15e3bb27
- Child:
- 5:fc5ffd86b1df
--- a/main.cpp Wed Mar 09 08:14:30 2016 +0000 +++ b/main.cpp Wed Mar 09 08:23:40 2016 +0000 @@ -66,33 +66,13 @@ while(1) { - n = socket.receive(txbuf, sizeof(txbuf)); - printf("n = %d\r\n", n); - slave_h = master.write(0x55); - printf("slave_h = char:%c, dec:%d, hex:%x\r\n", slave_h, slave_h, slave_h); - if(slave_h==0x55) + if(n >= 0) { - printf("check loop slave_h if\r\n"); - length = master.write(0x01); - printf("length = char:%c, dec:%d, hex:%x\r\n", length, length, length); - for(i=0; i<length; i++) - { - rxbuf[i]=master.write(0x00); - printf("rxbuf[%d] = char:%c, dec:%d, hex:%x\r\n", i, rxbuf[i], rxbuf[i], rxbuf[i]); - } - socket.send(rxbuf, strlen(rxbuf)); - } - if(n > 0) - { - printf("check loop n if\r\n"); for(i=0; i<n; i++) { - master.write(txbuf[i]); - printf("check loop for\r\n"); + master.write(txbuf[i]); } - memset(txbuf, 0, strlen(txbuf)); - closecount=0; } } }