コード例 #1
0
        private void ConfigureLCD()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();

            lcdConfig.LCDControllerEnabled = true;

            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;

            // Only use if needed, see documentation.
            //lcdConfig.PriorityEnable = true;

            lcdConfig.OutputEnableIsFixed  = true;
            lcdConfig.OutputEnablePolarity = true;

            lcdConfig.HorizontalSyncPolarity = true;
            lcdConfig.VerticalSyncPolarity   = true;
            lcdConfig.PixelPolarity          = false;

            lcdConfig.HorizontalSyncPulseWidth = 1;
            lcdConfig.HorizontalBackPorch      = 46;
            lcdConfig.HorizontalFrontPorch     = 16;
            lcdConfig.VerticalSyncPulseWidth   = 1;
            lcdConfig.VerticalBackPorch        = 23;
            lcdConfig.VerticalFrontPorch       = 7;

            // NOTE: This is used for ChipworkX, comment if using EMX.
            lcdConfig.PixelClockDivider = 5;
            //lcdConfig.PixelClockRate = 25000;

            // Set configs
            DisplayModule.SetLCDConfig(lcdConfig);
        }
コード例 #2
0
        private void ConfigureLCD()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();

            lcdConfig.LCDControllerEnabled = true;

            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;

            // Only use if needed, see documentation.
            lcdConfig.PriorityEnable = false;

            lcdConfig.OutputEnableIsFixed  = false;
            lcdConfig.OutputEnablePolarity = true;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity   = false;
            lcdConfig.PixelPolarity          = false;

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch      = 2;
            lcdConfig.HorizontalFrontPorch     = 2;
            lcdConfig.VerticalSyncPulseWidth   = 10;
            lcdConfig.VerticalBackPorch        = 2;
            lcdConfig.VerticalFrontPorch       = 2;

            lcdConfig.PixelClockDivider = 6;

            // Set configs
            DisplayModule.SetLCDConfig(lcdConfig);
        }
コード例 #3
0
        public static void onPortNameDraw(DisplayModule self,
                                          ref Rectangle rect,
                                          ref Computer computer,
                                          ref Vector2 lockPos)
        {
            var leftMeasure = Vector2.Zero;

            if (Port.Instance.compToInst.ContainsKey(computer))
            {
                foreach (var i in Port.Instance.compToInst[computer])
                {
                    rect.Y    = self.y + 4;
                    lockPos.Y = rect.Y + 4;
                    self.spriteBatch.Draw(Utils.white, rect, i.Unlocked ? self.os.unlockedColor : self.os.lockedColor);
                    self.spriteBatch.Draw(i.Unlocked ? self.openLockSprite : self.lockSprite, lockPos, Color.White);
                    var portLeft = "Port#: " + i.Port.PortDisplay;
                    leftMeasure = GuiData.font.MeasureString(portLeft);
                    self.spriteBatch.DrawString(GuiData.font, portLeft, new Vector2(self.x, self.y + 3), Color.White);
                    var portRight    = " - " + i.Port.PortName;
                    var rightMeasure = GuiData.smallfont.MeasureString(portRight);
                    var width        = rect.Width - leftMeasure.X - 50f;
                    var single1      = Math.Min(1f, width / rightMeasure.X);
                    self.spriteBatch.DrawString(GuiData.smallfont, portRight, new Vector2(self.x + leftMeasure.X, self.y + 4),
                                                Color.White, 0f, Vector2.Zero, single1, SpriteEffects.None, 0.8f);
                    self.y += 45;
                }
            }
        }
コード例 #4
0
        public void DefaultState_CoinsNotInserted_DisplayInsertCoins()
        {
            var sut = new DisplayModule();

            sut.DefaultState();

            Assert.AreEqual("INSERT COINS", sut.ReadOut);
        }
コード例 #5
0
        public void ProductSoldOut_CoinsNotInserted_ReadOfDisplay_FirstDisplayProductPriceThenInsertCoins()
        {
            var sut = new DisplayModule();

            sut.ProductNotAvailable();

            Assert.AreEqual("SOLD OUT", sut.ReadOut);
            Assert.AreEqual("INSERT COINS", sut.ReadOut);
        }
コード例 #6
0
        public void PurchaseMadeInsufficientFunds_CoinsNotInserted_FirstDisplayProductPriceThenInsertCoins()
        {
            var sut = new DisplayModule();

            sut.InsufficientFundsForProduct(.25m);

            Assert.AreEqual("PRICE: $0.25", sut.ReadOut);
            Assert.AreEqual("INSERT COINS", sut.ReadOut);
        }
コード例 #7
0
        public void PurchaseMade_CoinsNotInserted_FirstDisplayThankYouThenInsertCoins()
        {
            var sut = new DisplayModule();

            sut.PurchaseMade();

            Assert.AreEqual("THANK YOU", sut.ReadOut);
            Assert.AreEqual("INSERT COINS", sut.ReadOut);
        }
コード例 #8
0
        public void DefaultState_CoinsInserted_DisplayTotalValue()
        {
            var sut = new DisplayModule();

            sut.UpdateInsertedCoinValue(0.15m);
            sut.DefaultState();

            Assert.AreEqual("$0.15", sut.ReadOut);
        }
