/// <summary> /// /// </summary> /// <param name="device"></param> /// <param name="interruptPort"></param> internal Mcp23x08( IMcpDeviceComms device, GpioPin interruptPort = null) { Setup(device, interruptPort); }
void Setup(IMcpDeviceComms device, GpioPin interruptPort = null) { // save our interrupt pin this._interruptPort = interruptPort; // TODO: more interrupt stuff to solve // at a minimum, we need to check the interrupt mode and make sure // it's correct, raise an exception if not. also, doc in constructor // what we expect from an interrupt port. //this._interruptPort.InterruptMode = InterruptMode.EdgeRising; if (this._interruptPort != null) { this._interruptPort.ValueChanged += _interruptPort_ValueChanged; } _inputPorts = new Hashtable(); //new Dictionary<int, DigitalInputPort>(); _mcpDevice = device; Initialize(); }
/// <summary> /// /// </summary> /// <param name="device"></param> /// <param name="interruptPort"></param> internal Mcp23x08( IMcpDeviceComms device, IDigitalInputPort interruptPort = null) { // save our interrupt pin this._interruptPort = interruptPort; // TODO: more interrupt stuff to solve // at a minimum, we need to check the interrupt mode and make sure // it's correct, raise an exception if not. also, doc in constructor // what we expect from an interrupt port. //this._interruptPort.InterruptMode = InterruptMode.EdgeRising; if (this._interruptPort != null) { this._interruptPort.Changed += HandleChangedInterrupt; } _inputPorts = new Dictionary <IPin, DigitalInputPort>(); _mcpDevice = device; Initialize(); }