From 91281015ab24fbcf341224e46b74ffab5540297e Mon Sep 17 00:00:00 2001 From: Stephane D'Alu Date: Wed, 18 May 2016 16:04:10 +0200 Subject: allow use of GPIOTE/PPI to drive gpio pin (without callback) changed value of PAL_NOLINE to -1 --- testhal/NRF51/NRF51822/PWM/main.c | 13 ++++++++++--- testhal/NRF51/NRF51822/PWM/mcuconf.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'testhal') diff --git a/testhal/NRF51/NRF51822/PWM/main.c b/testhal/NRF51/NRF51822/PWM/main.c index b93c3b2..51179d8 100644 --- a/testhal/NRF51/NRF51822/PWM/main.c +++ b/testhal/NRF51/NRF51822/PWM/main.c @@ -39,9 +39,15 @@ int main(void) { .frequency = PWM_FREQUENCY_31250HZ, .period = 31250, .callback = pwm_cb_period, - { {PWM_OUTPUT_ACTIVE_HIGH, pwm_cb_channel0}, - {PWM_OUTPUT_DISABLED, NULL}, - {PWM_OUTPUT_DISABLED, NULL} + { { .mode = PWM_OUTPUT_DISABLED, + .callback = pwm_cb_channel0, }, + { .mode = PWM_OUTPUT_ACTIVE_HIGH, + .callback = NULL, + .ioline = LINE_LED2, + .gpiote_channel = 0, + .ppi_channel = { 0, 1 } }, + { .mode = PWM_OUTPUT_DISABLED, + .callback = NULL, }, }, }; @@ -62,6 +68,7 @@ int main(void) { pwmEnablePeriodicNotification(&PWMD1); pwmEnableChannel(&PWMD1, 0, PWM_FRACTION_TO_WIDTH(&PWMD1, 2, 1)); pwmEnableChannelNotification(&PWMD1, 0); + pwmEnableChannel(&PWMD1, 1, PWM_FRACTION_TO_WIDTH(&PWMD1, 4, 3)); while (1) { chThdSleepMilliseconds(500); diff --git a/testhal/NRF51/NRF51822/PWM/mcuconf.h b/testhal/NRF51/NRF51822/PWM/mcuconf.h index 1694678..374340b 100644 --- a/testhal/NRF51/NRF51822/PWM/mcuconf.h +++ b/testhal/NRF51/NRF51822/PWM/mcuconf.h @@ -25,5 +25,6 @@ #define NRF51_ST_USE_RTC1 FALSE #define NRF51_ST_USE_TIMER0 FALSE #define NRF51_PWM_USE_TIMER0 TRUE +#define NRF51_PWM_USE_GPIOTE_PPI TRUE #endif /* _MCUCONF_H_ */ -- cgit v1.2.3