Example #1
0
        // double ledcWriteNote(uint8_t channel, note_t note, uint8_t octave);
        // private const int LEDC_WRITE_NOTE = 703;
        public double ledcWriteNote(int channel, Note note, int octave)
        {
            GpioExtent[] exts = new GpioExtent[] { new GpioExtent() };

            /*
             * p1=channel
             * p2=note
             ## extension ##
             ##int octave
             */

            exts[0].Contents = IntToBytes(octave);

            return((double)GpioCommandExt(LEDC_WRITE_NOTE, channel, (int)note, exts));
        }
Example #2
0
        // esp32-hal-ledc.h: 700~

        // double ledcSetup(uint8_t channel, double freq, uint8_t resolution_bits);
        // private const int LEDC_SETUP = 700;
        public double ledcSetup(int channel, double freq, int resolution_bits)
        {
            GpioExtent[] exts = new GpioExtent[] { new GpioExtent() };

            /*
             * p1=channel
             * p2=freq
             ## extension ##
             ##int resolution_bits
             */

            exts[0].Contents = IntToBytes(resolution_bits);

            return((double)GpioCommandExt(LEDC_SETUP, channel, (int)Math.Round(freq), exts));
        }