Exemplo n.º 1
0
        private Configuration SpiConfigurationToConfiguration(SpiConfiguration configuration)
        {
            Configuration cfg = new Configuration(
                (Cpu.Pin)configuration.DeviceCS,
                configuration.CS_Active,
                configuration.CS_Setup_uSecs,
                configuration.CS_Hold_uSecs,
                configuration.MSK_IDLE,
                configuration.MSK_SampleEdge,
                configuration.Clock_RateKHz,
                (Hardware.Spi.SpiModule)configuration.SPI_mod);

            return(cfg);
        }
Exemplo n.º 2
0
        bool ISpiDriver.nWrite8_nRead8(ref SpiConfiguration Configuration, IntPtr Write8, int WriteCount, IntPtr Read8, int ReadCount, int ReadStartOffset)
        {
            Configuration configuration = SpiConfigurationToConfiguration(Configuration);

            bool res = false;

            try
            {
                if (StartTransaction(configuration))
                {
                    SpiXaction xaction = new SpiXaction(Write8, WriteCount, Read8, ReadCount, ReadStartOffset);

                    res = ((ISpiDriver)this).Xaction_nWrite8_nRead8(ref xaction);
                }
            }
            finally
            {
                res &= EndTransaction(configuration);
            }

            return(res);
        }
Exemplo n.º 3
0
        bool ISpiDriver.Xaction_Stop(ref SpiConfiguration Configuration)
        {
            Configuration configuration = SpiConfigurationToConfiguration(Configuration);

            return(EndTransaction(configuration));
        }