fix pulseIn compile issue #219

use C for countPulseASM
This commit is contained in:
hathach committed 2019-01-23 17:30:40 +07:00
1 parent b9a9453abc
commit cc6366ec06
3 files changed
+27 -3

No files matched your search

+1
View File
@@ -8,6 +8,7 @@
- Added setRssiCallback(), monitorRssi(), getRssi(), stopRssi() for tracking rssi of a connection
- rssi_poll and rssi_callback example sketches are added
- Change BLECharacteristic callback signature BLECharacteristic& to BLECharacteristic*
- Use AdaCallback thread for BLECharacteristic callbacks
# 0.9.3
+22
View File
@@ -23,6 +23,28 @@
// See pulse_asm.S
extern unsigned long countPulseASM(const volatile uint32_t *port, uint32_t bit, uint32_t stateMask, unsigned long maxloops);
unsigned long countPulseASM(const volatile uint32_t *port, uint32_t bit, uint32_t stateMask, unsigned long maxloops)
{
unsigned long width = 0;
// wait for any previous pulse to end
while ((*port & bit) == stateMask)
if (--maxloops == 0)
return 0;
// wait for the pulse to start
while ((*port & bit) != stateMask)
if (--maxloops == 0)
return 0;
// wait for the pulse to stop
while ((*port & bit) == stateMask) {
if (++width == maxloops)
return 0;
}
return width;
}
/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
* to 3 minutes in length, but must be called at least a few dozen microseconds
+4 -3
View File
@@ -58,9 +58,9 @@ using the command line:
The result has been slightly edited to increase readability.
*/
.cpu cortex-m0plus
.fpu softvfp
/*
.cpu cortex-m4
.fpu fpv4-sp-d16
.eabi_attribute 20, 1 @ Tag_ABI_FP_denormal
.eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions
.eabi_attribute 23, 3 @ Tag_ABI_FP_number_model
@@ -173,3 +173,4 @@ countPulseASM:
pop {r4, r5, pc}
.size countPulseASM, .-countPulseASM
.ident "GCC: (GNU Tools for ARM Embedded Processors (Arduino build)) 4.8.3 20140228 (release) [ARM/embedded-4_8-branch revision 208322]"
*/