コード例 #9
0
        protected sealed override void Init()
        {
            logSource = base.logger;
            Log.Message("Sniper initializing");
            instance = this;


            base.awake += () =>
            {
                SetModdedModule.SetModded();
                ReinCore.AddModHash(guid, Properties.Info.ver, useBuild, useRev, networkVer);
                ConfigModule.CreateAndLoadConfig(this);

                Properties.Tools.RegisterLanguageTokens();
                SoundModule.LoadBank();
                NetworkModule.SetupNetworking();

                Default <Sprite> .value = UIModule.GetUnfinishedIcon();
                UIModule.EditHudPrefab();

                PrefabModule.CreatePrefab();
                DisplayModule.CreateDisplayPrefab();

                CatalogModule.RegisterBody();
                CatalogModule.RegisterSurvivor();
                CatalogModule.RegisterDoTType();
                CatalogModule.RegisterDamageTypes();
                CatalogModule.RegisterBuffTypes();
                CatalogModule.RegisterOrbs();
                CatalogModule.RegisterOverlays();

                VFXModule.Init();

                //UnlocksCore.AddUnlockable<WIPUnlockable>(false);
            };

            base.start += () =>
            {
                //MetaCatalog.LogCatalogState();

                try
                {
                    RoR2.Console.instance.SubmitCmd(null, "spp_disable_survivor Sniper");
                } catch { }
                _ = TextureModule.GetExplosiveAmmoRamp();
                _ = TextureModule.GetPlasmaAmmoRamp();
                _ = TextureModule.GetStandardAmmoRamp();
                _ = TextureModule.GetShockAmmoRamp();
                _ = TextureModule.GetScatterAmmoRamp();
            };

            base.enable      += HooksModule.Add;
            base.disable     += HooksModule.Remove;
            base.fixedUpdate += () => dt = Time.fixedDeltaTime;
            Log.Message("Sniper loaded successfully");
        }
コード例 #10
0
 public Sprite(DisplayModule container, int x, int y, bool EraseOldAfterMove = true)
 {
     _container = container;
     _pos[0]    = x;
     _pos[1]    = y;
     _newPos[0] = x;
     _newPos[1] = y;
     _size[0]   = 0;
     _size[1]   = 0;
 }
コード例 #11
0
        public void ProductSoldOut_CoinsInserted_ReadOfDisplay_FirstDisplayProductPriceThenInsertCoins()
        {
            var sut = new DisplayModule();

            sut.UpdateInsertedCoinValue(.50m);
            sut.ProductNotAvailable();

            Assert.AreEqual("SOLD OUT", sut.ReadOut);
            Assert.AreEqual("$0.50", sut.ReadOut);
        }
コード例 #12
0
        public void PurchaseMadeInsufficientFunds_CoinsInserted_FirstDisplayProductPriceThenInsertCoins()
        {
            var sut = new DisplayModule();

            sut.UpdateInsertedCoinValue(.05m);
            sut.InsufficientFundsForProduct(.25m);

            Assert.AreEqual("PRICE: $0.25", sut.ReadOut);
            Assert.AreEqual("$0.05", sut.ReadOut);
        }
コード例 #13
0
            public async Task <MenuList> __GetCommandsAsync()
            {
                MenuList actions = new MenuList()
                {
                    RenderMode = ModuleAction.RenderModeEnum.IconsOnly
                };

                actions.New(await DisplayModule.GetAction_DisplayAsync(Module.DisplayUrl, Id), ModuleAction.ActionLocationEnum.GridLinks);
                actions.New(Module.GetAction_Remove(Id), ModuleAction.ActionLocationEnum.GridLinks);
                return(actions);
            }
コード例 #14
0
        public static bool onDisplayModuleDraw(DisplayModule self, ref float time)
        {
            var displayModuleDrawEvent = new Event.DisplayModuleDrawEvent(self, time);

            displayModuleDrawEvent.CallEvent();
            if (displayModuleDrawEvent.IsCancelled)
            {
                return(true);
            }
            return(false);
        }
コード例 #15
0
        public Display()
        {
            cd_connected    = new ChangeDetector();
            cd_enabled      = new ChangeDetector();
            cd_voltage      = new ChangeDetector();
            cd_limit        = new ChangeDetector();
            cd_barrelStatus = new ChangeDetector[Shooter.NUMBER_OF_BARRELS];
            cd_barrelPSI    = new ChangeDetector[Shooter.NUMBER_OF_BARRELS];
            for (int i = 0; i < Shooter.NUMBER_OF_BARRELS; i++)
            {
                cd_barrelStatus[i] = new ChangeDetector();
                cd_barrelPSI[i]    = new ChangeDetector();
            }

            DisplayModule _displayModule = new DisplayModule(CTRE.HERO.IO.Port1, DisplayModule.OrientationType.Portrait);

            /* lets pick a font */
            Font _bigFont = Properties.Resources.GetFont(Properties.Resources.FontResources.Freesans_bold_18);
            int  size     = 20;
            int  f_y      = 0;

            _labelConnected = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 0, f_y, 128, size);
            f_y            += size;
            _labelEnabled   = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 0, f_y, 128, size);
            f_y            += size;
            _labelVoltage   = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 0, f_y, 128, size);
            f_y            += size;
            _label_limit    = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 0, f_y, 128, size);

            _labelBarrelStatus = new DisplayModule.LabelSprite[Shooter.NUMBER_OF_BARRELS];
            _labelBarrelPSI    = new DisplayModule.LabelSprite[Shooter.NUMBER_OF_BARRELS];

            f_y = 80;
            _labelBarrelStatus[0] = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 0, f_y, 64, size);
            _labelBarrelStatus[1] = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 64, f_y, 64, size);
            f_y += size;
            _labelBarrelPSI[0] = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 0, f_y, 64, size);
            _labelBarrelPSI[1] = _displayModule.AddLabelSprite(_bigFont, DisplayModule.Color.White, 64, f_y, 64, size);

            if (false)
            {
                // if we are Landscape, then DisplayHeight is the X screen dimension, and DisplayWidth is the Y dimension
                for (int x = 0; x < _displayModule.DisplayWidth; x += 16)
                {
                    _displayModule.AddRectSprite(DisplayModule.Color.White, x, 0, 1, _displayModule.DisplayHeight);
                }
                for (int y = 0; y < _displayModule.DisplayHeight; y += 16)
                {
                    _displayModule.AddRectSprite(DisplayModule.Color.White, 0, y, _displayModule.DisplayWidth, 1);
                }
            }

            RSL_1 = new OutputPort(CTRE.HERO.IO.Port5.Pin6, false);
        }
