예제 #1
0
        private void InputGpioVal(String val, string type)
        {
            String value = val;

            try
            {
                byte gp_value = Convert.ToByte(value, 16);

                if (type == "mode")
                {
                    FormatGPIOModeVal(gp_value);
                    _gpio.InitSuperIO();
                    _gpio.SetGpioMode(gp_value);
                    _gpio.ExitSuperIo();
                }
                else
                {
                    FormatGPIOOutVal(gp_value);
                    _gpio.InitSuperIO();
                    _gpio.SetGpioOutValue(gp_value);
                    _gpio.ExitSuperIo();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please enter 0-255 hexadecimal data!");
                return;
            }
        }
예제 #2
0
        private void Init()
        {
            _gpio = new Gpio();
            bool initResult = _gpio.Initialize();

            if (!initResult)
            {
                error.Visibility   = Visibility.Visible;
                mode_btn.IsEnabled = false;
                out_btn.IsEnabled  = false;
            }
            else
            {
                _gpio.InitSuperIO();

                chip_type.Content = _gpio.GetChipName();

                _gpio.InitGpioReg();
                InitGpioModeAndVal();

                _gpio.ExitSuperIo();

                AddTextChangeEvent();

                chip_type.Visibility = Visibility.Visible;
                chip_name.Visibility = Visibility.Visible;
            }
        }