Changeset 59

Show
Ignore:
Timestamp:
11/05/07 03:16:40 (13 months ago)
Author:
follower
Message:

Remove initial pre-driver-port code that configured the module via SPI with a network configuration to enable a ping test. Includes code to communicate via SPI and to read address/register/memory locations. Remove associated code credit for spi_transfer from playground. All these functions are now implemented within the driver itself. TODO: Could we implement the driver SPI comms in a more efficient manner?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/follower/wiz810mj/src/demo/WizDemo1/WizDemo1.pde

    r58 r59  
    3535     LGPL 
    3636      
    37      (Although note spi_transfer comes from the Playground originally.) 
    38  
    3937  Version: 
    4038   
     
    113111  Serial.println("Reset triggered..."); 
    114112   
    115   /*   
    116   Serial.println("Configure device..."); 
    117    
    118   // default gateway 
    119   writeAddressValue(0x00, 0x01, 0xC0); 
    120   writeAddressValue(0x00, 0x02, 0xA8); 
    121   writeAddressValue(0x00, 0x03, 0x02); 
    122   writeAddressValue(0x00, 0x04, 0x65); 
    123    
    124   // subnet mask 
    125   writeAddressValue(0x00, 0x05, 0xFF); 
    126   writeAddressValue(0x00, 0x06, 0xFF); 
    127   writeAddressValue(0x00, 0x07, 0xFF); 
    128   writeAddressValue(0x00, 0x08, 0x00); 
    129          
    130   // source hardware address (MAC?) 
    131   writeAddressValue(0x00, 0x09, 0x00); 
    132   writeAddressValue(0x00, 0x0A, 0xDE); 
    133   writeAddressValue(0x00, 0x0B, 0xAD); 
    134   writeAddressValue(0x00, 0x0C, 0xBE); 
    135   writeAddressValue(0x00, 0x0D, 0xEF); 
    136   writeAddressValue(0x00, 0x0E, 0x00); 
    137  
    138   // source ip address 
    139    
    140   writeAddressValue(0x00, 0x0F, 0xC0); 
    141   writeAddressValue(0x00, 0x10, 0xA8); 
    142   writeAddressValue(0x00, 0x11, 0x02); 
    143   writeAddressValue(0x00, 0x12, 0x69); 
    144    
    145    
    146   // Serial.println("SKIP: source ip address"); 
    147    
    148   Serial.println("End configure device..."); 
    149   */   
    150113 
    151114  // driver chip init (Might be redundant with the above reset.) 
     
    186149} 
    187150 
    188 byte readAddressValue(byte addressHiByte, byte addressLowByte) { 
    189  // TODO: use a word for the address instead  
    190    
    191  byte data = 0x00; 
    192   
    193  digitalWrite(PIN_SLAVE_SELECT, LOW); // Enable slave 
    194   
    195  // TODO: Check response values? e.g. 0x00, 0x01, 0x02 
    196  spi_transfer(WIZNET_OPCODE_READ); 
    197  spi_transfer(addressHiByte); 
    198  spi_transfer(addressLowByte); 
    199  
    200  data = spi_transfer(DUMMY_DATA); 
    201  
    202  digitalWrite(PIN_SLAVE_SELECT, HIGH); // Disable slave 
    203    
    204  return data; 
    205 } 
    206  
    207  
    208 void writeAddressValue(byte addressHiByte, byte addressLowByte, byte targetValue) { 
    209  // TODO: use a word for the address instead  
    210    
    211  digitalWrite(PIN_SLAVE_SELECT, LOW); // Enable slave 
    212   
    213  // TODO: Check response values? e.g. 0x00, 0x01, 0x02 
    214  spi_transfer(WIZNET_OPCODE_WRITE); 
    215  spi_transfer(addressHiByte); 
    216  spi_transfer(addressLowByte); 
    217  
    218  spi_transfer(targetValue); 
    219  
    220  digitalWrite(PIN_SLAVE_SELECT, HIGH); // Disable slave   
    221 } 
    222  
    223 // From Playground 
    224 char spi_transfer(volatile char data) 
    225 { 
    226   SPDR = data;                    // Start the transmission 
    227   while (!(SPSR & (1<<SPIF)))     // Wait for the end of the transmission 
    228   { 
    229   }; 
    230   return SPDR;                    // return the received byte 
    231 } 
    232  
    233151void sendPrompt(uint8_t *buffer) { // {Socket targetSocket, ) { 
    234152  buffer[0] = 'w';