Skip to content

don't reset LEDC channel if it wasn't used by camera #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions target/xclk.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
static const char* TAG = "camera_xclk";
#endif

static ledc_channel_t g_ledc_channel = 0;
#define NO_CAMERA_LEDC_CHANNEL 0xFF
static ledc_channel_t g_ledc_channel = NO_CAMERA_LEDC_CHANNEL;

esp_err_t xclk_timer_conf(int ledc_timer, int xclk_freq_hz)
{
Expand Down Expand Up @@ -60,5 +61,8 @@ esp_err_t camera_enable_out_clock(camera_config_t* config)

void camera_disable_out_clock()
{
ledc_stop(LEDC_LOW_SPEED_MODE, g_ledc_channel, 0);
if (g_ledc_channel != NO_CAMERA_LEDC_CHANNEL) {
ledc_stop(LEDC_LOW_SPEED_MODE, g_ledc_channel, 0);
g_ledc_channel = NO_CAMERA_LEDC_CHANNEL;
}
}