コード例 #16
0
                internal SimpleGraphicsInterface(DisplayModule renderer)
                {
                    AutoRedraw = true;

                    _backgroundColor = Color.Black;

                    _display = new Bitmap((int)renderer.Width, (int)renderer.Height);

                    _renderer = renderer;

                    Clear();
                }
コード例 #17
0
        protected void Application_Start()
        {
            Database.SetInitializer <LedContext>(new LedDbInitializer());

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // внедрение зависимостей
            NinjectModule autoMapperModule = new AutoMapperModule();
            NinjectModule cityModule       = new CityModule();
            NinjectModule ownerModule      = new OwnerModule();
            NinjectModule displayModule    = new DisplayModule();
            NinjectModule serviceModule    = new ServiceModule("DefaultConnection");

            var kernel = new StandardKernel(autoMapperModule, cityModule, ownerModule, displayModule, serviceModule);

            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
        }
コード例 #18
0
        public HorizGauge(DisplayModule displayModule, int x, int y, int height, int width, DisplayModule.Color topCol, DisplayModule.Color btmCol)
        {
            _displayModule = displayModule;
            _x             = x;
            _y             = y;
            _height        = height;
            _width         = width;

            _left = 0;
            _rght = width;

            _leftCol = topCol;
            _rghtCol = btmCol;

            _backRect = _displayModule.AddRectSprite(DisplayModule.Color.White, x, _y, _left + _rght + 4, _height + 2);

            _leftRect = _displayModule.AddRectSprite(_leftCol, _x + 1, _y + 1, _left + 1, _height);

            _rghtRect = _displayModule.AddRectSprite(_rghtCol, _x + 1 + _left + 1, _y + 1, _rght + 1, _height);
        }
コード例 #19
0
        public VerticalGauge(DisplayModule displayModule, int x, int y, int height, int width, DisplayModule.Color topCol, DisplayModule.Color btmCol)
        {
            _displayModule = displayModule;
            _x             = x;
            _y             = y;
            _height        = height;
            _width         = width;

            _top = 0;
            _btm = height;

            _topCol = topCol;
            _btmCol = btmCol;

            _backRect = _displayModule.AddRectSprite(DisplayModule.Color.White, x, _y, width + 2, _top + _btm + 5);

            _topRect = _displayModule.AddRectSprite(_topCol, _x + 1, _y + 1, _width, _top + 1);

            _btmRect = _displayModule.AddRectSprite(_btmCol, _x + 1, _y + 1 + _top + 1, _width, _btm + 1);
        }
コード例 #20
0
 public LabelSprite(DisplayModule container, Font font, Color color, int x, int y, int width, int height) : base(container, x, y, width, height, false)
 {
     _font  = font;
     _color = color;
 }
