Skip to content

Commit

Permalink
Merge pull request #9537 from jflyper/bfdev-camera-control-use-timerc…
Browse files Browse the repository at this point in the history
…lock

[Camera Control] Use timerClock() instead of predefined constant
  • Loading branch information
mikeller committed Mar 4, 2020
1 parent 88820c9 commit fec6523
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/main/drivers/camera_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
#include "time.h"
#include "pg/pg_ids.h"

#if defined(STM32F40_41xxx)
#define CAMERA_CONTROL_TIMER_HZ MHZ_TO_HZ(84)
#elif defined(STM32F7)
#define CAMERA_CONTROL_TIMER_HZ MHZ_TO_HZ(216)
#else
#define CAMERA_CONTROL_TIMER_HZ MHZ_TO_HZ(72)
#endif

#define CAMERA_CONTROL_PWM_RESOLUTION 128
#define CAMERA_CONTROL_SOFT_PWM_RESOLUTION 448

Expand Down Expand Up @@ -143,7 +135,7 @@ void cameraControlInit(void)
IOConfigGPIOAF(cameraControlRuntime.io, IOCFG_AF_PP, timerHardware->alternateFunction);
#endif

pwmOutConfig(&cameraControlRuntime.channel, timerHardware, CAMERA_CONTROL_TIMER_HZ, CAMERA_CONTROL_PWM_RESOLUTION, 0, cameraControlRuntime.inverted);
pwmOutConfig(&cameraControlRuntime.channel, timerHardware, timerClock(TIM6), CAMERA_CONTROL_PWM_RESOLUTION, 0, cameraControlRuntime.inverted);

cameraControlRuntime.period = CAMERA_CONTROL_PWM_RESOLUTION;
*cameraControlRuntime.channel.ccr = cameraControlRuntime.period;
Expand Down

0 comments on commit fec6523

Please sign in to comment.