Пример #1
0
        public SPIClass(Esp32If esp32If, SPIBus spiBus = SPIBus.HSPI)
        {
            if ((int)spiBus < 1 || 3 < (int)spiBus)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (inUse.Contains(spiBus))
            {
                throw new ArgumentException("SPI bus already in use");
            }
            inUse.Add(spiBus);

            this.esp32If = esp32If;
            this.spiBus  = spiBus;
        }
Пример #2
0
        public TwoWire(Esp32If esp32If, int busNum)
        {
            if (busNum < 0 || 1 < busNum)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (inUse.Contains(busNum))
            {
                throw new ArgumentException("I2C bus already in use");
            }
            inUse.Add(busNum);

            this.esp32If = esp32If;
            this.busNum  = busNum;
        }