コード例 #21
0
ファイル: Display.cs プロジェクト: radtek/MFE
        private void ConfigureDisplay()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();
            lcdConfig.LCDControllerEnabled = false;
            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;
            DisplayModule.SetLCDConfig(lcdConfig);


            #region N22
            WriteCommand(0xCB);
            WriteData(0x39);
            WriteData(0x2C);
            WriteData(0x00);
            WriteData(0x34);
            WriteData(0x02);

            WriteCommand(0xCF);
            WriteData(0x00);
            WriteData(0XC1);
            WriteData(0X30);

            WriteCommand(0xE8);
            WriteData(0x85);
            WriteData(0x00);
            WriteData(0x78);

            WriteCommand(0xEA);
            WriteData(0x00);
            WriteData(0x00);

            WriteCommand(0xED);
            WriteData(0x64);
            WriteData(0x03);
            WriteData(0X12);
            WriteData(0X81);

            WriteCommand(0xF7);
            WriteData(0x20);

            WriteCommand(0xC0); //Power control
            WriteData(0x23);    //VRH[5:0]

            WriteCommand(0xC1); //Power control
            WriteData(0x10);    //SAP[2:0];BT[3:0]

            WriteCommand(0xC5); //VCM control
            WriteData(0x3e);    //Contrast
            WriteData(0x28);

            WriteCommand(0xC7); //VCM control2
            WriteData(0x86);    //--

            WriteCommand(0x36); // Memory Access Control
            WriteData(0x48);

            WriteCommand(0x3A);
            WriteData(0x55);

            WriteCommand(0xB1);
            WriteData(0x00);
            WriteData(0x18);

            WriteCommand(0xB6);    // Display Function Control
            WriteData(0x08);
            WriteData(0x82);
            WriteData(0x27);

            /*
             *  WriteCommand(0xF2);    // 3Gamma Function Disable
             *  WriteData(0x00);
             *
             *  WriteCommand(0x26);    //Gamma curve selected
             *  WriteData(0x01);
             *
             *  WriteCommand(0xE0);    //Set Gamma
             *  WriteData(0x0F);
             *  WriteData(0x31);
             *  WriteData(0x2B);
             *  WriteData(0x0C);
             *  WriteData(0x0E);
             *  WriteData(0x08);
             *  WriteData(0x4E);
             *  WriteData(0xF1);
             *  WriteData(0x37);
             *  WriteData(0x07);
             *  WriteData(0x10);
             *  WriteData(0x03);
             *  WriteData(0x0E);
             *  WriteData(0x09);
             *  WriteData(0x00);
             *
             *  WriteCommand(0XE1);    //Set Gamma
             *  WriteData(0x00);
             *  WriteData(0x0E);
             *  WriteData(0x14);
             *  WriteData(0x03);
             *  WriteData(0x11);
             *  WriteData(0x07);
             *  WriteData(0x31);
             *  WriteData(0xC1);
             *  WriteData(0x48);
             *  WriteData(0x08);
             *  WriteData(0x0F);
             *  WriteData(0x0C);
             *  WriteData(0x31);
             *  WriteData(0x36);
             *  WriteData(0x0F);
             */
            WriteCommand(0x11);    //Exit Sleep
            Thread.Sleep(120);

            WriteCommand(0x29);    //Display on
            WriteCommand(0x2c);
            #endregion

            return;

            #region N18
            WriteCommand(0x11); //Sleep exit
            Thread.Sleep(120);

            //ST7735R Frame Rates
            WriteCommand(0xB1);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);
            WriteCommand(0xB2);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);
            WriteCommand(0xB3);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);

            WriteCommand(0xB4); //Column inversion
            WriteData(0x07);

            //ST7735R Power Sequence
            WriteCommand(0xC0);
            WriteData(0xA2); WriteData(0x02); WriteData(0x84);
            WriteCommand(0xC1); WriteData(0xC5);
            WriteCommand(0xC2);
            WriteData(0x0A); WriteData(0x00);
            WriteCommand(0xC3);
            WriteData(0x8A); WriteData(0x2A);
            WriteCommand(0xC4);
            WriteData(0x8A); WriteData(0xEE);

            WriteCommand(0xC5); //VCOM
            WriteData(0x0E);

            WriteCommand(0x36); //MX, MY, RGB mode
            WriteData(0xC8);

            //ST7735R Gamma Sequence
            WriteCommand(0xe0);
            WriteData(0x0f); WriteData(0x1a);
            WriteData(0x0f); WriteData(0x18);
            WriteData(0x2f); WriteData(0x28);
            WriteData(0x20); WriteData(0x22);
            WriteData(0x1f); WriteData(0x1b);
            WriteData(0x23); WriteData(0x37); WriteData(0x00);

            WriteData(0x07);
            WriteData(0x02); WriteData(0x10);
            WriteCommand(0xe1);
            WriteData(0x0f); WriteData(0x1b);
            WriteData(0x0f); WriteData(0x17);
            WriteData(0x33); WriteData(0x2c);
            WriteData(0x29); WriteData(0x2e);
            WriteData(0x30); WriteData(0x30);
            WriteData(0x39); WriteData(0x3f);
            WriteData(0x00); WriteData(0x07);
            WriteData(0x03); WriteData(0x10);

            WriteCommand(0x2a);
            WriteData(0x00); WriteData(0x00);
            WriteData(0x00); WriteData(0x7f);
            WriteCommand(0x2b);
            WriteData(0x00); WriteData(0x00);
            WriteData(0x00); WriteData(0x9f);

            WriteCommand(0xF0); //Enable test command
            WriteData(0x01);
            WriteCommand(0xF6); //Disable ram power save mode
            WriteData(0x00);

            WriteCommand(0x3A); //65k mode
            WriteData(0x05);

            WriteCommand(0x29);//Display on
            #endregion
        }
コード例 #22
0
        private void UpdateModule()
        {
            /* Display */
            switch (prop_.DisplayMode.Value)
            {
            case DisplayModeType.Oscillo:   disp_mod_ = new Display_Oscillo((uint)prop_.SamplingPoint.Value);  break;

            default:                        disp_mod_ = null;                   break;
            }

            /* Data Collect */
            switch (prop_.DataCollectMode.Value)
            {
            case DataCollectModeType.Value:    data_collect_mod_ = new DataCollect_Value((uint)prop_.DataChannelNum.Value, (uint)prop_.SamplingInterval.Value);    break;

            case DataCollectModeType.ValueSum: data_collect_mod_ = new DataCollect_ValueSum((uint)prop_.DataChannelNum.Value, (uint)prop_.SamplingInterval.Value);    break;

            case DataCollectModeType.Count:    data_collect_mod_ = new DataCollect_Count((uint)prop_.DataChannelNum.Value, (uint)prop_.SamplingInterval.Value);    break;

            default:                           data_collect_mod_ = null;                       break;
            }

            if (data_collect_mod_ != null)
            {
                data_collect_mod_.Sampled += OnDataSampled;
            }

            /* Data Format */
            switch (prop_.DataFormat.Value)
            {
            case DataFormatType.UnsignedByte:     data_format_mod_ = new DataFormat_UnsignedByte();                          break;

            case DataFormatType.UnsignedWord:     data_format_mod_ = new DataFormat_UnsignedWord(prop_.DataEndian.Value);    break;

            case DataFormatType.UnsignedDword:    data_format_mod_ = new DataFormat_UnsignedDword(prop_.DataEndian.Value);   break;

            case DataFormatType.UnsignedQword:    data_format_mod_ = new DataFormat_UnsignedQword(prop_.DataEndian.Value);   break;

            case DataFormatType.SignedByte:       data_format_mod_ = new DataFormat_SignedByte();                            break;

            case DataFormatType.SignedWord:       data_format_mod_ = new DataFormat_SignedWord(prop_.DataEndian.Value);      break;

            case DataFormatType.SignedDword:      data_format_mod_ = new DataFormat_SignedDword(prop_.DataEndian.Value);     break;

            case DataFormatType.SignedQword:      data_format_mod_ = new DataFormat_SignedQword(prop_.DataEndian.Value);     break;

            case DataFormatType.IEEE754_Float:    data_format_mod_ = new DataFormat_IEEE754_Float(prop_.DataEndian.Value);   break;

            case DataFormatType.IEEE754_Double:   data_format_mod_ = new DataFormat_IEEE754_Double(prop_.DataEndian.Value);  break;

            default:                              data_format_mod_ = null;                                                   break;
            }

            if (data_format_mod_ != null)
            {
                data_format_mod_.Extracted += OnDataExtracted;
            }

            UpdateLayerParam();
            UpdateTrackBar();

            PBox_GraphDetails.Refresh();
        }
