From 5cb6b710159e7a727ceb8a197c6aabac6ff6bfef Mon Sep 17 00:00:00 2001 From: tkuyucu Date: Thu, 12 Jun 2014 15:05:44 +0200 Subject: [PATCH] Increase PWM timer precision --- .../targets/hal/TARGET_NORDIC/TARGET_NRF51822/pwmout_api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/pwmout_api.c b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/pwmout_api.c index 748bd76a73..e457e1c311 100644 --- a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/pwmout_api.c +++ b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/pwmout_api.c @@ -19,8 +19,8 @@ #include "error.h" #define NO_PWMS 3 -#define TIMER_PRECISION 8 -#define TIMER_PRESCALER 7 //8us ticks +#define TIMER_PRECISION 4 //4us ticks +#define TIMER_PRESCALER 6 //4us ticks = 16Mhz/(2**6) static const PinMap PinMap_PWM[] = { {p0, PWM_1, 1}, {p1, PWM_1, 1}, @@ -297,7 +297,7 @@ void pwmout_period_us(pwmout_t* obj, int us) { if(periodInTicks>((1<<16) -1)) { - PERIOD = (1<<16 )-1;//262ms + PERIOD = (1<<16 )-1;//131ms } else if(periodInTicks<5){ PERIOD = 5;