Skip to content

Commit

Permalink
Use timerClock() instead of predefined constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ezshinoda committed Mar 3, 2020
1 parent d2f3b48 commit f34f692
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(), CAMERA_CONTROL_PWM_RESOLUTION, 0, cameraControlRuntime.inverted);

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

0 comments on commit f34f692

Please sign in to comment.