コード例 #1
0
        // private const int AD9833_APPLY_SIGNAL = (AD9833_BASE + 1);
        public void ApplySignal(WaveformType waveType, Registers freqReg,
                                double frequencyInHz,
                                Registers phaseReg = Registers.SAME_AS_REG0, double phaseInDeg = 0.0)
        {
            Esp32If.GpioExtent[] exts = new Esp32If.GpioExtent[] {
                new Esp32If.GpioExtent(),
                new Esp32If.GpioExtent(),
                new Esp32If.GpioExtent()
            };

            /*
             * p1=waveType
             * p2=freqReg
             ## extension ##
             ##double frequencyInHz
             ##Registers phaseReg
             ##double phaseInDeg
             */

            exts[0].Contents = esp32If.IntToBytes((int)(frequencyInHz * 10));
            exts[1].Contents = esp32If.IntToBytes((int)phaseReg);
            exts[2].Contents = esp32If.IntToBytes((int)(phaseInDeg * 1000));

            esp32If.GpioCommandExt(AD9833_APPLY_SIGNAL, (int)waveType, (int)freqReg, exts);
        }
コード例 #2
0
        // void drawString(int16_t x, int16_t y, String text);
        // private const int OLEDDISPLAY_DRAW_STRING = 1617;
        public void drawString(int x, int y, string text)
        {
            Esp32If.GpioExtent[] exts = new Esp32If.GpioExtent[] { new Esp32If.GpioExtent() };

            /*
             * p1=x
             * p2=y
             ## extension ##
             ##char text[len]
             */

            exts[0].Contents = System.Text.Encoding.UTF8.GetBytes(text + "\0");             /* include null byte */

            esp32If.GpioCommandExt(OLEDDISPLAY_DRAW_STRING, x, y, exts);
        }
コード例 #3
0
ファイル: OLEDDisplay.cs プロジェクト: flin1009/Esp32IfTest
        // void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
        // private const int OLEDDISPLAY_DRAW_LINE = (OLEDDISPLAY_BASE + 6);
        public void drawLine(int x0, int y0, int x1, int y1)
        {
            Esp32If.GpioExtent[] exts = new Esp32If.GpioExtent[] {
                new Esp32If.GpioExtent(),
                new Esp32If.GpioExtent()
            };

            /*
             * p1=x0
             * p2=y0
             ## extension ##
             ##int x1
             ##int y1
             */

            exts[0].Contents = esp32If.IntToBytes(x1);
            exts[1].Contents = esp32If.IntToBytes(y1);

            esp32If.GpioCommandExt(OLEDDISPLAY_DRAW_LINE, x0, y0, exts);
        }