public InteropI2CBus(GT.Socket socket, GT.Socket.Pin sdaPin, GT.Socket.Pin sclPin, ushort address, int clockRateKHz, GTM.Module module)
 {
     this.sdaPin       = socket.CpuPins[(int)sdaPin];
     this.sclPin       = socket.CpuPins[(int)sclPin];
     this.Address      = address;
     this.ClockRateKHz = clockRateKHz;
 }
            public InteropI2CBus(GT.Socket socket, GT.Socket.Pin sdaPin, GT.Socket.Pin sclPin, ushort address, int clockRateKHz, GTM.Module module)
            {
                this.Address      = address;
                this.ClockRateKHz = clockRateKHz;

                this.softwareBus = new SoftwareI2CBus(socket.CpuPins[(int)sclPin], socket.CpuPins[(int)sdaPin]);
            }
 bool NativeI2CWriteRead(int SocketNumber, GT.Socket.Pin sda, GT.Socket.Pin scl, byte address, byte[] write, int writeOffset, int writeLen, byte[] read, int readOffset, int readLen, out int numWritten, out int numRead)
 {
     // implement this method if you support NativeI2CWriteRead for faster DaisyLink performance
     // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.
     numRead    = 0;
     numWritten = 0;
     return(false);
 }
        bool NativeI2CWriteRead(GT.Socket socket, GT.Socket.Pin sda, GT.Socket.Pin scl, byte address, byte[] write, int writeOffset, int writeLen, byte[] read, int readOffset, int readLen, out int numWritten, out int numRead)
        {
            // implement this method if you support NativeI2CWriteRead for faster DaisyLink performance
            // otherwise, the DaisyLink I2C interface will be supported in Gadgeteer.dll in managed code.

            return(GHI.OSHW.Hardware.SoftwareI2CBus.DirectI2CWriteRead(socket.CpuPins[(int)scl], socket.CpuPins[(int)sda], 100, address, write, writeOffset, writeLen, read, readOffset, readLen, out numWritten, out numRead));

            //numRead = 0;
            //numWritten = 0;
            //return false;
        }
        public RoboticArmController(Extender extender, GT.Socket.Pin clawPin, GT.Socket.Pin armPin, uint pwmPulsePeriod)
        {
            if (extender == null)
            {
                throw new ApplicationException("robotic arm pwm extender not set up correctly");
            }

            _pwmPulsePeriod = pwmPulsePeriod;
            _clawPwm        = extender.SetupPWMOutput(clawPin);
            _armPwm         = extender.SetupPWMOutput(armPin);

            Reset();
        }
Exemple #6
0
        public Lighting(Extender extender, GT.Socket.Pin pin, int frequency, float lowLightDutyCycle, float overheadDutyCycle, float nightDutyCycle)
        {
            this.extender  = extender;
            this.frequency = frequency;
            this.lowLight  = lowLightDutyCycle;
            this.overhead  = overheadDutyCycle;
            this.night     = nightDutyCycle;

            //asign the pin for pwm
            PwmOutput pwm = extender.CreatePwmOutput(pin);

            //thread that loops changing the light output per time of day
            Thread thread = new Thread(() => PwmThread(pwm));

            thread.Start();
        }
Exemple #7
0
 bool NativeI2CWriteRead(GT.Socket socket, GT.Socket.Pin sda, GT.Socket.Pin scl, byte address, byte[] write, int writeOffset, int writeLen, byte[] read, int readOffset, int readLen, out int numWritten, out int numRead)
 {
     return(SoftwareI2CBus.DirectI2CWriteRead(socket.CpuPins[(int)scl], socket.CpuPins[(int)sda], 100, address, write, writeOffset, writeLen, read, readOffset, readLen, out numWritten, out numRead));
 }