diff options
author | Stephane D'Alu <sdalu@sdalu.com> | 2016-05-18 16:04:10 +0200 |
---|---|---|
committer | Stephane D'Alu <sdalu@sdalu.com> | 2016-05-18 16:04:10 +0200 |
commit | 91281015ab24fbcf341224e46b74ffab5540297e (patch) | |
tree | 912a4fe393596a4e3e3fbc2c8503fc685f4518b0 /testhal/NRF51/NRF51822/PWM/main.c | |
parent | b0dd73442bc0e0cd62a963b431aa9a72c6e86953 (diff) | |
download | ChibiOS-Contrib-91281015ab24fbcf341224e46b74ffab5540297e.tar.gz ChibiOS-Contrib-91281015ab24fbcf341224e46b74ffab5540297e.tar.bz2 ChibiOS-Contrib-91281015ab24fbcf341224e46b74ffab5540297e.zip |
allow use of GPIOTE/PPI to drive gpio pin (without callback)
changed value of PAL_NOLINE to -1
Diffstat (limited to 'testhal/NRF51/NRF51822/PWM/main.c')
-rw-r--r-- | testhal/NRF51/NRF51822/PWM/main.c | 13 |
1 files changed, 10 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);
|