@ -34,8 +34,6 @@
LGPL
(Although note spi_transfer comes from the Playground originally.)
Version:
20071106-0005
@ -112,41 +110,6 @@ void setup () {
//delay(10);
Serial.println("Reset triggered...");
/*
Serial.println("Configure device...");
// default gateway
writeAddressValue(0x00, 0x01, 0xC0);
writeAddressValue(0x00, 0x02, 0xA8);
writeAddressValue(0x00, 0x03, 0x02);
writeAddressValue(0x00, 0x04, 0x65);
// subnet mask
writeAddressValue(0x00, 0x05, 0xFF);
writeAddressValue(0x00, 0x06, 0xFF);
writeAddressValue(0x00, 0x07, 0xFF);
writeAddressValue(0x00, 0x08, 0x00);
// source hardware address (MAC?)
writeAddressValue(0x00, 0x09, 0x00);
writeAddressValue(0x00, 0x0A, 0xDE);
writeAddressValue(0x00, 0x0B, 0xAD);
writeAddressValue(0x00, 0x0C, 0xBE);
writeAddressValue(0x00, 0x0D, 0xEF);
writeAddressValue(0x00, 0x0E, 0x00);
// source ip address
writeAddressValue(0x00, 0x0F, 0xC0);
writeAddressValue(0x00, 0x10, 0xA8);
writeAddressValue(0x00, 0x11, 0x02);
writeAddressValue(0x00, 0x12, 0x69);
// Serial.println("SKIP: source ip address");
Serial.println("End configure device...");
*/
// driver chip init (Might be redundant with the above reset.)
Serial.println("Call iinchip_init...");
@ -185,51 +148,6 @@ void setup () {
}
byte readAddressValue(byte addressHiByte, byte addressLowByte) {
// TODO: use a word for the address instead
byte data = 0x00;
digitalWrite(PIN_SLAVE_SELECT, LOW); // Enable slave
// TODO: Check response values? e.g. 0x00, 0x01, 0x02
spi_transfer(WIZNET_OPCODE_READ);
spi_transfer(addressHiByte);
spi_transfer(addressLowByte);
data = spi_transfer(DUMMY_DATA);
digitalWrite(PIN_SLAVE_SELECT, HIGH); // Disable slave
return data;
}
void writeAddressValue(byte addressHiByte, byte addressLowByte, byte targetValue) {
// TODO: use a word for the address instead
digitalWrite(PIN_SLAVE_SELECT, LOW); // Enable slave
// TODO: Check response values? e.g. 0x00, 0x01, 0x02
spi_transfer(WIZNET_OPCODE_WRITE);
spi_transfer(addressHiByte);
spi_transfer(addressLowByte);
spi_transfer(targetValue);
digitalWrite(PIN_SLAVE_SELECT, HIGH); // Disable slave
}
// From Playground
char spi_transfer(volatile char data)
{
SPDR = data; // Start the transmission
while (!(SPSR & (1<<SPIF))) // Wait for the end of the transmission
{
};
return SPDR; // return the received byte
}
void sendPrompt(uint8_t *buffer) { // {Socket targetSocket, ) {
buffer[0] = 'w';
buffer[1] = '0';