FabGL
ESP32 VGA Controller and Graphics Library

◆ begin()

void fabgl::SquareWaveGeneratorClass::begin ( bool  div1_onGPIO0,
gpio_num_t  div2 = GPIO_NUM_39,
gpio_num_t  div4 = GPIO_NUM_39,
gpio_num_t  div8 = GPIO_NUM_39,
gpio_num_t  div16 = GPIO_NUM_39,
gpio_num_t  div32 = GPIO_NUM_39,
gpio_num_t  div64 = GPIO_NUM_39,
gpio_num_t  div128 = GPIO_NUM_39,
gpio_num_t  div256 = GPIO_NUM_39 
)

Initialize SquareWaveGeneratorClass and associate GPIOs to the outputs.

Parameters
div1_onGPIO0If true the undivided frequency is delivered on GPIO0.
div2Specifies the GPIO where to send frequency / 2 (set GPIO_NUM_39 to disable output).
div4Specifies the GPIO where to send frequency / 4 (set GPIO_NUM_39 to disable output).
div8Specifies the GPIO where to send frequency / 8 (set GPIO_NUM_39 to disable output).
div16Specifies the GPIO where to send frequency / 16 (set GPIO_NUM_39 to disable output).
div32Specifies the GPIO where to send frequency / 32 (set GPIO_NUM_39 to disable output).
div64Specifies the GPIO where to send frequency / 64 (set GPIO_NUM_39 to disable output).
div128Specifies the GPIO where to send frequency / 128 (set GPIO_NUM_39 to disable output).
div256Specifies the GPIO where to send frequency / 256 (set GPIO_NUM_39 to disable output).

Example:

// Outputs 25Mhz on GPIO0 and 6.25Mhz on GPIO5, for 5 seconds
SquareWaveGenerator.begin(true, GPIO_NUM_39, GPIO_NUM_5);
SquareWaveGenerator.play(25000000);
delay(5000);
// Outputs 20Mhz on GPIO and 5Mhz on GPIO5, for 10 seconds
SquareWaveGenerator.play(20000000);
delay(10000);
SquareWaveGenerator.stop();