Example #1
0
        // The mainboard constructor gets called before anything else in Gadgeteer (module constructors, etc),
        // so it can set up fields in Gadgeteer.dll specifying socket types supported, etc.

        /// <summary>
        /// Instantiates a new FEZSpider mainboard
        /// </summary>
        public FEZSpider()
        {
            // uncomment the following if you support NativeI2CWriteRead for faster DaisyLink performance
            // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.
            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(NativeI2CWriteRead);

            this.NativeBitmapConverter = new BitmapConvertBPP(BitmapConverter);

            // For each socket on the mainboard, create, configure and register a Socket object with Gadgeteer.dll
            // This specifies:
            // - the SupportedTypes character array matching the list on the mainboard
            // - the CpuPins array (indexes [3] to [9].  [1,2,10] are constant (3.3V, 5V, GND) and [0] is unused.  This is normally based on an enumeration supplied in the NETMF port used.
            // - for other functionality, e.g. UART, SPI, etc, properties in the Socket class are set as appropriate to enable Gadgeteer.dll to access this functionality.
            // See the Mainboard Builder's Guide and specifically the Socket Types specification for more details
            // The two examples below are not realistically implementable sockets, but illustrate how to initialize a wide range of socket functionality.

            // This example socket 1 supports many types
            // Type 'D' - no additional action
            // Type 'I' - I2C pins must be used for the correct CpuPins
            // Type 'K' and 'U' - UART pins and UART handshaking pins must be used for the correct CpuPins, and the SerialPortName property must be set.
            // Type 'S' - SPI pins must be used for the correct CpuPins, and the SPIModule property must be set
            // Type 'X' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            #region Example Sockets
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            //socket.SupportedTypes = new char[] { 'D', 'I', 'K', 'S', 'U', 'X' };
            //socket.CpuPins[3] = (Cpu.Pin)1;
            //socket.CpuPins[4] = (Cpu.Pin)52;
            //socket.CpuPins[5] = (Cpu.Pin)23;
            //socket.CpuPins[6] = (Cpu.Pin)12;
            //socket.CpuPins[7] = (Cpu.Pin)34;
            //socket.CpuPins[8] = (Cpu.Pin)5;
            //socket.CpuPins[9] = (Cpu.Pin)7;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.SerialPortName = "COM1";
            //socket.SPIModule = SPI.SPI_module.SPI1;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);

            //// This example socket 2 supports many types
            //// Type 'A' - AnalogInput3-5 properties are set and GT.Socket.SocketInterfaces.SetAnalogInputFactors call is made
            //// Type 'O' - AnalogOutput property is set
            //// Type 'P' - PWM7-9 properties are set
            //// Type 'Y' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            //socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            //socket.CpuPins[3] = (Cpu.Pin)11;
            //socket.CpuPins[4] = (Cpu.Pin)5;
            //socket.CpuPins[5] = (Cpu.Pin)3;
            //socket.CpuPins[6] = (Cpu.Pin)66;
            //// Pin 7 not connected on this socket, so it is left unspecified
            //socket.CpuPins[8] = (Cpu.Pin)59;
            //socket.CpuPins[9] = (Cpu.Pin)18;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.AnalogOutput = new FEZSpider_AnalogOut((Cpu.Pin)14);
            //GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 1, 2, 10);
            //socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_2;
            //socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_3;
            //socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_1;
            //socket.PWM7 = Cpu.PWMChannel.PWM_3;
            //socket.PWM8 = Cpu.PWMChannel.PWM_0;
            //socket.PWM9 = Cpu.PWMChannel.PWM_2;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion

            #region Socket Setup
            // Create sockets.  Use the same socket variable to avoid copy-paste errors that often happen if we use socket1, socket2, etc.
            GT.Socket socket;

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'D', 'I' };
            socket.CpuPins[3]     = EMX.Pin.IO21;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.USBD_DM;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.USBD_DP;
            socket.CpuPins[6]     = EMX.Pin.IO19;
            socket.CpuPins[7]     = EMX.Pin.IO75;
            socket.CpuPins[8]     = EMX.Pin.IO12;
            socket.CpuPins[9]     = EMX.Pin.IO11;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes = new char[] { 'Z' };
            socket.CpuPins[3]     = (Cpu.Pin)SpecialPurposePin.RESET;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.TCK;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.RTC_BATT;
            socket.CpuPins[6]     = (Cpu.Pin)SpecialPurposePin.TDO;
            socket.CpuPins[7]     = (Cpu.Pin)SpecialPurposePin.TRST;
            socket.CpuPins[8]     = (Cpu.Pin)SpecialPurposePin.TMS;
            socket.CpuPins[9]     = (Cpu.Pin)SpecialPurposePin.TDI;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes = new char[] { 'H', 'I' };
            socket.CpuPins[3]     = EMX.Pin.IO1;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.USBH_DM;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.USBH_DP;
            socket.CpuPins[6]     = EMX.Pin.IO0;
            socket.CpuPins[8]     = EMX.Pin.IO12;
            socket.CpuPins[9]     = EMX.Pin.IO11;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new char[] { 'I', 'K', 'U', 'X' };
            socket.CpuPins[3]     = EMX.Pin.IO33;
            socket.CpuPins[4]     = EMX.Pin.IO37;
            socket.CpuPins[5]     = EMX.Pin.IO32;
            socket.CpuPins[6]     = EMX.Pin.IO31;
            socket.CpuPins[7]     = EMX.Pin.IO34;
            socket.CpuPins[8]     = EMX.Pin.IO12;
            socket.CpuPins[9]     = EMX.Pin.IO11;

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            // K/U
            socket.SerialPortName = "COM2";

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(5);
            socket.SupportedTypes     = new char[] { 'F', 'Y' };
            socket.CpuPins[3]         = EMX.Pin.IO23;
            socket.CpuPins[4]         = EMX.Pin.IO43;
            socket.CpuPins[5]         = EMX.Pin.IO41;
            socket.CpuPins[6]         = EMX.Pin.IO44;
            socket.CpuPins[7]         = EMX.Pin.IO40;
            socket.CpuPins[8]         = EMX.Pin.IO39;
            socket.CpuPins[9]         = EMX.Pin.IO42;
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'C', 'S', 'Y' };
            socket.CpuPins[3]     = EMX.Pin.IO18;
            socket.CpuPins[4]     = EMX.Pin.IO20;
            socket.CpuPins[5]     = EMX.Pin.IO22;
            socket.CpuPins[6]     = EMX.Pin.IO10;
            socket.CpuPins[7]     = EMX.Pin.IO36;
            socket.CpuPins[8]     = EMX.Pin.IO38;
            socket.CpuPins[9]     = EMX.Pin.IO35;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            // S
            socket.SPIModule = SPI.SPI_module.SPI2;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(7);
            socket.SupportedTypes = new char[] { 'E' };
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.LED_SPEED;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.LED_LINK;
            socket.CpuPins[6]     = (Cpu.Pin)SpecialPurposePin.ETH_TX_DM;
            socket.CpuPins[7]     = (Cpu.Pin)SpecialPurposePin.ETH_TX_DP;
            socket.CpuPins[8]     = (Cpu.Pin)SpecialPurposePin.ETH_RX_DM;
            socket.CpuPins[9]     = (Cpu.Pin)SpecialPurposePin.ETH_RX_DP;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(8);
            socket.SupportedTypes = new char[] { 'P', 'U', 'Y' };
            socket.CpuPins[3]     = EMX.Pin.IO30;
            socket.CpuPins[4]     = EMX.Pin.IO29;
            socket.CpuPins[5]     = EMX.Pin.IO28;
            socket.CpuPins[6]     = EMX.Pin.IO16;
            socket.CpuPins[7]     = EMX.Pin.IO74;
            socket.CpuPins[8]     = EMX.Pin.IO48;
            socket.CpuPins[9]     = EMX.Pin.IO49;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            // U
            socket.SerialPortName = "COM3";

            // P
            socket.PWM7 = Cpu.PWMChannel.PWM_5;
            socket.PWM8 = Cpu.PWMChannel.PWM_4;
            socket.PWM9 = Cpu.PWMChannel.PWM_3;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(9);
            socket.SupportedTypes = new char[] { 'A', 'O', 'S', 'U', 'Y' };
            socket.CpuPins[3]     = EMX.Pin.IO46;
            socket.CpuPins[4]     = EMX.Pin.IO6;
            socket.CpuPins[5]     = EMX.Pin.IO7;
            socket.CpuPins[6]     = EMX.Pin.IO15;
            socket.CpuPins[7]     = EMX.Pin.IO24;
            socket.CpuPins[8]     = EMX.Pin.IO25;
            socket.CpuPins[9]     = EMX.Pin.IO27;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            // U
            socket.SerialPortName = "COM4";

            // S
            socket.SPIModule = SPI.SPI_module.SPI1;

            // O
            socket.AnalogOutput = new FEZSpider_AnalogOut((Cpu.Pin)socket.CpuPins[5]);

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_7;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_2;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_3;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(10);
            socket.SupportedTypes = new char[] { 'A', 'I', 'T', 'X' };
            socket.CpuPins[3]     = EMX.Pin.IO45;
            socket.CpuPins[4]     = EMX.Pin.IO5;
            socket.CpuPins[5]     = EMX.Pin.IO8;
            socket.CpuPins[6]     = EMX.Pin.IO73;
            socket.CpuPins[7]     = EMX.Pin.IO72;
            socket.CpuPins[8]     = EMX.Pin.IO12;
            socket.CpuPins[9]     = EMX.Pin.IO11;

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_6;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_1;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_0;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(11);
            socket.SupportedTypes = new char[] { 'P', 'U', 'Y' };
            socket.CpuPins[3]     = EMX.Pin.IO26;
            socket.CpuPins[4]     = EMX.Pin.IO3;
            socket.CpuPins[5]     = EMX.Pin.IO2;
            socket.CpuPins[6]     = EMX.Pin.IO9;
            socket.CpuPins[7]     = EMX.Pin.IO14;
            socket.CpuPins[8]     = EMX.Pin.IO13;
            socket.CpuPins[9]     = EMX.Pin.IO50;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            // U
            socket.SerialPortName = "COM1";

            // P
            socket.PWM7 = Cpu.PWMChannel.PWM_1;
            socket.PWM8 = Cpu.PWMChannel.PWM_0;
            socket.PWM9 = Cpu.PWMChannel.PWM_2;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(12);
            socket.SupportedTypes = new char[] { 'B', 'Y' };
            socket.CpuPins[3]     = EMX.Pin.IO70;
            socket.CpuPins[4]     = EMX.Pin.IO57;
            socket.CpuPins[5]     = EMX.Pin.IO58;
            socket.CpuPins[6]     = EMX.Pin.IO59;
            socket.CpuPins[7]     = EMX.Pin.IO60;
            socket.CpuPins[8]     = EMX.Pin.IO63;
            socket.CpuPins[9]     = EMX.Pin.IO61;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(13);
            socket.SupportedTypes = new char[] { 'G' };
            socket.CpuPins[3]     = EMX.Pin.IO51;
            socket.CpuPins[4]     = EMX.Pin.IO52;
            socket.CpuPins[5]     = EMX.Pin.IO53;
            socket.CpuPins[6]     = EMX.Pin.IO54;
            socket.CpuPins[7]     = EMX.Pin.IO55;
            socket.CpuPins[8]     = EMX.Pin.IO56;
            socket.CpuPins[9]     = EMX.Pin.IO17;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(14);
            socket.SupportedTypes = new char[] { 'R', 'Y' };
            socket.CpuPins[3]     = EMX.Pin.IO69;
            socket.CpuPins[4]     = EMX.Pin.IO65;
            socket.CpuPins[5]     = EMX.Pin.IO66;
            socket.CpuPins[6]     = EMX.Pin.IO67;
            socket.CpuPins[7]     = EMX.Pin.IO68;
            socket.CpuPins[8]     = EMX.Pin.IO62;
            socket.CpuPins[9]     = EMX.Pin.IO64;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion
        }
