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.
Dependents: DS1825 DISCO-F746-Dessiccateur-V1 watersenor_and_temp_code DS1820 ... more
Diff: OneWire.h
- Revision:
- 9:4af0015b0f47
- Parent:
- 6:d6e084297fb9
- Child:
- 10:c89b9ad6097c
diff -r 87fbdaba5535 -r 4af0015b0f47 OneWire.h
--- a/OneWire.h	Mon Jan 21 11:37:43 2019 +0000
+++ b/OneWire.h	Sat Jan 26 21:21:27 2019 +0000
@@ -24,11 +24,9 @@
 #define ONEWIRE_CRC 1
 #endif
 
-class OneWire
+class OneWire : public DigitalInOut
 {
-  private:
-    DigitalInOut    wire;
-    Timer           timer;
+    Timer timer;
 
 #if ONEWIRE_SEARCH
     // global search state
@@ -38,7 +36,7 @@
     uint8_t LastDeviceFlag;
 #endif
 
-  public:
+public:
     OneWire(PinName pin);
 
     // Perform a 1-Wire reset cycle. Returns 1 if a device responds
@@ -56,12 +54,12 @@
     // the end for parasitically powered devices. You are responsible
     // for eventually depowering it by calling depower() or doing
     // another read or write.
-    void write(uint8_t v, uint8_t power = 0);
+    void write_byte(uint8_t v, uint8_t power = 0);
 
     void write_bytes(const uint8_t *buf, uint16_t count, bool power = 0);
 
     // Read a byte.
-    uint8_t read(void);
+    uint8_t read_byte(void);
 
     void read_bytes(uint8_t *buf, uint16_t count);
 
@@ -142,3 +140,5 @@
 };
 
 #endif
+
+