Exemplo n.º 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);
        }
Exemplo n.º 2
0
        // 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);
        }