summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-08-17 16:54:03 -0700
committerGitHub <noreply@github.com>2018-08-17 16:54:03 -0700
commit1a6f6ff8e44688b2cd49ab6b6170d17cdf23fb23 (patch)
tree324aa23edab934ad140284a316e8dc057ae6817e
parent4a4d84ba42fb84032b31344e14fc3bb1f9e8dce2 (diff)
parent18e9f747381a342aa86d7ad28cf8fe8bf725038f (diff)
Merge pull request #1122 from Jahor/patch-1
Fix PWM Support on port 1 of NRF52840
-rw-r--r--ports/nrf/common-hal/pulseio/PWMOut.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/nrf/common-hal/pulseio/PWMOut.c b/ports/nrf/common-hal/pulseio/PWMOut.c
index c85b77fcd..0f1461092 100644
--- a/ports/nrf/common-hal/pulseio/PWMOut.c
+++ b/ports/nrf/common-hal/pulseio/PWMOut.c
@@ -146,7 +146,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
// check if mapped to PWM channel already
for(int i=0; i<PWM_MAX_MODULE; i++)
{
- int ch = pin2channel(pwm_arr[i], pin->pin);
+ int ch = pin2channel(pwm_arr[i], NRF_GPIO_PIN_MAP(pin->port, pin->pin));
if ( ch >= 0 )
{
self->pwm = pwm_arr[i];
@@ -168,7 +168,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
// disable before mapping pin channel
self->pwm->ENABLE = 0;
- self->pwm->PSEL.OUT[self->channel] = pin->pin;
+ self->pwm->PSEL.OUT[self->channel] = NRF_GPIO_PIN_MAP(pin->port, pin->pin);
self->pwm->COUNTERTOP = (PWM_MAX_FREQ/frequency);
self->freq = frequency;