On the ESP32 platform, you can use the LEDC PWM driver to generate programmable dead time by setting the duty
(i.e. length of pulse) and hpoint
(time offset of pulse) appropriately.
#include <driver/ledc.h>
ledc_timer_config_t ledc_timer = { .speed_mode = LEDC_LOW_SPEED_MODE, .duty_resolution = LEDC_TIMER_8_BIT, .timer_num = LEDC_TIMER_0, .freq_hz = 100000, .clk_cfg = LEDC_AUTO_CLK }; ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer)); uint32_t deadTime = 20; // Large value to show clearly on the oscilloscope ledc_channel_config_t ledc_noninverted_channel = { .gpio_num = GPIO_NUM_10, .speed_mode = LEDC_LOW_SPEED_MODE, .channel = LEDC_CHANNEL_0, .intr_type = LEDC_INTR_DISABLE, .timer_sel = LEDC_TIMER_0, .duty = 127-deadTime/2, // Set duty to 50% .hpoint = 0 }; ESP_ERROR_CHECK(ledc_channel_config(&ledc_noninverted_channel)); ledc_channel_config_t ledc_complementary_channel = { .gpio_num = GPIO_NUM_11, .speed_mode = LEDC_LOW_SPEED_MODE, .channel = LEDC_CHANNEL_1, .intr_type = LEDC_INTR_DISABLE, .timer_sel = LEDC_TIMER_0, .duty = 127-deadTime/2, // Set cycle to start just after 50% .hpoint = 127, }; ESP_ERROR_CHECK(ledc_channel_config(&ledc_complementary_channel));