Changeset 10674 for firmware/FSC/src/w5100_spi_interface.c
- Timestamp:
- 05/12/11 10:15:41 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FSC/src/w5100_spi_interface.c
r10667 r10674 9 9 10 10 //----------------------------------------------------------------------------- 11 // INTERFACE CONTROL VARS 12 13 bool w5100_needs_reset = true; 14 bool w5100_needs_init = true; 15 bool w5100_ready = false; 16 17 U08 w5100_caretaker() { 18 U08 socket_status; 19 if (w5100_needs_reset) 20 w5100_reset(); 21 22 socket_status = w5100_sock_status(); 23 24 if (socket_status == SR_SOCK_ESTABLISHED) { 25 w5100_ready = true; 26 // everything is fine... 27 return 0; 28 } 29 else if(socket_status < SR_SOCK_ESTABLISHED) { 30 // it might be LISTENING ... or not even OPEN 31 if (socket_status == SR_SOCK_CLOSED) { 32 w5100_init(); 33 } 34 if (socket_status == SR_SOCK_INIT) { 35 w5100_init(); 36 } 37 if (socket_status == SR_SOCK_LISTEN) { 38 39 } 40 } 41 else { // all other socket states need a reset 42 w5100_needs_reset = true; 43 } 44 w5100_ready = false; 45 return 1; 46 } 47 48 void w5100_reset() { 49 PORTB &= ~(1<<PB2); //#reset = LOW --> W5100 is in reset ... 50 _delay_ms(50); //reset 51 52 PORTB |= 1<<PB2; //#reset = HIGH --> W5100 is active 53 _delay_ms(5); // give it 5ms to accomodate. 54 w5100_needs_reset = false; 55 } 56 11 57 12 58 void w5100_write( U16 addr, U08 data)
Note:
See TracChangeset
for help on using the changeset viewer.