コード例 #1
0
        /// <summary>
        /// Initializes the screen
        /// </summary>
        /// <param name="memoryBitMapAllocation">The memory allocation.</param>
        public Screen(int memoryBitMapAllocation = DefaultMemoryAllocationBitmap)
        {
            if (_isInitialized)
            {
                return;
            }

            MemoryAllocationBitmap = memoryBitMapAllocation;
            BackLightPin           = 32;
            Controller             = new();
            Controller.OpenPin(BackLightPin, PinMode.Output);
            Enabled = true;

            var displaySpiConfig = new SpiConfiguration(
                1,
                ChipSelect,
                DataCommand,
                Reset,
                BackLightPin);

            var screenConfig = new ScreenConfiguration(
                0,
                0,
                320,
                240);

            _ = DisplayControl.Initialize(
                displaySpiConfig,
                screenConfig,
                (uint)MemoryAllocationBitmap);

            _isInitialized = true;
        }
コード例 #2
0
        /// <summary>
        /// Initializes the screen
        /// </summary>
        /// <param name="memoryBitMapAllocation">The memory allocation.</param>
        public Screen(int memoryBitMapAllocation = DefaultMemoryAllocationBitmap)
        {
            if (_isInitialized)
            {
                return;
            }

            // We're allocating enough memory for the full screen because these targets have PSRAM
            MemoryAllocationBitmap = memoryBitMapAllocation;
            // backligth is not controlled by the screen driver
            BackLightPin = -1;

#if M5CORE2
            _power = M5Stack.M5Core2.Power;
#elif TOUGH
            _power = M5Stack.Tough.Power;
#endif

            // Reset screen
            _power.Gpio4Value = PinValue.Low;
            Thread.Sleep(100);
            _power.Gpio4Value = PinValue.High;
            Thread.Sleep(100);

#if TOUGH
            // Reset touch controller
            _power.Gpio1Value = PinValue.Low;
            Thread.Sleep(100);
            _power.Gpio1Value = PinValue.High;
            Thread.Sleep(100);
#endif

            // Create the screen
            var displaySpiConfig = new SpiConfiguration(
                1,
                ChipSelect,
                DataCommand,
                Reset,
                BackLightPin);

            var screenConfig = new ScreenConfiguration(
                0,
                0,
                320,
                240);

            _ = DisplayControl.Initialize(
                displaySpiConfig,
                screenConfig,
                (uint)MemoryAllocationBitmap);

            // set initial value for brightness
            BrightnessPercentage = DefaultScreenBrightness;

            // enable back-light
            Enabled = true;

            _isInitialized = true;
        }
コード例 #3
0
        /// <summary>
        /// Initializes the screen
        /// </summary>
        /// <param name="memoryBitMapAllocation">The memory allocation.</param>
        public Screen(int memoryBitMapAllocation = DefaultMemoryAllocationBitmap)
        {
            if (_isInitialized)
            {
                return;
            }

            MemoryAllocationBitmap = memoryBitMapAllocation;
            // Not used in Stick versions, AXP is doing this
            BackLightPin = -1;

#if M5STICKC
            _power = M5StickC.Power;
#else
            _power = M5StickCPlus.Power;
#endif

            var displaySpiConfig = new SpiConfiguration(
                1,
                ChipSelect,
                DataCommand,
                Reset,
                BackLightPin);

#if M5STICKC
            var screenConfig = new ScreenConfiguration(
                26,
                1,
                80,
                160);
#else
            var screenConfig = new ScreenConfiguration(
                52,
                40,
                135,
                240);
#endif

            _ = DisplayControl.Initialize(
                displaySpiConfig,
                screenConfig,
                (uint)MemoryAllocationBitmap);

            // Enable the screen
            Enabled = true;

            // For M5Stick, values from 2.6 to 3V are working fine
            LuminosityPercentage = 100;
            _power.EnableLDO3(true);
            _isInitialized = true;
        }
コード例 #4
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config, SpiConfiguration spiConfig)
     : base(config, spiConfig)
 {
     _adcConfig = adcConfig;
 }