Skip to content

Commit 7eada85

Browse files
committed
pulseIn() function should take user-level pin number (i.e. same pin numbers as digitalRead/Write). The comment suggests that that was intended but was never implemented.
1 parent e663794 commit 7eada85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/nRF5/pulse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ extern unsigned long countPulseASM(const volatile uint32_t *port, uint32_t bit,
2727
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
2828
* to 3 minutes in length, but must be called at least a few dozen microseconds
2929
* before the start of the pulse. */
30-
uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout)
30+
uint32_t pulseIn(uint32_t ulPin, uint32_t state, uint32_t timeout)
3131
{
3232
// cache the port and bit of the pin in order to speed up the
3333
// pulse width measuring loop and achieve finer resolution. calling
3434
// digitalRead() instead yields much coarser resolution.
3535
// PinDescription p = g_APinDescription[pin];
36-
uint32_t bit = 1 << pin; //p.ulPin;
36+
uint32_t bit = 1 << digitalPinToPin(ulPin);
3737
uint32_t stateMask = state ? bit : 0;
3838

3939
// convert the timeout from microseconds to a number of times through

0 commit comments

Comments
 (0)