diff options
Diffstat (limited to 'testhal')
-rw-r--r-- | testhal/NRF51/NRF51822/PWM/main.c | 13 | ||||
-rw-r--r-- | testhal/NRF51/NRF51822/PWM/mcuconf.h | 1 |
2 files changed, 11 insertions, 3 deletions
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_ */
|