예제 #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);
 }