Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: OneWire.cpp
- Revision:
- 13:573a546ef5f9
- Parent:
- 12:27a1b359b95c
diff -r 27a1b359b95c -r 573a546ef5f9 OneWire.cpp
--- a/OneWire.cpp Sun Mar 10 13:17:38 2019 +0000
+++ b/OneWire.cpp Wed Mar 13 10:05:02 2019 +0000
@@ -187,20 +187,21 @@
*/
uint8_t OneWire::read_bit(void)
{
- const int SAMPLE_POINT = 10;
+ //const int SAMPLE_POINT = 9; // 10 works for f401re
uint8_t r;
- int t;
+ //int t;
OUTPUT();
WRITE(0);
- timer.start();
+ //timer.start();
INPUT();
- t = timer.read_us();
- if (t < SAMPLE_POINT)
- WAIT_US(SAMPLE_POINT - t);
+ //t = timer.read_us();
+ //if (t < SAMPLE_POINT)
+ // WAIT_US(SAMPLE_POINT - t);
+ WAIT_US(1);
r = READ();
- timer.stop();
- timer.reset();
+ //timer.stop();
+ //timer.reset();
WAIT_US(55);
//printf("t = %d\r\n", t);
return r;