static void transfer(uint8_t* send, uint8_t * recv, uint8_t len) { while(platform_gpio_read( PIN_GPIO2 ) == 0); if(recv == NULL) { while(len --) { platform_spi_send_recv(1, *send++); } return; } while(len --) { *recv++ = platform_spi_send_recv(1, *send++); } }
static u16 SPIRead( u8 *pdata, u16 size ) { u16 i; for( i = 0; i < size; i ++ ) pdata[ i ] = platform_spi_send_recv( ENC28J60_SPI_ID, 0xFF ); return size; }
static u16 SPIWrite( u8 *pdata, u16 size ) { u16 i; for( i = 0; i < size; i ++ ) platform_spi_send_recv( ENC28J60_SPI_ID, pdata[ i ] ); return size; }
static void plisp_spih_prin(unsigned id, any x) { if (!isNil(x)) { if (isNum(x)) outNum_spi(id, unBox(x)); else if (isSym(x)) { int i, c; word w; u8 byte; for (x = name(x), c = getByte1(&i, &w, &x); c; c = getByte(&i, &w, &x)) { if (c != '^') { byte = c; platform_spi_send_recv(id, byte); } else if (!(c = getByte(&i, &w, &x))) { byte = '^'; platform_spi_send_recv(id, byte); } else if (c == '?') { byte = 127; platform_spi_send_recv(id, byte); } else { c &= 0x1F; byte = (u8)c; platform_spi_send_recv(id, byte); } } } else { while (plisp_spih_prin(id, car(x)), !isNil(x = cdr(x))) { if (!isCell(x)) { plisp_spih_prin(id, x); break; } } } } }
static void outString_spi(unsigned id, char *s) { while (*s) platform_spi_send_recv(id, *s++); }