コード例 #23
0
ファイル: DisplayS22_42.cs プロジェクト: radtek/MFE
        private void ConfigureDisplay()
        {
            DisplayModule.SetLCDConfig(new Mainboard.LCDConfiguration()
            {
                LCDControllerEnabled = false,
                Width  = Width,
                Height = Height
            });

            WriteCommand(0xCB);
            WriteData(0x39);
            WriteData(0x2C);
            WriteData(0x00);
            WriteData(0x34);
            WriteData(0x02);

            WriteCommand(0xCF);
            WriteData(0x00);
            WriteData(0XC1);
            WriteData(0X30);

            WriteCommand(0xE8);
            WriteData(0x85);
            WriteData(0x00);
            WriteData(0x78);

            WriteCommand(0xEA);
            WriteData(0x00);
            WriteData(0x00);

            WriteCommand(0xED);
            WriteData(0x64);
            WriteData(0x03);
            WriteData(0X12);
            WriteData(0X81);

            WriteCommand(0xF7);
            WriteData(0x20);

            WriteCommand(0xC0); //Power control
            WriteData(0x23);    //VRH[5:0]

            WriteCommand(0xC1); //Power control
            WriteData(0x10);    //SAP[2:0];BT[3:0]

            WriteCommand(0xC5); //VCM control
            WriteData(0x3e);    //Contrast
            WriteData(0x28);

            WriteCommand(0xC7); //VCM control2
            WriteData(0x86);    //--

            WriteCommand(0x36); // Memory Access Control
            WriteData(0x48);

            WriteCommand(0x3A);
            WriteData(0x55);

            WriteCommand(0xB1);
            WriteData(0x00);
            WriteData(0x18);

            WriteCommand(0xB6);    // Display Function Control
            WriteData(0x08);
            WriteData(0x82);
            WriteData(0x27);

            /*
             * WriteCommand(0xF2);    // 3Gamma Function Disable
             * WriteData(0x00);
             *
             * WriteCommand(0x26);    //Gamma curve selected
             * WriteData(0x01);
             *
             * WriteCommand(0xE0);    //Set Gamma
             * WriteData(0x0F);
             * WriteData(0x31);
             * WriteData(0x2B);
             * WriteData(0x0C);
             * WriteData(0x0E);
             * WriteData(0x08);
             * WriteData(0x4E);
             * WriteData(0xF1);
             * WriteData(0x37);
             * WriteData(0x07);
             * WriteData(0x10);
             * WriteData(0x03);
             * WriteData(0x0E);
             * WriteData(0x09);
             * WriteData(0x00);
             *
             * WriteCommand(0XE1);    //Set Gamma
             * WriteData(0x00);
             * WriteData(0x0E);
             * WriteData(0x14);
             * WriteData(0x03);
             * WriteData(0x11);
             * WriteData(0x07);
             * WriteData(0x31);
             * WriteData(0xC1);
             * WriteData(0x48);
             * WriteData(0x08);
             * WriteData(0x0F);
             * WriteData(0x0C);
             * WriteData(0x31);
             * WriteData(0x36);
             * WriteData(0x0F);
             */

            WriteCommand(0x11);    //Exit Sleep
            Thread.Sleep(120);

            //WriteCommand(0x28);    //Display off
            WriteCommand(0x29);    //Display on
            WriteCommand(0x2c);

            //WriteCommand(0x21);     // Display inversion ON
            //WriteCommand(0x20);     // Display inversion OFF

            //WriteCommand(0x39);     // Idle mode on
            //WriteCommand(0x38);     // Idle mode off

            WriteCommand(0x51);     // brightness
            WriteData(0x88);        //0x00...0xFF
        }
