Пример #1
0
        /// <summary>
        /// Creates a new instance of Lis302Dl class
        /// </summary>
        /// <param name="csPin">CS pin for SPI interface</param>
        /// <param name="spiModule">SPI module</param>
        /// <param name="Clock_Rate_KHZ">SPI clock rate (defaults to 1 MHz in other constructors)</param>
        /// <param name="config">LIS302DL configuration</param>
        public Lis302Dl(Cpu.Pin csPin, SPI.SPI_module spiModule, uint Clock_Rate_KHZ, Lis302Dl.Configuration config)
        {
            SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, Clock_Rate_KHZ, spiModule);
            _spi = new SPI(spiConfig);

            this.config = config;
            Init();
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance of Lis302Dl class
        /// </summary>
        /// <param name="csPin">CS pin for SPI interface</param>
        /// <param name="config">LIS302DL configuration</param>
        public Lis302Dl(Cpu.Pin csPin, Lis302Dl.Configuration config)
        {
            // The 302DL is a mode 3 device
            SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, 10000, SPI.SPI_module.SPI1);
            _spi = new SPI(spiConfig);

            this.config = config;
            Init();
        }
Пример #3
0
        /// <summary>
        /// Creates a new instance of Lis302Dl class with standard configuration (400Hz, Active Power, 2g, not test, all axis enabled)
        /// </summary>
        /// <param name="csPin">CS pin for SPI interface</param>
        /// <param name="config">LIS302DL configuration</param>
        public Lis302Dl(Cpu.Pin csPin)
        {
            // The 302DL is a mode 3 device
            SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, 10000, SPI.SPI_module.SPI1);
            _spi = new SPI(spiConfig);

            this.config = new Configuration()
            {
                DataRate = DataRate.Rate400Hz, PowerDown = PowerDown.Active, Scale = Scale.Scale2g, SelfTest = false, EnableX = true, EnableZ = true, EnableY = true
            };
            Init();
        }
Пример #4
0
        /// <summary>
        /// Creates a new instance of Lis302Dl class
        /// </summary>
        /// <param name="csPin">CS pin for SPI interface</param>
        /// <param name="spiModule">SPI module</param>
        /// <param name="Clock_Rate_KHZ">SPI clock rate (defaults to 1 MHz in other constructors)</param>
        /// <param name="config">LIS302DL configuration</param>
        public Lis302Dl(Cpu.Pin csPin, SPI.SPI_module spiModule, uint Clock_Rate_KHZ, Lis302Dl.Configuration config)
        {
            SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, Clock_Rate_KHZ, spiModule);
            _spi = new SPI(spiConfig);

            this.config = config;
            Init();
        }
Пример #5
0
        /// <summary>
        /// Creates a new instance of Lis302Dl class
        /// </summary>
        /// <param name="csPin">CS pin for SPI interface</param>        
        /// <param name="config">LIS302DL configuration</param>
        public Lis302Dl(Cpu.Pin csPin, Lis302Dl.Configuration config)
        {
            // The 302DL is a mode 3 device
            SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, 10000, SPI.SPI_module.SPI1);
            _spi = new SPI(spiConfig);

            this.config = config;
            Init();
        }
Пример #6
0
        /// <summary>
        /// Creates a new instance of Lis302Dl class with standard configuration (400Hz, Active Power, 2g, not test, all axis enabled)
        /// </summary>
        /// <param name="csPin">CS pin for SPI interface</param>        
        /// <param name="config">LIS302DL configuration</param>
        public Lis302Dl(Cpu.Pin csPin)
        {
            // The 302DL is a mode 3 device
            SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, 10000, SPI.SPI_module.SPI1);
            _spi = new SPI(spiConfig);

            this.config = new Configuration() { DataRate = DataRate.Rate400Hz, PowerDown = PowerDown.Active, Scale = Scale.Scale2g, SelfTest = false, EnableX = true, EnableZ = true, EnableY = true };
            Init();
        }