/// <summary> /// Constructor for a single mikroBUS socket. /// </summary> /// <param name="num">Socket number.</param> /// <param name="shield">mikroBUS shield kind. /// <c>Shield.Kinds.Unknown</c> indicates automatic detection using /// using the <c>Shield.kind</c> property.</param> public Socket(int num, Shield.Kinds shield = Shield.Kinds.Unknown) { if (shield == Shield.Kinds.Unknown) { shield = Shield.kind; } // Search for matching shield and socket number for (int i = 0; i < SocketTable.Length; i++) { if ((SocketTable[i].shield == shield) && (SocketTable[i].num == num)) { myInfo = SocketTable[i]; if (myInfo.ShareI2C && (Shield.I2CBus == null)) { // Initialize the shared I2C bus object Shield.I2CBus = new IO.Objects.libsimpleio.I2C.Bus(myInfo.I2CBus); } return; } } throw new System.Exception("Unable to find matching shield and socket number."); }
public SocketEntry( Shield.Kinds shield, int num, bool ShareI2C, // mikroBUS GPIO pins IO.Objects.libsimpleio.Device.Designator AN, IO.Objects.libsimpleio.Device.Designator RST, IO.Objects.libsimpleio.Device.Designator CS, IO.Objects.libsimpleio.Device.Designator SCK, IO.Objects.libsimpleio.Device.Designator MISO, IO.Objects.libsimpleio.Device.Designator MOSI, IO.Objects.libsimpleio.Device.Designator SDA, IO.Objects.libsimpleio.Device.Designator SCL, IO.Objects.libsimpleio.Device.Designator TX, IO.Objects.libsimpleio.Device.Designator RX, IO.Objects.libsimpleio.Device.Designator INT, IO.Objects.libsimpleio.Device.Designator PWM, // mikroBUS devices IO.Objects.libsimpleio.Device.Designator AIN, IO.Objects.libsimpleio.Device.Designator I2CBus, IO.Objects.libsimpleio.Device.Designator PWMOut, IO.Objects.libsimpleio.Device.Designator SPIDev, string UART) { this.shield = shield; this.num = num; this.ShareI2C = ShareI2C; // mikroBUS GPIO pins this.AN = AN; this.RST = RST; this.CS = CS; this.SCK = SCK; this.MISO = MISO; this.MOSI = MOSI; this.SDA = SDA; this.SCL = SCL; this.TX = TX; this.RX = RX; this.INT = INT; this.PWM = PWM; // mikroBUS devices this.AIN = AIN; this.I2CBus = I2CBus; this.PWMOut = PWMOut; this.SPIDev = SPIDev; this.UART = UART; }
public SocketEntry( Shield.Kinds shield, int num, bool ShareI2C, // mikroBUS GPIO pins int AN, int RST, int CS, int SCK, int MISO, int MOSI, int SDA, int SCL, int TX, int RX, int INT, int PWM, // mikroBUS devices int AIN, int I2CBus, int PWMOut, int SPIDev) { this.shield = shield; this.num = num; this.ShareI2C = ShareI2C; // mikroBUS GPIO pins this.AN = AN; this.RST = RST; this.CS = CS; this.SCK = SCK; this.MISO = MISO; this.MOSI = MOSI; this.SDA = SDA; this.SCL = SCL; this.TX = TX; this.RX = RX; this.INT = INT; this.PWM = PWM; // mikroBUS devices this.AIN = AIN; this.I2CBus = I2CBus; this.PWMOut = PWMOut; this.SPIDev = SPIDev; }
/// <summary> /// Constructor for a single mikroBUS socket. /// </summary> /// <param name="num">Socket number.</param> /// <param name="shield">mikroBUS shield kind. Zero /// indicates automatic detection using the <c>Shield.kind</c> /// property.</param> public Socket(int num, Shield.Kinds shield = Shield.Kinds.Unknown) { if (shield == Shield.Kinds.Unknown) { shield = Shield.kind; } // Search for matching shield and socket number for (int i = 0; i < SocketTable.Length; i++) { if ((SocketTable[i].shield == shield) && (SocketTable[i].num == num)) { myInfo = SocketTable[i]; return; } } throw new System.Exception("Unable to find matching shield and socket number."); }