Skip to content

Commit 1970a02

Browse files
author
Martino Facchin
committed
pulseIn: fix tabs and use port defines
1 parent 35f7428 commit 1970a02

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

hardware/arduino/avr/cores/arduino/wiring_pulse.S

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ret
5757

5858

5959
countPulseASM_B:
60-
push r17
60+
push r17
6161
mov r24,r1
6262
mov r25,r1
6363
loop_b:
@@ -73,18 +73,18 @@ cpi r17, 0
7373
breq loop_b
7474
//sbic PINB-0x20, 7
7575
//rjmp loop
76-
ret_belay_b:
76+
ret_delay_b:
7777
rjmp exit_b
7878
return_zero_b:
7979
mov r24,r1
8080
mov r25,r1
8181
exit_b:
82-
pop r17
82+
pop r17
8383
ret
8484

8585

8686
countPulseASM_C:
87-
push r17
87+
push r17
8888
mov r24,r1
8989
mov r25,r1
9090
loop_c:
@@ -100,18 +100,18 @@ cpi r17, 0
100100
breq loop_c
101101
//sbic PINC-0x20, 7
102102
//rjmp loop
103-
ret_celay_c:
103+
ret_delay_c:
104104
rjmp exit_c
105105
return_zero_c:
106106
mov r24,r1
107107
mov r25,r1
108108
exit_c:
109-
pop r17
109+
pop r17
110110
ret
111111

112112

113113
countPulseASM_D:
114-
push r17
114+
push r17
115115
mov r24,r1
116116
mov r25,r1
117117
loop_d:
@@ -133,5 +133,5 @@ return_zero_d:
133133
mov r24,r1
134134
mov r25,r1
135135
exit_d:
136-
pop r17
136+
pop r17
137137
ret

hardware/arduino/avr/cores/arduino/wiring_pulse.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout)
5858
unsigned long width = 0; // keep initialization out of time critical area
5959

6060
switch (port) {
61-
case 2:
61+
case PA:
62+
//portA
63+
countPulseASM = &countPulseASM_A;
64+
break;
65+
case PB:
6266
//portB
6367
countPulseASM = &countPulseASM_B;
6468
break;
65-
case 3:
69+
case PC:
6670
//portC
6771
countPulseASM = &countPulseASM_C;
6872
break;
69-
case 4:
73+
case PD:
7074
//portD
7175
countPulseASM = &countPulseASM_D;
7276
break;

0 commit comments

Comments
 (0)