Пример #1
0
        public ControlLine(BusMasterBase busHub, BusModule busModule, ControlLineType type, byte address)
        {
            BusHub = busHub;
            BusModule = busModule;
            Type = type;
            Address = address;

            for (byte i = 0; i < state.Length; i++)
                state[i] = 0;
        }
Пример #2
0
        public ControlLine(BusMasterBase busHub, BusModule busModule, ControlLineType type, byte address)
        {
            BusHub    = busHub;
            BusModule = busModule;
            Type      = type;
            Address   = address;

            for (byte i = 0; i < state.Length; i++)
            {
                state[i] = 0;
            }
        }
Пример #3
0
        protected override void ScanModules(out ArrayList modulesAdded, out ArrayList modulesRemoved)
        {
            modulesAdded   = new ArrayList();
            modulesRemoved = new ArrayList();

            for (byte address = 1; address <= 127; address++)
            {
                byte type = (byte)BusModuleType.Unknown;

                var config = new I2CDevice.Configuration(address, BusConfigurationI2C.ClockRate);                         // config for I2C-module with "address"
                if (busConfig.Bus.TryGetRegister(config, BusConfigurationI2C.Timeout, BusModuleAPI.CmdGetType, out type)) // query module
                {
                    // module with this address is online;
                    // check if it's already registered in BusModules:

                    BusModule busModule = this[new byte[] { address }];

                    if (busModule == null) // module with this address isn't registered
                    {
                        busModule = new BusModule(this, new byte[] { address }, (BusModuleType)type);

                        // query module control lines count with updating lines states:
                        //busModule.QueryControlLines(true);

                        // register this module in BusModules:
                        modulesAdded.Add(busModule);
                        BusModules.Add(busModule);
                    }
                    else // module with this address is already registered
                    {
                        // updated when added;
                    }
                }
                else
                {
                    // module with this address is offline;
                    // check if it's already registered in BusModules:

                    BusModule busModule = this[new byte[] { address }];

                    if (busModule != null) // offline module
                    {
                        modulesRemoved.Add(busModule);
                        BusModules.Remove(busModule);
                    }
                }
            }
        }
Пример #4
0
        protected override void ScanModules(out ArrayList modulesAdded, out ArrayList modulesRemoved)
        {
            modulesAdded = new ArrayList();
            modulesRemoved = new ArrayList();

            for (byte address = 1; address <= 127; address++)
            {
                byte type = (byte)BusModuleType.Unknown;

                var config = new I2CDevice.Configuration(address, BusConfigurationI2C.ClockRate); // config for I2C-module with "address"
                if (busConfig.Bus.TryGetRegister(config, BusConfigurationI2C.Timeout, BusModuleAPI.CmdGetType, out type)) // query module
                {
                    // module with this address is online;
                    // check if it's already registered in BusModules:

                    BusModule busModule = this[new byte[] { address }];

                    if (busModule == null) // module with this address isn't registered
                    {
                        busModule = new BusModule(this, new byte[] { address }, (BusModuleType)type);

                        // query module control lines count with updating lines states:
                        //busModule.QueryControlLines(true);

                        // register this module in BusModules:
                        modulesAdded.Add(busModule);
                        BusModules.Add(busModule);
                    }
                    else // module with this address is already registered
                    {
                        // updated when added;
                    }
                }
                else
                {
                    // module with this address is offline;
                    // check if it's already registered in BusModules:

                    BusModule busModule = this[new byte[] { address }];

                    if (busModule != null) // offline module
                    {
                        modulesRemoved.Add(busModule);
                        BusModules.Remove(busModule);
                    }
                }
            }
        }
Пример #5
0
 internal override bool BusModuleWrite(BusModule busModule, byte[] request)
 {
     I2CDevice.Configuration config = new I2CDevice.Configuration(busModule.Address[0], BusConfigurationI2C.ClockRate);
     return(busConfig.Bus.TrySet(config, BusConfigurationI2C.Timeout, request));
 }
Пример #6
0
 internal abstract bool BusModuleWrite(BusModule busModule, byte[] request);
Пример #7
0
 internal abstract bool BusModuleWriteRead(BusModule busModule, byte[] request, byte[] response);
Пример #8
0
 internal override bool BusModuleWriteRead(BusModule busModule, byte[] request, byte[] response)
 {
     return false;
 }
Пример #9
0
 internal override bool BusModuleWrite(BusModule busModule, byte[] request)
 {
     return false;
 }
Пример #10
0
 internal override bool BusModuleWriteRead(BusModule busModule, byte[] request, byte[] response)
 {
     I2CDevice.Configuration config = new I2CDevice.Configuration(busModule.Address[0], BusConfigurationI2C.ClockRate);
     return busConfig.Bus.TryGet(config, BusConfigurationI2C.Timeout, request, response);
 }
Пример #11
0
 internal abstract bool BusModuleWriteRead(BusModule busModule, byte[] request, byte[] response);
Пример #12
0
 internal abstract bool BusModuleWrite(BusModule busModule, byte[] request);
Пример #13
0
 internal override bool BusModuleWrite(BusModule busModule, byte[] request)
 {
     return(false);
 }
Пример #14
0
 internal override bool BusModuleWriteRead(BusModule busModule, byte[] request, byte[] response)
 {
     return(false);
 }