/** * @brief task who manage ethernet communication * @param None * @retval None */ void ethernet_task(void *pdata) { #if 1 pdata=pdata; // initialize enc28j60 ES_enc28j60Init(&mymac[0]); /* Magjack leds configuration, see enc28j60 datasheet, page 11 */ // LEDB=yellow LEDA=green // // 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit // enc28j60PhyWrite(PHLCON,0b0000 0100 0111 01 10); enc28j60PhyWrite(PHLCON,0x476); init_udp_or_www_server(&mymac[0],&myip[0]); //ES_init_ip_arp_udp_tcp(mymac,myip,80); if( ES_enc28j60Revision() <= 0 ) { // Failed to access ENC28J60 while(1); // Just loop here } // Get IP Address details #if 0 if( allocateIPAddress(buf, BUFFER_SIZE, mymac, 80, myip, mynetmask, gwip, dhcpsvrip, dnsip ) > 0 ) { // Display the results: } else { // Failed to get IP address" while(1); } #endif #endif for(;;) { #if 1 ethernet_process(); #endif } }
/** * Initialise the ENC28J60 using default chip select pin */ void EtherShield::ES_enc28j60Init(uint8_t* macaddr){ ES_enc28j60Init(macaddr, DEFAULT_ENC28J60_CONTROL_CS ); }