// void begin(int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1, int8_t ss = -1); // private const int SPI_BEGIN = 1200; public void begin(int sck = -1, int miso = -1, int mosi = -1, int ss = -1) { Esp32If.GpioExtent[] exts = new Esp32If.GpioExtent[] { new Esp32If.GpioExtent(), new Esp32If.GpioExtent(), new Esp32If.GpioExtent() }; /* * p1=spiBus * p2=sck ## extension ## ##int miso ##int mosi ##int ss */ exts[0].Contents = esp32If.IntToBytes(miso); exts[1].Contents = esp32If.IntToBytes(mosi); exts[2].Contents = esp32If.IntToBytes(ss); esp32If.GpioCommandExt(SPI_BEGIN, (int)spiBus, sck, exts); }
// void begin(int sda = -1, int scl = -1, uint32_t frequency = 0); // private const int I2C_BEGIN = 600; public void begin(int sda = -1, int scl = -1, uint frequency = 0) { Esp32If.GpioExtent[] exts = new Esp32If.GpioExtent[] { new Esp32If.GpioExtent(), new Esp32If.GpioExtent() }; /* * p1=busNum * p2=sda ## extension ## ##int scl ##uint frequency */ exts[0].Contents = esp32If.IntToBytes(scl); exts[1].Contents = esp32If.IntToBytes((int)frequency); esp32If.GpioCommandExt(I2C_BEGIN, busNum, sda, exts); }