예제 #1
0
 /// <summary>
 /// Initialises a new Wii Nunchuk
 /// </summary>
 /// <param name="Address">The I²C address</param>
 /// <param name="ClockRateKhz">The speed in Khz</param>
 public WiiNunchuk(ushort Address = 0x52, int ClockRateKhz = 100)
 {
     // This initialisation routine seems to work. I got it at http://wiibrew.org/wiki/Wiimote/Extension_Controllers#The_New_Way
     this._Device = new MultiI2C(Address, ClockRateKhz);
     this._Device.Write(new byte[] { 0xf0, 0x55 });
     this._Device.Write(new byte[] { 0xfb, 0x00 });
 }
예제 #2
0
 /// <summary>
 /// Initialises a new Wii Nunchuk
 /// </summary>
 /// <param name="Address">The I²C address</param>
 /// <param name="ClockRateKhz">The speed in Khz</param>
 public WiiNunchuk(ushort Address = 0x52, int ClockRateKhz = 100)
 {
     // This initialisation routine seems to work. I got it at http://wiibrew.org/wiki/Wiimote/Extension_Controllers#The_New_Way
     this._Device = new MultiI2C(Address, ClockRateKhz);
     this._Device.Write(new byte[] { 0xf0, 0x55 });
     this._Device.Write(new byte[] { 0xfb, 0x00 });
 }
예제 #3
0
 public static void Open()
 {
     _I2C = new MultiI2C(0x50);
     TagDetectSignal = new InputPort(Pins.GPIO_PIN_D10, false, ResistorModes.PullUp);
     WakeUpPin = new OutputPort(Pins.GPIO_PIN_D9, true);
     Reset();
 }
예제 #4
0
    protected LiquidCrystal_I2C(byte lcd_Addr, byte lcd_cols, byte lcd_rows)
    {
        LCDLock = new object();

        _Addr = lcd_Addr;
        _cols = lcd_cols;
        _rows = lcd_rows;
        _backlightval = DefineConstants.LCD_NOBACKLIGHT;
        _I2C = new MultiI2C(lcd_Addr, MAX_FREQ);
        begin(_cols, _rows);
    }
예제 #5
0
        /// <summary>
        /// Initialises a new MCP23017 pin expander
        /// </summary>
        /// <param name="Address">The I²C address</param>
        /// <param name="ClockRateKhz">The module speed in Khz</param>
        public Mcp23017(ushort Address = 0x20, int ClockRateKhz = 200)
        {
            // Initialises the device
            this._Device = new MultiI2C(Address, ClockRateKhz);
            // Set all pins to input by default
            this._Device.Write(new byte[] { _IODIRA, 0xff }); // All pins on port A
            this._Device.Write(new byte[] { _IODIRB, 0xff }); // All pins on port B

            // Prepares all pins
            this.Pins = new Mcp23017Port[16];
            for (int PinNo = 0; PinNo < this.Pins.Length; ++PinNo)
                this.Pins[PinNo] = new Mcp23017Port(this, PinNo);
        }
예제 #6
0
        /// <summary>
        /// Initialises a new MCP23017 pin expander
        /// </summary>
        /// <param name="Address">The I²C address</param>
        /// <param name="ClockRateKhz">The module speed in Khz</param>
        public Mcp23017(ushort Address = 0x20, int ClockRateKhz = 200)
        {
            // Initialises the device
            this._Device = new MultiI2C(Address, ClockRateKhz);
            // Set all pins to input by default
            this._Device.Write(new byte[] { _IODIRA, 0xff }); // All pins on port A
            this._Device.Write(new byte[] { _IODIRB, 0xff }); // All pins on port B

            // Prepares all pins
            this.Pins = new Mcp23017Port[16];
            for (int PinNo = 0; PinNo < this.Pins.Length; ++PinNo)
            {
                this.Pins[PinNo] = new Mcp23017Port(this, PinNo);
            }
        }
예제 #7
0
파일: IMU_I2C.cs 프로젝트: swordfish45/P1
 /// <summary>
 /// Establishes I2C connection to MPU6050, Initializes and gets Gyro offsets.
 /// </summary>
 public IMU_I2C(byte address)
 {
     _I2C = new MultiI2C(address, MAX_FREQ);
     Thread.Sleep(10);
     Initialize();
     Thread.Sleep(10);
     Callibrate();
 }
예제 #8
0
파일: Wire.cs 프로젝트: Royih/BrewMatic.HW
 public Wire(byte address, int clockRateKhz)
 {
     this.i2cDevice = new MultiI2C(address, clockRateKhz);
 }
예제 #9
0
 /// <summary>
 /// Initialises a new BlinkM RGB LED
 /// </summary>
 /// <param name="Address">The I²C address</param>
 /// <param name="ClockRateKhz">The module speed in Khz</param>
 public BlinkM(ushort Address = 0x09, int ClockRateKhz = 100)
 {
     this._Device = new MultiI2C(Address, ClockRateKhz);
     this.SendCommand('o'); // Stop Script
 }
예제 #10
0
 /// <summary>
 /// Initialises a new DS1307 RTC Module
 /// </summary>
 /// <param name="Address">The I²C address</param>
 /// <param name="ClockRateKhz">The module speed in Khz</param>
 public DS1307(byte Address = 0x68, int ClockRateKhz = 100)
 {
     this._Device = new MultiI2C(Address, ClockRateKhz);
 }
예제 #11
0
 /// <summary>
 /// Initialises a new BlinkM RGB LED
 /// </summary>
 /// <param name="Address">The I²C address</param>
 /// <param name="ClockRateKhz">The module speed in Khz</param>
 public BlinkM(ushort Address = 0x09, int ClockRateKhz = 100)
 {
     this._Device = new MultiI2C(Address, ClockRateKhz);
     this.SendCommand('o'); // Stop Script
 }
예제 #12
0
 /// <summary>
 /// Initialises a new DS1307 RTC Module
 /// </summary>
 /// <param name="Address">The I²C address</param>
 /// <param name="ClockRateKhz">The module speed in Khz</param>
 public DS1307(byte Address = 0x68, int ClockRateKhz = 100)
 {
     this._Device = new MultiI2C(Address, ClockRateKhz);
 }
예제 #13
0
 public DS3232Connection()
 {
     _DS3232 = new MultiI2C(I2C_ADDRESS, 100);
 }