예제 #1
0
 public void Remove(Gpio gpio)
 {
     if (GetGpio(gpio.Identifier) == null)
     {
         throw new ArgumentException("Gpio not found");
     }
     lock (this) {
         BasicTypeSerializer.Put(SendContext, (byte)Command.UndefineDigitalGpio);
         BasicTypeSerializer.Put(SendContext, (byte)gpio.Identifier);
         SetLed(LedType.Digital, (uint)gpio.Identifier, LedState.Off, false);
         Execute();
         Gpios[(int)gpio.Identifier] = null;
     }
 }
예제 #2
0
 public Gpio Add(Gpio gpio)
 {
     if (GetGpio(gpio.Identifier) != null)
     {
         throw new ArgumentException("Gpio already defined");
     }
     lock (this) {
         Gpios[(int)gpio.Identifier] = gpio;
         BasicTypeSerializer.Put(SendContext, (byte)Command.DefineDigitalGpio);
         gpio.SerializeDefinition(SendContext);
         SetLed(LedType.Digital, (uint)gpio.Identifier, LedState.On, false);
         Execute();
         return(gpio);
     }
 }