Exemple #1
0
 private bool AreMultipleMastersActive(BusMaster currentMaster)
 {
     return(_masters
            .Where(m => !m.Value.IsFloating)
            .Except(new[] { currentMaster })
            .Any());
 }
Exemple #2
0
 private void ThrowIfMultipleMastersAreActive(BusMaster currentMaster)
 {
     if (AreMultipleMastersActive(currentMaster))
     {
         throw new BusConflictException("Multiple masters are active on bus: " + Name);
     }
 }
Exemple #3
0
        private bool AreMultipleMastersActive(BusMaster currentMaster)
        {
            var floating = new BusData(BusWidth);

            return(_masters
                   .Where(m => !m.Value.Equals(floating))
                   .Except(new[] { currentMaster })
                   .Any());
        }
Exemple #4
0
        internal void OnMasterValueChanged(BusMaster busMaster)
        {
            ThrowIfMultipleMastersAreActive(busMaster);
            var value = busMaster.Value;

            if (!Value.Equals(value))
            {
                Value = value;
                ApplyValue(value);
                NotifyChange(busMaster);
            }
        }
Exemple #5
0
        internal void Attach(BusMaster busMaster)
        {
            if (busMaster == null)
            {
                throw new ArgumentNullException(nameof(busMaster));
            }
            if (_masters.Contains(busMaster))
            {
                throw new ArgumentException("Specified BusMaster is already connected.", nameof(busMaster));
            }

            _masters.Add(busMaster);
        }
Exemple #6
0
 public BusChangedEventArgs(BusMaster busMaster, BusData value)
 {
     BusMaster = busMaster;
     Value     = value;
 }
Exemple #7
0
 protected void NotifyChange(BusMaster source)
 {
     OnChanged?.Invoke(this, new BusChangedEventArgs <BusData>(source, Value));
 }
Exemple #8
0
 public BusSlaveOfMaster(BusMaster owner, Bus bus, string name)
     : base(bus, name)
 {
     _owner = owner;
 }
Exemple #9
0
 public BusSlaveOfMaster(BusMaster owner, Bus bus)
     : base(bus)
 {
     _owner = owner;
 }
Exemple #10
0
 public BusSlaveOfMaster(BusMaster owner)
 {
     _owner = owner;
 }