Example #2
0
        // The mainboard constructor gets called before anything else in Gadgeteer (module constructors, etc),
        // so it can set up fields in Gadgeteer.dll specifying socket types supported, etc.

        /// <summary>
        /// Instantiates a new FEZHydra mainboard
        /// </summary>
        public FEZHydra()
        {
            // uncomment the following if you support NativeI2CWriteRead for faster DaisyLink performance
            // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.
            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(NativeI2CWriteRead);

            this.NativeBitmapConverter = new BitmapConvertBPP(BitmapConverter);

            //this.GetStorageDeviceVolumeNames = new GetStorageDeviceVolumeNamesDelegate(_GetStorageDeviceVolumeNames);
            //this.MountStorageDevice = new StorageDeviceDelegate(_MountStorageDevice);
            //this.UnmountStorageDevice = new StorageDeviceDelegate(_UnmountStorageDevice);

            GT.Socket socket;

            // For each socket on the mainboard, create, configure and register a Socket object with Gadgeteer.dll
            // This specifies:
            // - the SupportedTypes character array matching the list on the mainboard
            // - the CpuPins array (indexes [3] to [9].  [1,2,10] are constant (3.3V, 5V, GND) and [0] is unused.  This is normally based on an enumeration supplied in the NETMF port used.
            // - for other functionality, e.g. UART, SPI, etc, properties in the Socket class are set as appropriate to enable Gadgeteer.dll to access this functionality.
            // See the Mainboard Builder's Guide and specifically the Socket Types specification for more details
            // The two examples below are not realistically implementable sockets, but illustrate how to initialize a wide range of socket functionality.

            #region Example Sockets
            //// This example socket 1 supports many types
            //// Type 'D' - no additional action
            //// Type 'I' - I2C pins must be used for the correct CpuPins
            //// Type 'K' and 'U' - UART pins and UART handshaking pins must be used for the correct CpuPins, and the SerialPortName property must be set.
            //// Type 'S' - SPI pins must be used for the correct CpuPins, and the SPIModule property must be set
            //// Type 'X' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            //socket.SupportedTypes = new char[] { 'D', 'I', 'K', 'S', 'U', 'X' };
            //socket.CpuPins[3] = (Cpu.Pin)1;
            //socket.CpuPins[4] = (Cpu.Pin)52;
            //socket.CpuPins[5] = (Cpu.Pin)23;
            //socket.CpuPins[6] = (Cpu.Pin)12;
            //socket.CpuPins[7] = (Cpu.Pin)34;
            //socket.CpuPins[8] = (Cpu.Pin)5;
            //socket.CpuPins[9] = (Cpu.Pin)7;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.SerialPortName = "COM1";
            //socket.SPIModule = SPI.SPI_module.SPI1;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);

            //// This example socket 2 supports many types
            //// Type 'A' - AnalogInput3-5 properties are set and GT.Socket.SocketInterfaces.SetAnalogInputFactors call is made
            //// Type 'O' - AnalogOutput property is set
            //// Type 'P' - PWM7-9 properties are set
            //// Type 'Y' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            //socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            //socket.CpuPins[3] = (Cpu.Pin)11;
            //socket.CpuPins[4] = (Cpu.Pin)5;
            //socket.CpuPins[5] = (Cpu.Pin)3;
            //socket.CpuPins[6] = (Cpu.Pin)66;
            //// Pin 7 not connected on this socket, so it is left unspecified
            //socket.CpuPins[8] = (Cpu.Pin)59;
            //socket.CpuPins[9] = (Cpu.Pin)18;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.AnalogOutput = new FEZHydra_AnalogOut((Cpu.Pin)14);
            //GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 1, 2, 10);
            //socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_2;
            //socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_3;
            //socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_1;
            //socket.PWM7 = Cpu.PWMChannel.PWM_3;
            //socket.PWM8 = Cpu.PWMChannel.PWM_0;
            //socket.PWM9 = Cpu.PWMChannel.PWM_2;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion

            #region Socket 1
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'Z' };
            socket.CpuPins[3]     = (Cpu.Pin)SpecialPurposePin.RESET;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.TCK;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.RTC_BATT;
            socket.CpuPins[6]     = (Cpu.Pin)SpecialPurposePin.TDO;
            socket.CpuPins[7]     = (Cpu.Pin)SpecialPurposePin.TRST;
            socket.CpuPins[8]     = (Cpu.Pin)SpecialPurposePin.TMS;
            socket.CpuPins[9]     = (Cpu.Pin)SpecialPurposePin.TDI;

            // Z
            // N/A

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 1

            #region Socket 2
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes = new char[] { 'D' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PB19;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.USBD_DM;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.USBD_DP;
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PB18;
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PB22;
            socket.CpuPins[8]     = Cpu.Pin.GPIO_NONE;
            socket.CpuPins[9]     = Cpu.Pin.GPIO_NONE;

            // D
            // N/A

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 2

            #region Socket 3
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes = new char[] { 'S', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PB8;         //PWM0
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PB9;         //PWM1
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PB12;
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PB13;
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PA26;         //MOSI
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PA25;         //MISO
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PA27;         //SCK

            // S
            socket.SPIModule = SPI.SPI_module.SPI1;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 3

            #region Socket 4
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new char[] { 'S', 'U', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PB2;
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA11;         //TXD1
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA12;         //RXD1
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PB14;
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PA26;         //MOSI
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PA25;         //MISO
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PA27;         //SCK

            // S
            socket.SPIModule = SPI.SPI_module.SPI1;

            // U
            socket.SerialPortName = "COM3";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 4

            #region Socket 5
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(5);
            socket.SupportedTypes = new char[] { 'I', 'U', 'X' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PA9;         //RTS0
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA22;        //DTXD
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA21;        //DRXD
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PA10;        //CTS0
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.GPIO_NONE;   // Unused
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PA23;        // I2C_SDA
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PA24;        // I2C_SCL

            // I
            // N/A

            // U
            socket.SerialPortName = "COM1";

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 5

            #region Socket 6
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'I', 'K', 'U', 'X' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PD17;
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA13;         //TXD2
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA14;         //RXD2
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PA29;         //TXD2
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PA30;         //CTS2
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PA23;         //I2C_SDA
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PA24;         //I2C_SCL

            // I
            // N/A

            // K/U
            socket.SerialPortName = "COM4";

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 6

            #region Socket 7
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(7);
            socket.SupportedTypes = new char[] { 'P', 'U', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PD19;
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA6;         //TXD0
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA7;         //RXD0
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PD20;
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PD14;        //PWM0
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PD15;        //PWM1
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PD16;        //PWM2

            // P
            socket.PWM7 = Cpu.PWMChannel.PWM_0;
            socket.PWM8 = Cpu.PWMChannel.PWM_1;
            socket.PWM9 = Cpu.PWMChannel.PWM_2;

            // U
            socket.SerialPortName = "COM2";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 7

            #region Socket 8
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(8);
            socket.SupportedTypes = new char[] { 'F', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PD11;
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA0;         //MC_DA0
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA3;         //MC_DA1
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PA1;         //MC_CDA
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PA4;         //MC_DA2
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PA5;         //MC_DA3
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PA2;         //MC_CK

            // F
            // N/A

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 8

            #region Socket 9
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(9);
            socket.SupportedTypes = new char[] { 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PD9;
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PD10;
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PD12;        //PCK1
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PD1;         //AC97_FS
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PD3;         //AC97_TX
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PD4;         //AC97_RX
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PD2;         //AC97_CK

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 9

            #region Socket 10
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(10);
            socket.SupportedTypes = new char[] { 'R', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PC22;         //LCD_R0
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PC23;         //LCD_R1
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PC24;         //LCD_R2
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PC25;         //LCD_R3
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PC20;         //LCD_R4
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PC4;          //LCD_VSYNC
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PC5;          //LCD_HSYNC

            // R
            // N/A

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 10

            #region Socket 11
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(11);
            socket.SupportedTypes = new char[] { 'G', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PC15;         //LCD_G0
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PC16;         //LCD_G1
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PC17;         //LCD_G2
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PC18;         //LCD_G3
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PC19;         //LCD_G4
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PC21;         //LCD_G5
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PC3;          //LCD_PWM

            // G
            // N/A

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 11

            #region Socket 12
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(12);
            socket.SupportedTypes = new char[] { 'B', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PC9;         //LCD_B0
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PC10;        //LCD_B1
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PC11;        //LCD_B2
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PC12;        //LCD_B3
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PC13;        //LCD_B4
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PC7;         //LCD_EN
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PC6;         //LCD_CLK

            // B
            // N/A

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 12

            #region Socket 13
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(13);
            socket.SupportedTypes = new char[] { 'A', 'T', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PD6;         //GPAD4
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA20;        //AD3YM
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA18;        //AD1XM
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PB1;         //RXD3
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PB28;
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PB26;
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PB29;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_4;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_3;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_1;

            // T
            // N/A

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 13

            #region Socket 14
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(14);
            socket.SupportedTypes = new char[] { 'A', 'X' };
            socket.CpuPins[3]     = (Cpu.Pin)FEZHydra_Pins.PD7;         //GPAD5
            socket.CpuPins[4]     = (Cpu.Pin)FEZHydra_Pins.PA19;        //AD2YP
            socket.CpuPins[5]     = (Cpu.Pin)FEZHydra_Pins.PA17;        //AD0XP
            socket.CpuPins[6]     = (Cpu.Pin)FEZHydra_Pins.PB0;         //TXD3
            socket.CpuPins[7]     = (Cpu.Pin)FEZHydra_Pins.PB30;
            socket.CpuPins[8]     = (Cpu.Pin)FEZHydra_Pins.PB31;
            socket.CpuPins[9]     = (Cpu.Pin)FEZHydra_Pins.PB27;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_5;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_2;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_0;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 14
        }
        // The mainboard constructor gets called before anything else in Gadgeteer (module constructors, etc),
        // so it can set up fields in Gadgeteer.dll specifying socket types supported, etc.

        /// <summary>
        /// Instantiates a new GR_PEACH_IoT_Kit mainboard
        /// </summary>
        public GR_PEACH_IoT_Kit()
        {
            // uncomment the following if you support NativeI2CWriteRead for faster DaisyLink performance
            // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.
            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = null; // new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(NativeI2CWriteRead);


            GT.Socket socket;

            // For each socket on the mainboard, create, configure and register a Socket object with Gadgeteer.dll
            // This specifies:
            // - the SupportedTypes character array matching the list on the mainboard
            // - the CpuPins array (indexes [3] to [9].  [1,2,10] are constant (3.3V, 5V, GND) and [0] is unused.  This is normally based on an enumeration supplied in the NETMF port used.
            // - for other functionality, e.g. UART, SPI, etc, properties in the Socket class are set as appropriate to enable Gadgeteer.dll to access this functionality.
            // See the Mainboard Builder's Guide and specifically the Socket Types specification for more details
            // The two examples below are not realistically implementable sockets, but illustrate how to initialize a wide range of socket functionality.

            // This example socket 1 supports many types
            // Type 'D' - no additional action
            // Type 'I' - I2C pins must be used for the correct CpuPins
            // Type 'K' and 'U' - UART pins and UART handshaking pins must be used for the correct CpuPins, and the SerialPortName property must be set.
            // Type 'S' - SPI pins must be used for the correct CpuPins, and the SPIModule property must be set
            // Type 'X' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes     = new char[] { 'D', 'I', 'K', 'S', 'U', 'X' };
            socket.CpuPins[3]         = (Cpu.Pin) 1;
            socket.CpuPins[4]         = (Cpu.Pin) 52;
            socket.CpuPins[5]         = (Cpu.Pin) 23;
            socket.CpuPins[6]         = (Cpu.Pin) 12;
            socket.CpuPins[7]         = (Cpu.Pin) 34;
            socket.CpuPins[8]         = (Cpu.Pin) 5;
            socket.CpuPins[9]         = (Cpu.Pin) 7;
            socket.NativeI2CWriteRead = nativeI2C;
            socket.SerialPortName     = "COM1";
            socket.SPIModule          = SPI.SPI_module.SPI1;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            // This example socket 2 supports many types
            // Type 'A' - AnalogInput3-5 properties are set
            // Type 'O' - AnalogOutput property is set
            // Type 'P' - PWM7-9 properties are set
            // Type 'Y' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            socket.CpuPins[3]     = (Cpu.Pin) 11;
            socket.CpuPins[4]     = (Cpu.Pin) 5;
            socket.CpuPins[5]     = (Cpu.Pin) 3;
            socket.CpuPins[6]     = (Cpu.Pin) 66;
            // Pin 7 not connected on this socket, so it is left unspecified
            socket.CpuPins[8]         = (Cpu.Pin) 59;
            socket.CpuPins[9]         = (Cpu.Pin) 18;
            socket.NativeI2CWriteRead = nativeI2C;
            socket.AnalogInput3       = new GR_PEACH_IoT_Kit_AIN((Cpu.Pin) 12);
            socket.AnalogInput4       = new GR_PEACH_IoT_Kit_AIN((Cpu.Pin) 13);
            socket.AnalogInput5       = new GR_PEACH_IoT_Kit_AIN((Cpu.Pin) 14);
            socket.AnalogOutput       = new GR_PEACH_IoT_Kit_AnalogOut((Cpu.Pin) 14);
            socket.PWM7 = new GR_PEACH_IoT_Kit_PWM((Cpu.Pin) 17);
            socket.PWM8 = new GR_PEACH_IoT_Kit_PWM((Cpu.Pin) 18);
            socket.PWM9 = new GR_PEACH_IoT_Kit_PWM((Cpu.Pin) 19);
            GT.Socket.SocketInterfaces.RegisterSocket(socket);
        }
Example #4
0
        // The mainboard constructor gets called before anything else in Gadgeteer (module constructors, etc),
        // so it can set up fields in Gadgeteer.dll specifying socket types supported, etc.

        /// <summary>
        /// Instantiates a new FEZCerbuinoBee mainboard
        /// </summary>
        public FEZCerbuinoBee()
        {
            // uncomment the following if you support NativeI2CWriteRead for faster DaisyLink performance
            // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.
            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(NativeI2CWriteRead);

            this.NativeBitmapConverter = new BitmapConvertBPP(BitmapConverter);
            this.NativeBitmapCopyToSpi = this.NativeSPIBitmapPaint;

            GT.Socket socket;

            // For each socket on the mainboard, create, configure and register a Socket object with Gadgeteer.dll
            // This specifies:
            // - the SupportedTypes character array matching the list on the mainboard
            // - the CpuPins array (indexes [3] to [9].  [1,2,10] are constant (3.3V, 5V, GND) and [0] is unused.  This is normally based on an enumeration supplied in the NETMF port used.
            // - for other functionality, e.g. UART, SPI, etc, properties in the Socket class are set as appropriate to enable Gadgeteer.dll to access this functionality.
            // See the Mainboard Builder's Guide and specifically the Socket Types specification for more details
            // The two examples below are not realistically implementable sockets, but illustrate how to initialize a wide range of socket functionality.

            // This example socket 1 supports many types
            // Type 'D' - no additional action
            // Type 'I' - I2C pins must be used for the correct CpuPins
            // Type 'K' and 'U' - UART pins and UART handshaking pins must be used for the correct CpuPins, and the SerialPortName property must be set.
            // Type 'S' - SPI pins must be used for the correct CpuPins, and the SPIModule property must be set
            // Type 'X' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            #region Example Sockets
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            //socket.SupportedTypes = new char[] { 'D', 'I', 'K', 'S', 'U', 'X' };
            //socket.CpuPins[3] = (Cpu.Pin)1;
            //socket.CpuPins[4] = (Cpu.Pin)52;
            //socket.CpuPins[5] = (Cpu.Pin)23;
            //socket.CpuPins[6] = (Cpu.Pin)12;
            //socket.CpuPins[7] = (Cpu.Pin)34;
            //socket.CpuPins[8] = (Cpu.Pin)5;
            //socket.CpuPins[9] = (Cpu.Pin)7;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.SerialPortName = "COM1";
            //socket.SPIModule = SPI.SPI_module.SPI1;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);

            //// This example socket 2 supports many types
            //// Type 'A' - AnalogInput3-5 properties are set and GT.Socket.SocketInterfaces.SetAnalogInputFactors call is made
            //// Type 'O' - AnalogOutput property is set
            //// Type 'P' - PWM7-9 properties are set
            //// Type 'Y' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            //socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            //socket.CpuPins[3] = (Cpu.Pin)11;
            //socket.CpuPins[4] = (Cpu.Pin)5;
            //socket.CpuPins[5] = (Cpu.Pin)3;
            //socket.CpuPins[6] = (Cpu.Pin)66;
            //// Pin 7 not connected on this socket, so it is left unspecified
            //socket.CpuPins[8] = (Cpu.Pin)59;
            //socket.CpuPins[9] = (Cpu.Pin)18;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.AnalogOutput = new FEZCerbuinoBee_AnalogOut((Cpu.Pin)14);
            //GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 1, 2, 10);
            //socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_2;
            //socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_3;
            //socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_1;
            //socket.PWM7 = Cpu.PWMChannel.PWM_3;
            //socket.PWM8 = Cpu.PWMChannel.PWM_0;
            //socket.PWM9 = Cpu.PWMChannel.PWM_2;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion

            #region Socket 1
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'P', 'S', 'U', 'Y' };
            socket.CpuPins[3]     = FEZCerb_Pins.PA14;
            socket.CpuPins[4]     = FEZCerb_Pins.PB10;
            socket.CpuPins[5]     = FEZCerb_Pins.PB11;
            socket.CpuPins[6]     = FEZCerb_Pins.PA13;
            socket.CpuPins[7]     = FEZCerb_Pins.PB5;
            socket.CpuPins[8]     = FEZCerb_Pins.PB4;
            socket.CpuPins[9]     = FEZCerb_Pins.PB3;

            //P
            socket.PWM7 = Cpu.PWMChannel.PWM_6;
            socket.PWM8 = Cpu.PWMChannel.PWM_7;
            socket.PWM9 = (Cpu.PWMChannel) 8;

            // S
            socket.SPIModule = SPI.SPI_module.SPI1;

            // U
            socket.SerialPortName = "COM3";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 1

            #region Socket 2
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes = new char[] { 'A', 'I', 'K', 'U', 'Y' };
            socket.CpuPins[3]     = FEZCerb_Pins.PA6;
            socket.CpuPins[4]     = FEZCerb_Pins.PA2;
            socket.CpuPins[5]     = FEZCerb_Pins.PA3;
            socket.CpuPins[6]     = FEZCerb_Pins.PA1;
            socket.CpuPins[7]     = FEZCerb_Pins.PA0;
            socket.CpuPins[8]     = FEZCerb_Pins.PB7;
            socket.CpuPins[9]     = FEZCerb_Pins.PB6;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_0;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_1;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_2;

            // I
            // N/A

            // K/U
            socket.SerialPortName = "COM2";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 2

            #region Socket 3
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            socket.CpuPins[3]     = FEZCerb_Pins.PC0;
            socket.CpuPins[4]     = FEZCerb_Pins.PC1;
            socket.CpuPins[5]     = FEZCerb_Pins.PA4;
            socket.CpuPins[6]     = FEZCerb_Pins.PC5;
            socket.CpuPins[7]     = FEZCerb_Pins.PB8;
            socket.CpuPins[8]     = FEZCerb_Pins.PA7;
            socket.CpuPins[9]     = FEZCerb_Pins.PB9;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_3;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_4;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_5;

            // O
            socket.AnalogOutput = new FEZCerbuinoBee_AnalogOut(Cpu.AnalogOutputChannel.ANALOG_OUTPUT_0);

            // P
            socket.PWM7 = (Cpu.PWMChannel) 14;
            socket.PWM8 = Cpu.PWMChannel.PWM_1;
            socket.PWM9 = (Cpu.PWMChannel) 15;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 3
        }
Example #5
0
        /// <summary>
        /// Instantiates a new FEZRaptor mainboard
        /// </summary>
        public FEZRaptor()
        {
            this.NativeBitmapConverter = this.BitmapConverter;

            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(this.NativeI2CWriteRead);

            GT.Socket socket;

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes     = new char[] { 'S', 'U', 'Y' };
            socket.CpuPins[3]         = Pin.PB0;
            socket.CpuPins[4]         = Pin.PA7;
            socket.CpuPins[5]         = Pin.PA8;
            socket.CpuPins[6]         = Pin.PB5;
            socket.CpuPins[7]         = Pin.PA22;
            socket.CpuPins[8]         = Pin.PA21;
            socket.CpuPins[9]         = Pin.PA23;
            socket.SPIModule          = SPI.SPI_module.SPI2;
            socket.SerialPortName     = "COM4";
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes     = new char[] { 'A', 'I', 'X' };
            socket.CpuPins[3]         = Pin.PB14;
            socket.CpuPins[4]         = Pin.PB15;
            socket.CpuPins[5]         = Pin.PB16;
            socket.CpuPins[6]         = Pin.PB18;
            socket.CpuPins[8]         = Pin.PA30;
            socket.CpuPins[9]         = Pin.PA31;
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_3;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_4;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_5;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes     = new char[] { 'S', 'X' };
            socket.CpuPins[3]         = Pin.PB1;
            socket.CpuPins[4]         = Pin.PC23;
            socket.CpuPins[5]         = Pin.PB3;
            socket.CpuPins[6]         = Pin.PA28;
            socket.CpuPins[7]         = Pin.PA12;
            socket.CpuPins[8]         = Pin.PA11;
            socket.CpuPins[9]         = Pin.PA13;
            socket.SPIModule          = SPI.SPI_module.SPI1;
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes     = new char[] { 'I', 'K', 'U', 'X' };
            socket.CpuPins[3]         = Pin.PA27;
            socket.CpuPins[4]         = Pin.PA0;
            socket.CpuPins[5]         = Pin.PA1;
            socket.CpuPins[6]         = Pin.PA2;
            socket.CpuPins[7]         = Pin.PA3;
            socket.CpuPins[8]         = Pin.PA30;
            socket.CpuPins[9]         = Pin.PA31;
            socket.SerialPortName     = "COM2";
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(5);
            socket.SupportedTypes = new char[] { 'Z' };
            socket.CpuPins[3]     = (Cpu.Pin)SpecialPurposePin.RESET;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.TCK;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.RTC_BATT;
            socket.CpuPins[6]     = (Cpu.Pin)SpecialPurposePin.TDO;
            socket.CpuPins[7]     = (Cpu.Pin)SpecialPurposePin.TRST;
            socket.CpuPins[8]     = (Cpu.Pin)SpecialPurposePin.TMS;
            socket.CpuPins[9]     = (Cpu.Pin)SpecialPurposePin.TDI;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'H', 'I' };
            socket.CpuPins[3]     = Pin.PD4;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.USBD_C_DM;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.USBD_C_DP;
            socket.CpuPins[6]     = Pin.PA24;
            socket.CpuPins[8]     = Pin.PA30;
            socket.CpuPins[9]     = Pin.PA31;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(7);
            socket.SupportedTypes = new char[] { 'H', 'I' };
            socket.CpuPins[3]     = Pin.PA25;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.USBD_B_DM;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.USBD_B_DP;
            socket.CpuPins[6]     = Pin.PA4;
            socket.CpuPins[8]     = Pin.PA30;
            socket.CpuPins[9]     = Pin.PA31;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(8);
            socket.SupportedTypes = new char[] { 'D', 'I' };
            socket.CpuPins[3]     = Pin.PD6;
            socket.CpuPins[4]     = (Cpu.Pin)SpecialPurposePin.USBD_A_DM;
            socket.CpuPins[5]     = (Cpu.Pin)SpecialPurposePin.USBD_A_DP;
            socket.CpuPins[6]     = Pin.PD0;
            socket.CpuPins[7]     = Pin.PD5;
            socket.CpuPins[8]     = Pin.PA30;
            socket.CpuPins[9]     = Pin.PA31;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(9);
            socket.SupportedTypes     = new char[] { 'F', 'Y' };
            socket.CpuPins[3]         = Pin.PD7;
            socket.CpuPins[4]         = Pin.PA15;
            socket.CpuPins[5]         = Pin.PA18;
            socket.CpuPins[6]         = Pin.PA16;
            socket.CpuPins[7]         = Pin.PA19;
            socket.CpuPins[8]         = Pin.PA20;
            socket.CpuPins[9]         = Pin.PA17;
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(10);
            socket.SupportedTypes     = new char[] { 'C', 'I', 'U', 'X' };
            socket.CpuPins[3]         = Pin.PA29;
            socket.CpuPins[4]         = Pin.PA10;
            socket.CpuPins[5]         = Pin.PA9;
            socket.CpuPins[6]         = Pin.PA26;
            socket.CpuPins[8]         = Pin.PA30;
            socket.CpuPins[9]         = Pin.PA31;
            socket.SerialPortName     = "COM1";
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(11);
            socket.SupportedTypes     = new char[] { 'C', 'S', 'U', 'X' };
            socket.CpuPins[3]         = Pin.PC26;
            socket.CpuPins[4]         = Pin.PA5;
            socket.CpuPins[5]         = Pin.PA6;
            socket.CpuPins[6]         = Pin.PB4;
            socket.CpuPins[7]         = Pin.PA12;
            socket.CpuPins[8]         = Pin.PA11;
            socket.CpuPins[9]         = Pin.PA13;
            socket.SPIModule          = SPI.SPI_module.SPI1;
            socket.SerialPortName     = "COM3";
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(12);
            socket.SupportedTypes     = new char[] { 'I', 'U', 'X' };
            socket.CpuPins[3]         = Pin.PC31;
            socket.CpuPins[4]         = Pin.PC16;
            socket.CpuPins[5]         = Pin.PC17;
            socket.CpuPins[6]         = Pin.PB2;
            socket.CpuPins[8]         = Pin.PA30;
            socket.CpuPins[9]         = Pin.PA31;
            socket.SerialPortName     = "COM6";
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(13);
            socket.SupportedTypes     = new char[] { 'A', 'I', 'X' };
            socket.CpuPins[3]         = Pin.PB17;
            socket.CpuPins[4]         = Pin.PB6;
            socket.CpuPins[5]         = Pin.PB7;
            socket.CpuPins[6]         = Pin.PC22;
            socket.CpuPins[8]         = Pin.PA30;
            socket.CpuPins[9]         = Pin.PA31;
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_6;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_7;
            socket.AnalogInput5 = (Cpu.AnalogChannel) 8;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(14);
            socket.SupportedTypes     = new char[] { 'A', 'I', 'T', 'X' };
            socket.CpuPins[3]         = Pin.PB11;
            socket.CpuPins[4]         = Pin.PB12;
            socket.CpuPins[5]         = Pin.PB13;
            socket.CpuPins[6]         = Pin.PD1;
            socket.CpuPins[7]         = Pin.PD2;
            socket.CpuPins[8]         = Pin.PA30;
            socket.CpuPins[9]         = Pin.PA31;
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_0;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_1;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_2;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(15);
            socket.SupportedTypes     = new char[] { 'R', 'Y' };
            socket.CpuPins[3]         = Pin.PC11;
            socket.CpuPins[4]         = Pin.PC12;
            socket.CpuPins[5]         = Pin.PC13;
            socket.CpuPins[6]         = Pin.PC14;
            socket.CpuPins[7]         = Pin.PC15;
            socket.CpuPins[8]         = Pin.PC27;
            socket.CpuPins[9]         = Pin.PC28;
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(16);
            socket.SupportedTypes     = new char[] { 'G', 'Y' };
            socket.CpuPins[3]         = Pin.PC5;
            socket.CpuPins[4]         = Pin.PC6;
            socket.CpuPins[5]         = Pin.PC7;
            socket.CpuPins[6]         = Pin.PC8;
            socket.CpuPins[7]         = Pin.PC9;
            socket.CpuPins[8]         = Pin.PC10;
            socket.CpuPins[9]         = Pin.PC21;
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(17);
            socket.SupportedTypes     = new char[] { 'B', 'Y' };
            socket.CpuPins[3]         = Pin.PC0;
            socket.CpuPins[4]         = Pin.PC1;
            socket.CpuPins[5]         = Pin.PC2;
            socket.CpuPins[6]         = Pin.PC3;
            socket.CpuPins[7]         = Pin.PC4;
            socket.CpuPins[8]         = Pin.PC29;
            socket.CpuPins[9]         = Pin.PC30;
            socket.NativeI2CWriteRead = nativeI2C;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(18);
            socket.SupportedTypes     = new char[] { 'A', 'P', 'Y' };
            socket.CpuPins[3]         = Pin.PB8;
            socket.CpuPins[4]         = Pin.PB9;
            socket.CpuPins[5]         = Pin.PB10;
            socket.CpuPins[6]         = Pin.PC24;
            socket.CpuPins[7]         = Pin.PC18;
            socket.CpuPins[8]         = Pin.PC19;
            socket.CpuPins[9]         = Pin.PC20;
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 10);
            socket.AnalogInput3 = (Cpu.AnalogChannel) 9;
            socket.AnalogInput4 = (Cpu.AnalogChannel) 10;
            socket.AnalogInput5 = (Cpu.AnalogChannel) 11;

            socket.PWM7 = Cpu.PWMChannel.PWM_0;
            socket.PWM8 = Cpu.PWMChannel.PWM_1;
            socket.PWM9 = Cpu.PWMChannel.PWM_2;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
        }
Example #6
0
        /// <summary>
        /// Instantiates a new FEZCerbuinoNet mainboard
        /// </summary>
        public FEZCerbuinoNet()
        {
            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(this.NativeI2CWriteRead);

            this.NativeBitmapConverter = new BitmapConvertBPP(this.BitmapConverter);
            this.NativeBitmapCopyToSpi = this.NativeSPIBitmapPaint;

            GT.Socket socket;

            #region Socket 1
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'P', 'S', 'U', 'X' };
            socket.CpuPins[3]     = FEZCerb_Pins.PC13;
            socket.CpuPins[4]     = FEZCerb_Pins.PC6;
            socket.CpuPins[5]     = FEZCerb_Pins.PC7;
            socket.CpuPins[6]     = FEZCerb_Pins.PB0;
            socket.CpuPins[7]     = FEZCerb_Pins.PB5;
            socket.CpuPins[8]     = FEZCerb_Pins.PB4;
            socket.CpuPins[9]     = FEZCerb_Pins.PB3;

            //P
            socket.PWM7 = Cpu.PWMChannel.PWM_6;
            socket.PWM8 = Cpu.PWMChannel.PWM_7;
            socket.PWM9 = (Cpu.PWMChannel) 8;

            // S
            socket.SPIModule = SPI.SPI_module.SPI1;

            // U
            socket.SerialPortName = "COM6";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 1

            #region Socket 2
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes = new char[] { 'A', 'I', 'K', 'U', 'Y' };
            socket.CpuPins[3]     = FEZCerb_Pins.PA6;
            socket.CpuPins[4]     = FEZCerb_Pins.PA2;
            socket.CpuPins[5]     = FEZCerb_Pins.PA3;
            socket.CpuPins[6]     = FEZCerb_Pins.PA1;
            socket.CpuPins[7]     = FEZCerb_Pins.PA0;
            socket.CpuPins[8]     = FEZCerb_Pins.PB7;
            socket.CpuPins[9]     = FEZCerb_Pins.PB6;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_0;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_1;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_2;

            // I
            // N/A

            // K/U
            socket.SerialPortName = "COM2";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 2

            #region Socket 3
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            socket.CpuPins[3]     = FEZCerb_Pins.PC0;
            socket.CpuPins[4]     = FEZCerb_Pins.PC1;
            socket.CpuPins[5]     = FEZCerb_Pins.PA4;
            socket.CpuPins[6]     = FEZCerb_Pins.PC5;
            socket.CpuPins[7]     = FEZCerb_Pins.PB8;
            socket.CpuPins[8]     = FEZCerb_Pins.PA7;
            socket.CpuPins[9]     = FEZCerb_Pins.PB9;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_3;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_4;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_5;

            // O
            socket.AnalogOutput = new FEZCerbuinoNet_AnalogOut(Cpu.AnalogOutputChannel.ANALOG_OUTPUT_0);

            // P
            socket.PWM7 = (Cpu.PWMChannel) 14;
            socket.PWM8 = Cpu.PWMChannel.PWM_1;
            socket.PWM9 = (Cpu.PWMChannel) 15;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 3
        }
        /// <summary>
        /// Instantiates a new GHI Electronics FEZCobra II mainboard
        /// </summary>
        public FEZCobraIIEcoExtender()
        {
            // uncomment the following if you support NativeI2CWriteRead for faster DaisyLink performance
            // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.
            GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate nativeI2C = new GT.Socket.SocketInterfaces.NativeI2CWriteReadDelegate(NativeI2CWriteRead);

            this.NativeBitmapConverter = new BitmapConvertBPP(BitmapConverter);

            GT.Socket socket;

            // For each socket on the mainboard, create, configure and register a Socket object with Gadgeteer.dll
            // This specifies:
            // - the SupportedTypes character array matching the list on the mainboard
            // - the CpuPins array (indexes [3] to [9].  [1,2,10] are constant (3.3V, 5V, GND) and [0] is unused.  This is normally based on an enumeration supplied in the NETMF port used.
            // - for other functionality, e.g. UART, SPI, etc, properties in the Socket class are set as appropriate to enable Gadgeteer.dll to access this functionality.
            // See the Mainboard Builder's Guide and specifically the Socket Types specification for more details
            // The two examples below are not realistically implementable sockets, but illustrate how to initialize a wide range of socket functionality.

            #region Example Sockets
            //// This example socket 1 supports many types
            //// Type 'D' - no additional action
            //// Type 'I' - I2C pins must be used for the correct CpuPins
            //// Type 'K' and 'U' - UART pins and UART handshaking pins must be used for the correct CpuPins, and the SerialPortName property must be set.
            //// Type 'S' - SPI pins must be used for the correct CpuPins, and the SPIModule property must be set
            //// Type 'X' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            //socket.SupportedTypes = new char[] { 'D', 'I', 'K', 'S', 'U', 'X' };
            //socket.CpuPins[3] = (Cpu.Pin)1;
            //socket.CpuPins[4] = (Cpu.Pin)52;
            //socket.CpuPins[5] = (Cpu.Pin)23;
            //socket.CpuPins[6] = (Cpu.Pin)12;
            //socket.CpuPins[7] = (Cpu.Pin)34;
            //socket.CpuPins[8] = (Cpu.Pin)5;
            //socket.CpuPins[9] = (Cpu.Pin)7;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.SerialPortName = "COM1";
            //socket.SPIModule = SPI.SPI_module.SPI1;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);

            //// This example socket 2 supports many types
            //// Type 'A' - AnalogInput3-5 properties are set and GT.Socket.SocketInterfaces.SetAnalogInputFactors call is made
            //// Type 'O' - AnalogOutput property is set
            //// Type 'P' - PWM7-9 properties are set
            //// Type 'Y' - the NativeI2CWriteRead function pointer is set (though by default "nativeI2C" is null)
            //socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            //socket.SupportedTypes = new char[] { 'A', 'O', 'P', 'Y' };
            //socket.CpuPins[3] = (Cpu.Pin)11;
            //socket.CpuPins[4] = (Cpu.Pin)5;
            //socket.CpuPins[5] = (Cpu.Pin)3;
            //socket.CpuPins[6] = (Cpu.Pin)66;
            //// Pin 7 not connected on this socket, so it is left unspecified
            //socket.CpuPins[8] = (Cpu.Pin)59;
            //socket.CpuPins[9] = (Cpu.Pin)18;
            //socket.NativeI2CWriteRead = nativeI2C;
            //socket.AnalogOutput = new FEZCobraII_AnalogOut((Cpu.Pin)14);
            //GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 1, 2, 10);
            //socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_2;
            //socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_3;
            //socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_1;
            //socket.PWM7 = Cpu.PWMChannel.PWM_3;
            //socket.PWM8 = Cpu.PWMChannel.PWM_0;
            //socket.PWM9 = Cpu.PWMChannel.PWM_2;
            //GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion

            #region Socket Setup

            #region Socket 1
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'B', 'Y' };
            socket.CpuPins[3]     = G120.Pin.P2_13;
            socket.CpuPins[4]     = G120.Pin.P1_26;
            socket.CpuPins[5]     = G120.Pin.P1_27;
            socket.CpuPins[6]     = G120.Pin.P1_28;
            socket.CpuPins[7]     = G120.Pin.P1_29;
            socket.CpuPins[8]     = G120.Pin.P2_4;
            socket.CpuPins[9]     = G120.Pin.P2_2;

            // B
            // N/A

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 1

            #region Socket 2
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(2);
            socket.SupportedTypes = new char[] { 'G' };
            socket.CpuPins[3]     = G120.Pin.P1_20;
            socket.CpuPins[4]     = G120.Pin.P1_21;
            socket.CpuPins[5]     = G120.Pin.P1_22;
            socket.CpuPins[6]     = G120.Pin.P1_23;
            socket.CpuPins[7]     = G120.Pin.P1_24;
            socket.CpuPins[8]     = G120.Pin.P1_25;
            socket.CpuPins[9]     = G120.Pin.P1_19;

            // G
            // N/A

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 2

            #region Socket 3
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes = new char[] { 'R', 'Y' };
            socket.CpuPins[3]     = G120.Pin.P2_12;
            socket.CpuPins[4]     = G120.Pin.P2_6;
            socket.CpuPins[5]     = G120.Pin.P2_7;
            socket.CpuPins[6]     = G120.Pin.P2_8;
            socket.CpuPins[7]     = G120.Pin.P2_9;
            socket.CpuPins[8]     = G120.Pin.P2_3;
            socket.CpuPins[9]     = G120.Pin.P2_5;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 3

            #region Socket 4
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new char[] { 'A', 'I', 'T', 'X' };
            socket.CpuPins[3]     = G120.Pin.P0_25;
            socket.CpuPins[4]     = G120.Pin.P0_24;
            socket.CpuPins[5]     = G120.Pin.P0_23;
            socket.CpuPins[6]     = G120.Pin.P1_0;
            socket.CpuPins[7]     = G120.Pin.P1_1;
            socket.CpuPins[8]     = G120.Pin.P0_27;
            socket.CpuPins[9]     = G120.Pin.P0_28;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_2;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_1;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_0;

            // I
            // N/A

            // T
            // N/A

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 4

            #region Socket 5
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(5);
            socket.SupportedTypes = new char[] { 'U', 'X' };
            socket.CpuPins[3]     = G120.Pin.P0_13;
            socket.CpuPins[4]     = G120.Pin.P0_2;
            socket.CpuPins[5]     = G120.Pin.P0_3;
            socket.CpuPins[6]     = G120.Pin.P1_4;
            socket.CpuPins[7]     = G120.Pin.GPIO_NONE;
            socket.CpuPins[8]     = G120.Pin.GPIO_NONE;
            socket.CpuPins[9]     = G120.Pin.GPIO_NONE;

            // U
            socket.SerialPortName = "COM1";

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 5

            #region Socket 6
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'S', 'X' };
            socket.CpuPins[3]     = G120.Pin.P2_21;
            socket.CpuPins[4]     = G120.Pin.P1_14;
            socket.CpuPins[5]     = G120.Pin.P1_16;
            socket.CpuPins[6]     = G120.Pin.P1_17;
            socket.CpuPins[7]     = (Cpu.Pin) 9;        //P0.9
            socket.CpuPins[8]     = (Cpu.Pin) 8;        //P0.8
            socket.CpuPins[9]     = (Cpu.Pin) 7;        //P0.7

            // S
            socket.SPIModule = SPI.SPI_module.SPI2;

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 6

            #region Extended Sockets
            #region Socket 7
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(7);
            socket.SupportedTypes = new char[] { 'P', 'U', 'Y' };
            socket.CpuPins[3]     = G120.Pin.P0_4;
            socket.CpuPins[4]     = G120.Pin.P4_28;
            socket.CpuPins[5]     = G120.Pin.P4_29;
            socket.CpuPins[6]     = G120.Pin.P1_30;
            socket.CpuPins[7]     = G120.Pin.P3_26;
            socket.CpuPins[8]     = G120.Pin.P3_25;
            socket.CpuPins[9]     = G120.Pin.P3_24;

            // P
            socket.PWM7 = (Cpu.PWMChannel) 8;
            socket.PWM8 = Cpu.PWMChannel.PWM_7;
            socket.PWM9 = Cpu.PWMChannel.PWM_6;

            // U
            socket.SerialPortName = "COM4";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 7

            #region Socket 8
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(8);
            socket.SupportedTypes = new char[] { 'I', 'K', 'U', 'X' };
            socket.CpuPins[3]     = G120.Pin.P0_10;
            socket.CpuPins[4]     = G120.Pin.P2_0;
            socket.CpuPins[5]     = G120.Pin.P0_16;
            socket.CpuPins[6]     = G120.Pin.P0_6;
            socket.CpuPins[7]     = G120.Pin.P0_17;
            socket.CpuPins[8]     = G120.Pin.P0_27;
            socket.CpuPins[9]     = G120.Pin.P0_28;

            // I
            // N/A

            // K/U
            socket.SerialPortName = "COM2";

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 8

            #region Socket 9
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(9);
            socket.SupportedTypes = new char[] { 'A', 'O', 'S', 'X' };
            socket.CpuPins[3]     = G120.Pin.P0_12;
            socket.CpuPins[4]     = G120.Pin.P1_31;
            socket.CpuPins[5]     = G120.Pin.P0_26;
            socket.CpuPins[6]     = G120.Pin.P1_5;
            socket.CpuPins[7]     = G120.Pin.P0_18;
            socket.CpuPins[8]     = G120.Pin.P0_17;
            socket.CpuPins[9]     = G120.Pin.P0_15;

            // A
            GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_6;
            socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_5;
            socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_3;

            // O
            socket.AnalogOutput = new FEZCobraII_AnalogOut((Cpu.Pin)socket.CpuPins[5]);

            // S
            socket.SPIModule = SPI.SPI_module.SPI1;

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 9

            #region Socket 10
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(10);
            socket.SupportedTypes = new char[] { 'C', 'I', 'X' };
            socket.CpuPins[3]     = G120.Pin.P0_11;
            socket.CpuPins[4]     = G120.Pin.P0_1;
            socket.CpuPins[5]     = G120.Pin.P0_0;
            socket.CpuPins[6]     = G120.Pin.P0_5;
            //socket.CpuPins[7] = G120.Pin.P3_26;
            socket.CpuPins[8] = G120.Pin.P0_27;
            socket.CpuPins[9] = G120.Pin.P0_28;

            // C
            // N/A

            // I
            // N/A

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
            #endregion Socket 10

            #endregion Extended Sockets

            #endregion Socket Setup
        }