Skip to content

Commit a6b744f

Browse files
authored
added named constants
and removed hoardcoded pulse cycle limits
1 parent e99bd4d commit a6b744f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

libraries/Servo/src/nrf52/ServoTimers.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828
* NRF52 Only definitions
2929
* ---------------------
3030
*/
31-
32-
#define MIN_PULSE 55
33-
#define MAX_PULSE 284
31+
//PWM_PRESCALER_PRESCALER_DIV_128 -> NRF_PWM_CLK_125kHz -> resolution 8µs
32+
//MaxValue = 2500 -> PWM period = 20ms
33+
//20ms - 50Hz
34+
#define DUTY_CYCLE_RESOLUTION 8
35+
#define MAXVALUE 2500
36+
#define CLOCKDIV PWM_PRESCALER_PRESCALER_DIV_128
3437

3538
// define one timer in order to have MAX_SERVOS = 12
3639
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
3740

38-
#endif // __SERVO_TIMERS_H__
41+
#endif // __SERVO_TIMERS_H__

0 commit comments

Comments
 (0)