private void LoadGpioData(TypeEnum type) { log_box.AppendText("\r\n"); log_box.AppendText("Load " + type.ToString() + " GPIO Data."); switch (type) { case TypeEnum.Q300P: gpio.SetGpioFunction(0x2c, 0x89); LoadGpioModel(TypeEnum.Q300P); LoadGpioValue(TypeEnum.Q300P); break; case TypeEnum.Q500G6: LoadGpioModel(TypeEnum.Q500G6); LoadGpioValue(TypeEnum.Q500G6); break; case TypeEnum.Q600P: LoadGpioModel(TypeEnum.Q600P); LoadGpioValue(TypeEnum.Q600P); break; default: break; } }
public static void SetGpioValues(SuperIO gpio, string[] arr) { string gpio_v = string.Join("", arr); byte data = Convert.ToByte(gpio_v, 2); gpio.SetGpioFunction(0xa07, data); }
public static void SetGpioModels(SuperIO gpio, string[] arr) { string gpio_m = string.Join("", arr); byte data = Convert.ToByte(gpio_m, 2); gpio.SetGpioFunction(0xcf, data); }
public static void SetGpioModels(SuperIO gpio, string[] arr, GPIOView view) { //先取出原始数据,然后将输入框内的数据替换进来 //enable gp56 57 60 61 29h<6> gp65 29<7> //output/input gp56:cc<6> gp57:cc<7> gpio.SetGpioFunction(0x29, 0x80); byte b1 = gpio.ReadGpioPortByte(0xcc); string m1 = Utils.ByteToBinaryStr(b1).Remove(0, 2).Insert(0, arr[1] + arr[0]); byte gp_data1 = Convert.ToByte(m1, 2); gpio.SetGpioFunction(0xcc, gp_data1); string gp56_57 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcc)); //Console.WriteLine("-----------gp56 57 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcc))); //Console.WriteLine("-----------m1:" + m1); //output/input gp60:cd<0> gp61:cd<1> gp65:cd<5> byte b2 = gpio.ReadGpioPortByte(0xcd); string m2 = Utils.ByteToBinaryStr(b2).Remove(2, 1).Insert(2, arr[4]).Remove(6, 2).Insert(6, arr[3] + arr[2]); byte gp_data2 = Convert.ToByte(m2, 2); gpio.SetGpioFunction(0xcd, gp_data2); string gp60_61_65 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcd)); //Console.WriteLine("-----------gp60 61 65 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcd))); //Console.WriteLine("-----------m2:" + m2); //enable gp40 28h<default=00> gpio.SetGpioFunction(0x28, 0x01); byte b3 = gpio.ReadGpioPortByte(0xcb); string m3 = Utils.ByteToBinaryStr(b3).Remove(7, 1).Insert(7, arr[5]); byte gp_data3 = Convert.ToByte(m3, 2); gpio.SetGpioFunction(0xcb, gp_data3); string gp40 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcb)); //Console.WriteLine("-----------gp40 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcb))); //Console.WriteLine("-----------m3:" + m3); //enable gp22,23 26h<default=F3> gpio.SetGpioFunction(0x26, 0xff); byte b4 = gpio.ReadGpioPortByte(0xc9); string m4 = Utils.ByteToBinaryStr(b4).Remove(4, 2).Insert(4, arr[7] + arr[6]); byte gp_data4 = Convert.ToByte(m4, 2); gpio.SetGpioFunction(0xc9, gp_data4); string gp22_23 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xc9)); //Console.WriteLine("-----------gp22 23 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xc9))); //Console.WriteLine("-----------m4:" + m4); view.Dispatcher.Invoke((Action) delegate() { GPIOView.logTox.Text += "\r\nQ600P GPIO Output/input configure:"; GPIOView.logTox.Text += "\r\nGP56 GP57 Output/input old byte: " + Utils.ByteToBinaryStr(b1); GPIOView.logTox.Text += "\r\nGP56 GP57 Output/input new byte: " + m1; GPIOView.logTox.Text += "\r\nGP56 GP57 Output/input read byte: " + gp56_57; GPIOView.logTox.Text += "\r\nGP60 GP61 GP65 Output/input old byte: " + Utils.ByteToBinaryStr(b2); GPIOView.logTox.Text += "\r\nGP60 GP61 GP65 Output/input new byte: " + m2; GPIOView.logTox.Text += "\r\nGP60 GP61 GP65 Output/input read byte: " + gp60_61_65; GPIOView.logTox.Text += "\r\nGP40 Output/input old byte: " + Utils.ByteToBinaryStr(b3); GPIOView.logTox.Text += "\r\nGP40 Output/input new byte: " + m3; GPIOView.logTox.Text += "\r\nGP40 Output/input read byte: " + gp40; GPIOView.logTox.Text += "\r\nGP22 GP23 Output/input old byte: " + Utils.ByteToBinaryStr(b4); GPIOView.logTox.Text += "\r\nGP22 GP23 Output/input new byte: " + m4; GPIOView.logTox.Text += "\r\nGP22 GP23 Output/input read byte: " + gp22_23; }); }
public static void SetGpioValues(SuperIO gpio, string[] arr, GPIOView view) { //先取出原始数据,然后将输入框内的数据替换进来 gpio.SetGpioFunction(0x29, 0xc0);//gp56 56 60 61 62 65 enable //pin polarity gp56 57 b4<6 7> byte b1 = gpio.ReadGpioPortByte(0xb4); string v1 = Utils.ByteToBinaryStr(b1).Remove(0, 2).Insert(0, arr[1] + arr[0]); byte gp_data1 = Convert.ToByte(v1, 2); gpio.SetGpioFunction(0xb4, gp_data1); string gp56_57 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb4)); //Console.WriteLine("-----------gp56 57:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb4))); //Console.WriteLine("-----------v1:" + v1); //pin polarity gp60 61 65 b5<0 1 5> //gpio.SetGpioFunction(0x2a, 0x0b); //byte b2 = gpio.ReadGpioPortByte(0xa05); byte b2 = gpio.ReadGpioPortByte(0xb5); string v2 = Utils.ByteToBinaryStr(b2).Remove(2, 1).Insert(2, arr[4]).Remove(6, 2).Insert(6, arr[3] + arr[2]); byte gp_data2 = Convert.ToByte(v2, 2); //gpio.SetGpioFunction(0xa05, gp_data2); gpio.SetGpioFunction(0xb5, gp_data2); string gp60_61_65 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb5)); //Console.WriteLine("-----------gp60 61 65:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb5))); //Console.WriteLine("-----------v2:" + v2); //pin polarity gp40 28h<0> gpio.SetGpioFunction(0x28, 0x01); byte b3 = gpio.ReadGpioPortByte(0xb3); string v3 = Utils.ByteToBinaryStr(b3).Remove(7, 1).Insert(7, arr[5]); byte gp_data3 = Convert.ToByte(v3, 2); gpio.SetGpioFunction(0xb3, gp_data3); string gp40 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb3)); //Console.WriteLine("-----------gp40:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb3))); //Console.WriteLine("-----------v3:" + v3); //pin polarity gp22,23 26h<2 3> gpio.SetGpioFunction(0x26, 0xff); byte b4 = gpio.ReadGpioPortByte(0xb1); string v4 = Utils.ByteToBinaryStr(b4).Remove(4, 2).Insert(4, arr[7] + arr[6]); byte gp_data4 = Convert.ToByte(v4, 2); gpio.SetGpioFunction(0xb1, gp_data4); string gp22_23 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb1)); //Console.WriteLine("-----------gp22 23:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb1))); //Console.WriteLine("-----------v4:" + v4); view.Dispatcher.Invoke((Action) delegate() { GPIOView.logTox.Text += "\r\nQ600P GPIO Pin polarity configure:"; GPIOView.logTox.Text += "\r\nGP56 GP57 Pin polarity old byte: " + Utils.ByteToBinaryStr(b1); GPIOView.logTox.Text += "\r\nGP56 GP57 Pin polarity new byte: " + v1; GPIOView.logTox.Text += "\r\nGP56 GP57 Pin polarity read byte: " + gp56_57; GPIOView.logTox.Text += "\r\nGP60 GP61 GP65 Pin polarity old byte: " + Utils.ByteToBinaryStr(b2); GPIOView.logTox.Text += "\r\nGP60 GP61 GP65 Pin polarity new byte: " + v2; GPIOView.logTox.Text += "\r\nGP60 GP61 GP65 Pin polarity read byte: " + gp60_61_65; GPIOView.logTox.Text += "\r\nGP40 Pin polarity old byte: " + Utils.ByteToBinaryStr(b3); GPIOView.logTox.Text += "\r\nGP40 Pin polarity new byte: " + v3; GPIOView.logTox.Text += "\r\nGP40 Pin polarity read byte: " + gp40; GPIOView.logTox.Text += "\r\nGP22 GP23 Pin polarity old byte: " + Utils.ByteToBinaryStr(b4); GPIOView.logTox.Text += "\r\nGP22 GP23 Pin polarity new byte: " + v4; GPIOView.logTox.Text += "\r\nGP22 GP23 Pin polarity read byte: " + gp22_23; }); }
public static void SetGpioValues(SuperIO gpio, string[] arr, GPIOView view) { //gp51 29h<1> default=46 //pin polarity b4h<1> gpio.SetGpioFunction(0x29, 0x46); byte b1 = gpio.ReadGpioPortByte(0xb4); string v1 = Utils.ByteToBinaryStr(b1).Remove(6, 1).Insert(6, arr[0]); byte data1 = Convert.ToByte(v1, 2); gpio.SetGpioFunction(0xb4, data1); string gp51 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb4)); //Console.WriteLine("-----------gp51 value:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb4))); //Console.WriteLine("-----------v1:" + v1); //gp37 gp36 27h<7 6> default=c0 //pin polarity b2h<7 6> gpio.SetGpioFunction(0x27, 0xc0); byte b2 = gpio.ReadGpioPortByte(0xb2); string v2 = Utils.ByteToBinaryStr(b2).Remove(0, 2).Insert(0, arr[1] + arr[2]); byte data2 = Convert.ToByte(v2, 2); gpio.SetGpioFunction(0xb2, data2); string gp37_36 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb2)); //Console.WriteLine("-----------gp37 gp36 value:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb2))); //Console.WriteLine("-----------v2:" + v2); //gp23 26h<3> default=08 //pin polarity b1h<3> gpio.SetGpioFunction(0x26, 0x08); byte b3 = gpio.ReadGpioPortByte(0xb1); string v3 = Utils.ByteToBinaryStr(b3).Remove(4, 1).Insert(4, arr[3]); byte data3 = Convert.ToByte(v3, 2); gpio.SetGpioFunction(0xb1, data3); string gp23 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb1)); //Console.WriteLine("-----------gp23 value:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb1))); //Console.WriteLine("-----------v3:" + v3); //gp12 gp10 25h<2 0> default=05 //pin polarity b0h<2 0> gpio.SetGpioFunction(0x25, 0x05); byte b4 = gpio.ReadGpioPortByte(0xb0); string v4 = Utils.ByteToBinaryStr(b4).Remove(5, 1).Insert(5, arr[4]).Remove(7, 1).Insert(7, arr[7]); byte data4 = Convert.ToByte(v4, 2); gpio.SetGpioFunction(0xb0, data4); string gp12_10 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb0)); //Console.WriteLine("-----------gp12 gp10 value:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb0))); //Console.WriteLine("-----------v4:" + v4); //gp62 29h<6> default=46 //pin polarity b5h<2> gpio.SetGpioFunction(0x29, 0x46); byte b5 = gpio.ReadGpioPortByte(0xb5); string v5 = Utils.ByteToBinaryStr(b5).Remove(5, 1).Insert(5, arr[5]); byte data5 = Convert.ToByte(v5, 2); gpio.SetGpioFunction(0xb5, data5); string gp62 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb5)); //Console.WriteLine("-----------gp62 value:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb5))); //Console.WriteLine("-----------v5:" + v5); //gp40 28h<0> default=01 //pin polarity b3h<0> gpio.SetGpioFunction(0x28, 0x01); byte b6 = gpio.ReadGpioPortByte(0xb3); string v6 = Utils.ByteToBinaryStr(b6).Remove(7, 1).Insert(7, arr[6]); byte data6 = Convert.ToByte(v6, 2); gpio.SetGpioFunction(0xb3, data6); string gp40 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb3)); //Console.WriteLine("-----------gp40 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xb3))); //Console.WriteLine("-----------v6:" + v6); view.Dispatcher.Invoke((Action) delegate() { GPIOView.logTox.Text += "\r\nQ500G6 GPIO Pin polarity configure:"; GPIOView.logTox.Text += "\r\nGP51 Pin polarity old byte: " + Utils.ByteToBinaryStr(b1); GPIOView.logTox.Text += "\r\nGP51 Pin polarity new byte: " + v1; GPIOView.logTox.Text += "\r\nGP51 Pin polarity read byte: " + gp51; GPIOView.logTox.Text += "\r\nGP37 GP36 Pin polarity old byte: " + Utils.ByteToBinaryStr(b2); GPIOView.logTox.Text += "\r\nGP37 GP36 Pin polarity new byte: " + v2; GPIOView.logTox.Text += "\r\nGP37 GP36 Pin polarity read byte: " + gp37_36; GPIOView.logTox.Text += "\r\nGP23 Pin polarity old byte: " + Utils.ByteToBinaryStr(b3); GPIOView.logTox.Text += "\r\nGP23 Pin polarity new byte: " + v3; GPIOView.logTox.Text += "\r\nGP23 Pin polarity read byte: " + gp23; GPIOView.logTox.Text += "\r\nGP12 GP10 Pin polarity old byte: " + Utils.ByteToBinaryStr(b4); GPIOView.logTox.Text += "\r\nGP12 GP10 Pin polarity new byte: " + v4; GPIOView.logTox.Text += "\r\nGP12 GP10 Pin polarity read byte: " + gp12_10; GPIOView.logTox.Text += "\r\nGP62 Pin polarity old byte: " + Utils.ByteToBinaryStr(b5); GPIOView.logTox.Text += "\r\nGP62 Pin polarity new byte: " + v5; GPIOView.logTox.Text += "\r\nGP62 Pin polarity read byte: " + gp62; GPIOView.logTox.Text += "\r\nGP40 Pin polarity old byte: " + Utils.ByteToBinaryStr(b6); GPIOView.logTox.Text += "\r\nGP40 Pin polarity new byte: " + v6; GPIOView.logTox.Text += "\r\nGP40 Pin polarity read byte: " + gp40; }); }
public static void SetGpioModels(SuperIO gpio, string[] arr, GPIOView view) { //gp51 29h<1> default=46 //output/input cch<1> gpio.SetGpioFunction(0x29, 0x46); byte b1 = gpio.ReadGpioPortByte(0xcc); string m1 = Utils.ByteToBinaryStr(b1).Remove(6, 1).Insert(6, arr[0]); byte data1 = Convert.ToByte(m1, 2); gpio.SetGpioFunction(0xcc, data1); string gp51 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcc)); //Console.WriteLine("-----------gp51 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcc))); //Console.WriteLine("-----------m1:" + m1); //gp37 gp36 27h<7 6> default=c0 //output/input cah<7 6> gpio.SetGpioFunction(0x27, 0xc0); byte b2 = gpio.ReadGpioPortByte(0xca); string m2 = Utils.ByteToBinaryStr(b2).Remove(0, 2).Insert(0, arr[1] + arr[2]); byte data2 = Convert.ToByte(m2, 2); gpio.SetGpioFunction(0xca, data2); string gp37_36 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xca)); //Console.WriteLine("-----------gp37 gp36 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xca))); //Console.WriteLine("-----------m2:" + m2); //gp23 26h<3> default=08 //output/input c9h<3> gpio.SetGpioFunction(0x26, 0x08); byte b3 = gpio.ReadGpioPortByte(0xc9); string m3 = Utils.ByteToBinaryStr(b3).Remove(4, 1).Insert(4, arr[3]); byte data3 = Convert.ToByte(m3, 2); gpio.SetGpioFunction(0xc9, data3); string gp23 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xc9)); //Console.WriteLine("-----------gp23 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xc9))); //Console.WriteLine("-----------m3:" + m3); //gp12 gp10 25h<2 0> default=05 //output/input c8h<2 0> gpio.SetGpioFunction(0x25, 0x05); byte b4 = gpio.ReadGpioPortByte(0xc8); string m4 = Utils.ByteToBinaryStr(b4).Remove(5, 1).Insert(5, arr[4]).Remove(7, 1).Insert(7, arr[7]); byte data4 = Convert.ToByte(m4, 2); gpio.SetGpioFunction(0xc8, data4); string gp12_10 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xc8)); //Console.WriteLine("-----------gp12 gp10 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xc8))); //Console.WriteLine("-----------m4:" + m4); //gp62 29h<6> default=46 //output/input cdh<1> gpio.SetGpioFunction(0x29, 0x46); byte b5 = gpio.ReadGpioPortByte(0xcd); string m5 = Utils.ByteToBinaryStr(b5).Remove(5, 1).Insert(5, arr[5]); byte data5 = Convert.ToByte(m5, 2); gpio.SetGpioFunction(0xcd, data5); string gp62 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcd)); //Console.WriteLine("-----------gp51 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcd))); //Console.WriteLine("-----------m5:" + m5); //gp40 28h<0> default=01 //output/input cbh<0> gpio.SetGpioFunction(0x28, 0x01); byte b6 = gpio.ReadGpioPortByte(0xcb); string m6 = Utils.ByteToBinaryStr(b6).Remove(7, 1).Insert(7, arr[6]); byte data6 = Convert.ToByte(m6, 2); gpio.SetGpioFunction(0xcb, data6); string gp40 = Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcb)); //Console.WriteLine("-----------gp40 model:" + Utils.ByteToBinaryStr(gpio.ReadGpioPortByte(0xcb))); //Console.WriteLine("-----------m6:" + m6); view.Dispatcher.Invoke((Action) delegate() { GPIOView.logTox.Text += "\r\nQ500G6 GPIO Output/input configure:"; GPIOView.logTox.Text += "\r\nGP51 Output/input old byte: " + Utils.ByteToBinaryStr(b1); GPIOView.logTox.Text += "\r\nGP51 Output/input new byte: " + m1; GPIOView.logTox.Text += "\r\nGP51 Output/input read byte: " + gp51; GPIOView.logTox.Text += "\r\nGP37 GP36 Output/input old byte: " + Utils.ByteToBinaryStr(b2); GPIOView.logTox.Text += "\r\nGP37 GP36 Output/input new byte: " + m2; GPIOView.logTox.Text += "\r\nGP37 GP36 Output/input read byte: " + gp37_36; GPIOView.logTox.Text += "\r\nGP23 Output/input old byte: " + Utils.ByteToBinaryStr(b3); GPIOView.logTox.Text += "\r\nGP23 Output/input new byte: " + m3; GPIOView.logTox.Text += "\r\nGP23 Output/input read byte: " + gp23; GPIOView.logTox.Text += "\r\nGP12 GP10 Output/input old byte: " + Utils.ByteToBinaryStr(b4); GPIOView.logTox.Text += "\r\nGP12 GP10 Output/input new byte: " + m4; GPIOView.logTox.Text += "\r\nGP12 GP10 Output/input read byte: " + gp12_10; GPIOView.logTox.Text += "\r\nGP62 Output/input old byte: " + Utils.ByteToBinaryStr(b5); GPIOView.logTox.Text += "\r\nGP62 Output/input new byte: " + m5; GPIOView.logTox.Text += "\r\nGP62 Output/input read byte: " + gp62; GPIOView.logTox.Text += "\r\nGP40 Output/input old byte: " + Utils.ByteToBinaryStr(b6); GPIOView.logTox.Text += "\r\nGP40 Output/input new byte: " + m6; GPIOView.logTox.Text += "\r\nGP40 Output/input read byte: " + gp40; }); }