浏览代码

Reworked constructor.

woollybah 5 年之前
父节点
当前提交
8eedd4c8e7
共有 2 个文件被更改,包括 4 次插入15 次删除
  1. 0 3
      core.mod/gpio/gpiodriver.bmx
  2. 4 12
      pcx857x.mod/pcx857x.bmx

+ 0 - 3
core.mod/gpio/gpiodriver.bmx

@@ -28,9 +28,6 @@ Import "../common.bmx"
 
 Type TGpioDriver Implements IDisposable Abstract
 
-	Method Initialize()
-	End Method
-	
 	Method PinCount:Int() Abstract
 	
 	Method ConvertPinNumberToLogicalNumberingScheme:Int(pinNumber:Int) Abstract

+ 4 - 12
pcx857x.mod/pcx857x.bmx

@@ -14,7 +14,7 @@ Type TPcx857x Extends TGpioDriver
 	
 	Field pinValues:Short
 	
-	Method New(device:TI2cDevice, interrupt:Int = -1, gpioController:TGpioController = Null)
+	Method Create:TPcx857x(device:TI2cDevice, interrupt:Int = -1, gpioController:TGpioController = Null)
 		If Not device Then
 			Throw New TArgumentNullException("device")
 		End If
@@ -28,9 +28,7 @@ Type TPcx857x Extends TGpioDriver
 			End If
 			masterGpioController.OpenPin(interrupt, EpinMode.Input)
 		End If
-	End Method
-	
-	Method Initialize()
+
 		' These controllers do not have commands, setting the pins to high designates
 		' them as able to recieve input. As we don't want to set high on pins intended
 		' for output we'll set all of the pins to low for our initial state.
@@ -41,6 +39,8 @@ Type TPcx857x Extends TGpioDriver
 		End If
 		
 		pinModes = $FFFF	
+
+		Return Self
 	End Method
 	
 	Method ReadByte:Byte()
@@ -202,10 +202,6 @@ bbdoc: Base class for 8 bit I/O expanders.
 End Rem
 Type TPcx8574 Extends TPcx857x Abstract
 
-	Method New(device:TI2cDevice, interrupt:Int = -1, gpioController:TGpioController = Null)
-		Super.New(device, interrupt, gpioController)
-	End Method
-
 	Method PinCount:Int()
 		Return 8
 	End Method
@@ -217,8 +213,4 @@ bbdoc: Remote 8-bit I/O expander for I2C-bus with interrupt.
 End Rem
 Type TPcf8574 Extends TPcx8574
 
-	Method New(device:TI2cDevice, interrupt:Int = -1, gpioController:TGpioController = Null)
-		Super.New(device, interrupt, gpioController)
-	End Method
-
 End Type