Changeset 90

Show
Ignore:
Timestamp:
12/08/07 01:15:56 (13 months ago)
Author:
follower
Message:

Move network module initialisation into class.

Files:
1 modified

Legend:

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

    r89 r90  
    9999/* ------ WIZ810MJ ------ */ 
    100100 
    101 class Wiz810MJ { 
     101class Wiz810MjDevice { 
    102102   
    103103  public: 
    104     Wiz810MJ(int resetPin); 
     104    Wiz810MjDevice(int resetPin); 
    105105   
    106106  private: 
     107    void _init(void); 
     108     
    107109    int _resetPin;   
    108110}; 
    109111 
    110 Wiz810MJ::Wiz810MJ(int resetPin) { 
     112 
     113Wiz810MjDevice::Wiz810MjDevice(int resetPin) { 
    111114  // TODO: We should really allow the chip-select pin to be set here? 
    112115  //       Or require that it's defined. (Currently in the library file 'types.h'.) 
    113116  _resetPin = resetPin; 
    114 } 
    115  
    116 /* ----------------------- */ 
    117  
    118  
    119 // #define PIN_RESET 9 // WIZnet module /RESET 
    120  
    121 #define PIN_RESET 8 // WIZnet module /RESET 
    122  
    123 SOCKET testSocket; 
    124 byte ip[6]; 
    125  
    126  
    127 void initModule() { 
     117   
     118  _init(); 
     119} 
     120 
     121 
     122void Wiz810MjDevice::_init(void) { 
    128123  /* 
    129124   
     
    139134      seems not to be the case.) 
    140135   */    
    141   pinMode(PIN_RESET, OUTPUT); 
     136  pinMode(_resetPin, OUTPUT); 
    142137   
    143138  // We rely on the time between function calls to 
    144139  // be long enough for the chip to recognise the 
    145140  // reset. 
    146   digitalWrite(PIN_RESET, HIGH); 
    147   digitalWrite(PIN_RESET, LOW); // reset 
    148   digitalWrite(PIN_RESET, HIGH); 
     141  digitalWrite(_resetPin, HIGH); 
     142  digitalWrite(_resetPin, LOW); // reset 
     143  digitalWrite(_resetPin, HIGH); 
    149144   
    150145  // Chip initialisation by driver 
     
    157152  // internally by the driver--even if the default chip 
    158153  // configuration is used.) 
    159   sysinit(0x55, 0x55); 
    160    
    161 } 
     154  sysinit(0x55, 0x55);   
     155} 
     156 
     157/* ----------------------- */ 
     158 
     159 
     160// #define PIN_RESET 9 // WIZnet module /RESET 
     161 
     162#define PIN_RESET 8 // WIZnet module /RESET 
     163 
     164SOCKET testSocket; 
     165byte ip[6]; 
     166 
    162167 
    163168#define PIN_LED 2 
     
    169174  SPI.begin();     
    170175   
    171   initModule(); 
     176  Wiz810MjDevice WIZ810MJ = Wiz810MjDevice(PIN_RESET); 
    172177 
    173178  Serial.println("Test W5100 configuration...");