コード例 #24
0
        public static void Main()
        {
            // Game Controller
            GameController gamepad = new GameController(UsbHostDevice.GetInstance());

            // NinaB Font
            Font ninaB = Properties.Resources.GetFont(Properties.Resources.FontResources.NinaB);

            // Initializing a display module: DisplayModule(port, orientation)
            DisplayModule displayModule = new DisplayModule(CTRE.HERO.IO.Port8, DisplayModule.OrientationType.Landscape);

            while (true)
            {
                // Connect the game controller first so that the sprites show up
                if (gamepad.GetConnectionStatus() == UsbDeviceConnection.Connected)
                {
                    // Erases everything on the display
                    displayModule.Clear();

                    // Adding labels: [Display Module Name].AddLabelSprite(font, colour, x_pos, y_pos, width, height)
                    DisplayModule.LabelSprite title   = displayModule.AddLabelSprite(ninaB, DisplayModule.Color.White, 27, 17, 120, 15);
                    DisplayModule.LabelSprite x_label = displayModule.AddLabelSprite(ninaB, DisplayModule.Color.White, 80, 65, 80, 15);
                    DisplayModule.LabelSprite y_label = displayModule.AddLabelSprite(ninaB, DisplayModule.Color.White, 80, 85, 80, 15);

                    // Adding rectangles: [Display Module Name].AddRectSprite(colour, x_pos, y_pos, width, height)
                    DisplayModule.RectSprite x_rect = displayModule.AddRectSprite(DisplayModule.Color.White, 20, 55, 18, 55);
                    DisplayModule.RectSprite y_rect = displayModule.AddRectSprite(DisplayModule.Color.White, 47, 55, 18, 55);

                    // Everything gets cleared when the game controller is unplugged
                    while (gamepad.GetConnectionStatus() == UsbDeviceConnection.Connected)
                    {
                        // Declares and resets the joystick
                        double x_value = gamepad.GetAxis(0);
                        double y_value = -gamepad.GetAxis(1);
                        if (x_value < 0.05 && x_value > -0.05)
                        {
                            x_value = 0;
                        }
                        if (y_value < 0.05 && y_value > -0.05)
                        {
                            y_value = 0;
                        }

                        // Changes the color of the rectangle (x-value of the left joystick): [Rectangle Name].SetColor(colour)
                        if (x_value > 0.05)
                        {
                            x_rect.SetColor(DisplayModule.Color.Green);
                        }
                        else if (x_value < -0.05)
                        {
                            x_rect.SetColor(DisplayModule.Color.Red);
                        }
                        else
                        {
                            x_rect.SetColor(DisplayModule.Color.White);
                        }

                        // Changes the color of the rectangle (y-value of the left joystick): [Rectangle Name].SetColor(colour)
                        if (y_value > 0.05)
                        {
                            y_rect.SetColor(DisplayModule.Color.Green);
                        }
                        else if (y_value < -0.05)
                        {
                            y_rect.SetColor(DisplayModule.Color.Red);
                        }
                        else
                        {
                            y_rect.SetColor(DisplayModule.Color.White);
                        }

                        // Sets the text that the label displays: [Label Name].SetText(text: string)
                        title.SetText("Joystick Control");
                        x_label.SetText("X: " + x_value.ToString());
                        y_label.SetText("Y: " + y_value.ToString());
                    }
                }
                else
                {
                    // Erases everything on the display
                    displayModule.Clear();

                    // Adding images: [Display Module Name].AddResourceImageSprite(resource_manager, img_ID, img_type, x_pos, y_pos)
                    DisplayModule.ResourceImageSprite image = displayModule.AddResourceImageSprite(Properties.Resources.ResourceManager, Properties.Resources.BinaryResources.img, Bitmap.BitmapImageType.Jpeg, 44, 16);

                    // Adding labels: [Display Module Name].AddLabelSprite(font, colour, x_pos, y_pos, width, height)
                    DisplayModule.LabelSprite text = displayModule.AddLabelSprite(ninaB, DisplayModule.Color.White, 36, 99, 100, 30);

                    // Sets the text that the label displays: [Label Name].SetText(text: string)
                    text.SetText("TAS Robotics");

                    // Keeps the image and text while the gamepad is unplugged
                    while (gamepad.GetConnectionStatus() == UsbDeviceConnection.NotConnected)
                    {
                    }
                }
                System.Threading.Thread.Sleep(100);
            }
        }
コード例 #25
0
ファイル: VideoOut_42.cs プロジェクト: valoni/NETMF-Gadgeteer
        /// <summary>
        /// Selects a resolution based on the passed in value, and sets the mainboard's display configuration and the proper registers
        /// for the module to match the mainboard's display configuration.
        /// </summary>
        /// <remarks>NOTE: Any time the mainboard display configuration is changed, the board will have to reset to apply the changes.
        /// If the same resolution is selected (320x240 RCA to 320x240 VGA) the board will not need to reset.</remarks>
        /// <param name="res">The desired output type and resolution.</param>
        public void SetDisplayConfiguration(VideoOut_InputResolution res)
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();
            lcdConfig.LCDControllerEnabled = true;
            lcdConfig.PriorityEnable       = true;

            switch (res)
            {
                #region 320_240_RCA
            case VideoOut_InputResolution.Output_320x240_RCA:
            {
                lcdConfig.Width  = m_currWidth = 320;
                lcdConfig.Height = m_currHeight = 240;
                Write320x240RCARegisters();
                break;
            }

                #endregion
                #region 640_480_RCA
            case VideoOut_InputResolution.Output_640x480_RCA:
            {
                lcdConfig.Width  = m_currWidth = 640;
                lcdConfig.Height = m_currHeight = 480;
                Write640x480RCARegisters();
                break;
            }

                #endregion
                #region 800_600_RCA
            case VideoOut_InputResolution.Output_800x600_RCA:
            {
                lcdConfig.Width  = m_currWidth = 800;
                lcdConfig.Height = m_currHeight = 600;
                Write800x600RCARegisters();
                break;
            }

                #endregion
                #region 320_240_VGA
            case VideoOut_InputResolution.Output_320x240_VGA:
            {
                lcdConfig.Width  = m_currWidth = 320;
                lcdConfig.Height = m_currHeight = 240;
                Write320x240VGARegisters();
                break;
            }

                #endregion
                #region 640_480_VGA
            case VideoOut_InputResolution.Output_640x480_VGA:
            {
                lcdConfig.Width  = m_currWidth = 640;
                lcdConfig.Height = m_currHeight = 480;
                Write640x480VGARegisters();
                break;
            }

                #endregion
                #region 800_600_VGA
            case VideoOut_InputResolution.Output_800x600_VGA:
            {
                lcdConfig.Width  = m_currWidth = 800;
                lcdConfig.Height = m_currHeight = 600;
                Write800x600VGARegisters();
                break;
            }

                #endregion
            case VideoOut_InputResolution.Output_320x240_RCA_PAL:
            {
                lcdConfig.Width  = m_currWidth = 320;
                lcdConfig.Height = m_currHeight = 240;
                Write320x240VGAPALRegisters();
                break;
            }
            }

            lcdConfig.OutputEnableIsFixed      = false;
            lcdConfig.OutputEnablePolarity     = false;
            lcdConfig.HorizontalSyncPolarity   = true;
            lcdConfig.VerticalSyncPolarity     = true;
            lcdConfig.PixelPolarity            = false;
            lcdConfig.HorizontalSyncPulseWidth = 10;
            lcdConfig.HorizontalBackPorch      = 10;
            lcdConfig.HorizontalFrontPorch     = 10;
            lcdConfig.VerticalSyncPulseWidth   = 10;
            lcdConfig.VerticalBackPorch        = 10;
            lcdConfig.VerticalFrontPorch       = 10;

            // NOTE: This is used for EMX
            lcdConfig.PixelClockDivider = 8;

            // Set config
            DisplayModule.SetLCDConfig(lcdConfig);

            const int CH7025_DID = 0x55;
            const int CH7026_DID = 0x54;

            System.Threading.Thread.Sleep(1000);

            byte ud = I2CRead(0x00);
            if ((ud != CH7025_DID) && (ud != CH7026_DID))
            {
                throw new Exception();// 1; // CH7025/26B was not found
            }
        }
