aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorFabio Utzig <utzig@utzig.org>2016-05-29 14:17:02 -0300
committerFabio Utzig <utzig@utzig.org>2016-05-29 14:17:02 -0300
commit3597ad7ed5266cf1a308d4c97974908fd9e94757 (patch)
tree4feca078fdc16bfd9a43bae1ce5a79c993c7c8e4 /testhal
parent209c3566776302eddb7819ff6c6dcfc645edff90 (diff)
parent91281015ab24fbcf341224e46b74ffab5540297e (diff)
downloadChibiOS-Contrib-3597ad7ed5266cf1a308d4c97974908fd9e94757.tar.gz
ChibiOS-Contrib-3597ad7ed5266cf1a308d4c97974908fd9e94757.tar.bz2
ChibiOS-Contrib-3597ad7ed5266cf1a308d4c97974908fd9e94757.zip
Merge pull request #77 from sdalu/pwm_ppi
allow use of GPIOTE/PPI in PWM to drive gpio pin
Diffstat (limited to 'testhal')
-rw-r--r--testhal/NRF51/NRF51822/PWM/main.c13
-rw-r--r--testhal/NRF51/NRF51822/PWM/mcuconf.h1
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_ */