diff --git a/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde b/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde index 2214941..e780f3d 100644 --- a/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde +++ b/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde @@ -98,33 +98,28 @@ SpiConfiguration SPI = SpiConfiguration(); /* ------ WIZ810MJ ------ */ -class Wiz810MJ { +class Wiz810MjDevice { public: - Wiz810MJ(int resetPin); + Wiz810MjDevice(int resetPin); private: + void _init(void); + int _resetPin; }; -Wiz810MJ::Wiz810MJ(int resetPin) { + +Wiz810MjDevice::Wiz810MjDevice(int resetPin) { // TODO: We should really allow the chip-select pin to be set here? // Or require that it's defined. (Currently in the library file 'types.h'.) _resetPin = resetPin; + + _init(); } -/* ----------------------- */ - - -// #define PIN_RESET 9 // WIZnet module /RESET - -#define PIN_RESET 8 // WIZnet module /RESET - -SOCKET testSocket; -byte ip[6]; - -void initModule() { +void Wiz810MjDevice::_init(void) { /* Initialise the WIZ810MJ module and driver. @@ -138,14 +133,14 @@ void initModule() { to function without a hardware reset but it seems not to be the case.) */ - pinMode(PIN_RESET, OUTPUT); + pinMode(_resetPin, OUTPUT); // We rely on the time between function calls to // be long enough for the chip to recognise the // reset. - digitalWrite(PIN_RESET, HIGH); - digitalWrite(PIN_RESET, LOW); // reset - digitalWrite(PIN_RESET, HIGH); + digitalWrite(_resetPin, HIGH); + digitalWrite(_resetPin, LOW); // reset + digitalWrite(_resetPin, HIGH); // Chip initialisation by driver // Might be redundant following the above reset, @@ -156,10 +151,20 @@ void initModule() { // (This is required to configure some variables used // internally by the driver--even if the default chip // configuration is used.) - sysinit(0x55, 0x55); - + sysinit(0x55, 0x55); } +/* ----------------------- */ + + +// #define PIN_RESET 9 // WIZnet module /RESET + +#define PIN_RESET 8 // WIZnet module /RESET + +SOCKET testSocket; +byte ip[6]; + + #define PIN_LED 2 void setup () { @@ -168,7 +173,7 @@ void setup () { SPI.begin(); - initModule(); + Wiz810MjDevice WIZ810MJ = Wiz810MjDevice(PIN_RESET); Serial.println("Test W5100 configuration...");