コード例 #26
0
 public RectSprite(DisplayModule container, Color color, int x, int y, int width, int height) : base(container, x, y, width, height, false)
 {
     _color    = color;
     _pixelCol = _container.BitmapConvertPixel(color);
 }
コード例 #27
0
                internal SimpleGraphicsInterface(DisplayModule displayModule)
                {
                    _displayModule = displayModule;
                    _backgroundColor = Color.Black;
                    _autoRedraw = true;

                    _screen = _displayModule._drawingContext.Bitmap;
                    _width = _screen.Width;
                    _height = _screen.Height;

                    Clear();
                }
コード例 #28
0
                /// <summary></summary>
                /// <param name="displayModule">The <see cref="DisplayModule" /> this window belongs to.</param>
                internal Window(DisplayModule displayModule)
                {
                    _displayModule = displayModule;
                    _redirect = displayModule._wpfMode == WpfMode.Separate;

                    if (MediaContextCachedWidth < 0)
                    {
                        int bpp, deg;
                        HardwareProvider.HwProvider.GetLCDMetrics(out MediaContextCachedWidth, out MediaContextCachedHeight, out bpp, out deg);
                    }

                    if (_redirect)
                    {
                        Width = _displayModule._width;
                        Height = _displayModule._height;
                    }
                    else
                    {
                        Width = MediaContextCachedWidth;
                        Height = MediaContextCachedHeight;
                    }
                    Visibility = Microsoft.SPOT.Presentation.Visibility.Visible;
                }
コード例 #29
0
 public ResourceImageSprite(DisplayModule container, int x, int y, System.Resources.ResourceManager resourceMgr, System.Enum resourceID, Bitmap.BitmapImageType imageType) : base(container, x, y)
 {
     _resourceMgr = resourceMgr;
     _resourceID  = resourceID;
     _imageType   = imageType;
 }
