GetI2CPins() public méthode

public GetI2CPins ( Cpu &scl, Cpu &sda ) : void
scl Cpu
sda Cpu
Résultat void
Exemple #1
0
        //--//

        public I2CDevice(Configuration config)
        {
            this.Config = config;

            HardwareProvider hwProvider = HardwareProvider.HwProvider;

            if (hwProvider != null)
            {
                Cpu.Pin scl;
                Cpu.Pin sda;

                hwProvider.GetI2CPins(out scl, out sda);

                if (scl != Cpu.Pin.GPIO_NONE)
                {
                    Port.ReservePin(scl, true);
                }

                if (sda != Cpu.Pin.GPIO_NONE)
                {
                    Port.ReservePin(sda, true);
                }
            }

            Initialize();

            m_disposed = false;
        }
Exemple #2
0
        private void Dispose(bool fDisposing)
        {
            if (!m_disposed)
            {
                try
                {
                    HardwareProvider hwProvider = HardwareProvider.HwProvider;

                    if (hwProvider != null)
                    {
                        Cpu.Pin scl;
                        Cpu.Pin sda;

                        hwProvider.GetI2CPins(out scl, out sda);

                        if (scl != Cpu.Pin.GPIO_NONE)
                        {
                            Port.ReservePin(scl, false);
                        }

                        if (sda != Cpu.Pin.GPIO_NONE)
                        {
                            Port.ReservePin(sda, false);
                        }
                    }
                }
                finally
                {
                    m_disposed = true;
                }
            }
        }