/// <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 });
 }
Example #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 });
 }
Example #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();
 }
Example #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);
    }
Example #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);
        }
Example #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);
            }
        }
Example #7
0
 /// <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();
 }
Example #8
0
 public Wire(byte address, int clockRateKhz)
 {
     this.i2cDevice = new MultiI2C(address, clockRateKhz);
 }
Example #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
 }
Example #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);
 }
Example #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
 }
Example #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);
 }
Example #13
0
 public DS3232Connection()
 {
     _DS3232 = new MultiI2C(I2C_ADDRESS, 100);
 }