示例#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
文件: ControlLine.cs 项目: radtek/MFE
        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);
 }