コード例 #30
0
        protected override void LateUpdate()
        {
            if (shutdown)
            {
                return;
            }

            if (!HighLogic.LoadedSceneIsFlight || !FlightGlobals.ready)
            {
                return;
            }

            if (SCANcontroller.controller == null)
            {
                way = null;
                return;
            }

            if (!SCANcontroller.controller.mechJebTargetSelection)
            {
                way = null;
                return;
            }

            v = FlightGlobals.ActiveVessel;

            if (v == null)
            {
                SCANcontroller.controller.MechJebLoaded = false;
                way = null;
                return;
            }

            if (v.mainBody != SCANcontroller.controller.LandingTargetBody)
            {
                SCANcontroller.controller.LandingTargetBody = v.mainBody;
            }

            data = SCANUtil.getData(v.mainBody);

            if (data == null)
            {
                SCANcontroller.controller.MechJebLoaded = false;
                way = null;
                return;
            }

            if (v.FindPartModulesImplementing <MechJebCore>().Count <= 0)
            {
                SCANcontroller.controller.MechJebLoaded = false;
                way = null;
                return;
            }

            core = v.GetMasterMechJeb();

            if (core == null)
            {
                SCANcontroller.controller.MechJebLoaded = false;
                way = null;
                return;
            }

            if (HighLogic.CurrentGame.Mode != Game.Modes.SANDBOX)
            {
                if (guidanceModule == null)
                {
                    guidanceModule = (DisplayModule)core.GetComputerModule("MechJebModuleLandingGuidance");
                }

                if (guidanceModule == null)
                {
                    SCANcontroller.controller.MechJebLoaded = false;
                    way = null;
                    return;
                }

                if (!guidanceModule.unlockChecked)
                {
                    return;
                }

                if (guidanceModule.hidden)
                {
                    SCANcontroller.controller.MechJebLoaded = false;
                    shutdown = true;
                    way      = null;
                    return;
                }
            }

            target = core.target;

            if (target == null)
            {
                SCANcontroller.controller.MechJebLoaded = false;
                way = null;
                return;
            }

            if (!SCANcontroller.controller.MechJebLoaded)
            {
                SCANcontroller.controller.MechJebLoaded = true;
                RenderingManager.AddToPostDrawQueue(1, drawTarget);
            }

            if (SCANcontroller.controller.LandingTarget != null)
            {
                way = SCANcontroller.controller.LandingTarget;
            }

            if (SCANcontroller.controller.TargetSelecting)
            {
                way             = null;
                selectingTarget = true;
                if (SCANcontroller.controller.TargetSelectingActive)
                {
                    selectingInMap = true;
                }
                else
                {
                    selectingInMap = false;
                }
                coords = SCANcontroller.controller.LandingTargetCoords;
                return;
            }
            else if (selectingTarget)
            {
                selectingTarget = false;
                if (selectingInMap)
                {
                    selectingInMap = false;
                    coords         = SCANcontroller.controller.LandingTargetCoords;
                    way            = new SCANwaypoint(coords.y, coords.x, siteName);
                    target.SetPositionTarget(SCANcontroller.controller.LandingTargetBody, way.Latitude, way.Longitude);
                }
            }

            selectingInMap  = false;
            selectingTarget = false;

            if (target.Target == null)
            {
                way = null;
                return;
            }

            if (target.targetBody != v.mainBody)
            {
                way = null;
                return;
            }

            if (!(target.Target is PositionTarget))
            {
                way = null;
                return;
            }

            coords.x = target.targetLongitude;
            coords.y = target.targetLatitude;

            if (way != null)
            {
                if (!SCANUtil.ApproxEq(coords.x, way.Longitude) || !SCANUtil.ApproxEq(coords.y, way.Latitude))
                {
                    way = new SCANwaypoint(coords.y, coords.x, siteName);
                    SCANcontroller.controller.LandingTarget = way;
                    data.addToWaypoints();
                }
            }
            else
            {
                way = new SCANwaypoint(coords.y, coords.x, siteName);
                SCANcontroller.controller.LandingTarget = way;
                data.addToWaypoints();
            }
        }
コード例 #31
0
                internal SimpleGraphicsInterface(DisplayModule renderer)
                {
                    AutoRedraw = true;

                    _backgroundColor = Color.Black;

                    _display = new Bitmap((int)renderer.Width, (int)renderer.Height);

                    _renderer = renderer;

                    Clear();
                }
コード例 #32
0
        private void ConfigureDisplay()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();

            lcdConfig.LCDControllerEnabled = false;
            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;

            DisplayModule.SetLCDConfig(lcdConfig);

            this.WriteCommand(0x11);            //Sleep exit
            Thread.Sleep(120);

            //ST7735R Frame Rate
            this.WriteCommand(0xB1);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);
            this.WriteCommand(0xB2);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);
            this.WriteCommand(0xB3);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);

            this.WriteCommand(0xB4); //Column inversion
            this.WriteData(0x07);

            //ST7735R Power Sequence
            this.WriteCommand(0xC0);
            this.WriteData(0xA2); this.WriteData(0x02); this.WriteData(0x84);
            this.WriteCommand(0xC1); this.WriteData(0xC5);
            this.WriteCommand(0xC2);
            this.WriteData(0x0A); this.WriteData(0x00);
            this.WriteCommand(0xC3);
            this.WriteData(0x8A); this.WriteData(0x2A);
            this.WriteCommand(0xC4);
            this.WriteData(0x8A); this.WriteData(0xEE);

            this.WriteCommand(0xC5); //VCOM
            this.WriteData(0x0E);

            this.WriteCommand(0x36); //MX, MY, RGB mode
            this.WriteData(0xC8);

            //ST7735R Gamma Sequence
            this.WriteCommand(0xe0);
            this.WriteData(0x0f); this.WriteData(0x1a);
            this.WriteData(0x0f); this.WriteData(0x18);
            this.WriteData(0x2f); this.WriteData(0x28);
            this.WriteData(0x20); this.WriteData(0x22);
            this.WriteData(0x1f); this.WriteData(0x1b);
            this.WriteData(0x23); this.WriteData(0x37); this.WriteData(0x00);

            this.WriteData(0x07);
            this.WriteData(0x02); this.WriteData(0x10);
            this.WriteCommand(0xe1);
            this.WriteData(0x0f); this.WriteData(0x1b);
            this.WriteData(0x0f); this.WriteData(0x17);
            this.WriteData(0x33); this.WriteData(0x2c);
            this.WriteData(0x29); this.WriteData(0x2e);
            this.WriteData(0x30); this.WriteData(0x30);
            this.WriteData(0x39); this.WriteData(0x3f);
            this.WriteData(0x00); this.WriteData(0x07);
            this.WriteData(0x03); this.WriteData(0x10);

            this.WriteCommand(0x2a);
            this.WriteData(0x00); this.WriteData(0x00);
            this.WriteData(0x00); this.WriteData(0x7f);
            this.WriteCommand(0x2b);
            this.WriteData(0x00); this.WriteData(0x00);
            this.WriteData(0x00); this.WriteData(0x9f);

            this.WriteCommand(0xF0); //Enable test command
            this.WriteData(0x01);
            this.WriteCommand(0xF6); //Disable ram power save mode
            this.WriteData(0x00);

            this.WriteCommand(0x3A); //65k mode
            this.WriteData(0x05);

            this.WriteCommand(0x29);            //Display on
        }