bah oui
Dependents: STM32_Button_Interrupt_dla_taty
Revision 16:ddee20f8438d, committed 2019-06-11
- Comitter:
- rodolphemichel
- Date:
- Tue Jun 11 09:56:00 2019 +0000
- Parent:
- 15:3d3ba015f6af
- Commit message:
- oui
Changed in this revision
Sf18B20.cpp | Show diff for this revision Revisions of this file |
Sf18B20.h | Show diff for this revision Revisions of this file |
diff -r 3d3ba015f6af -r ddee20f8438d Sf18B20.cpp --- a/Sf18B20.cpp Mon Apr 30 07:56:28 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -#include "Sf18B20.h" -Sf18B20::Sf18B20(PinName pin) : DS1820(pin) -{ - dataready = false; -} -void Sf18B20::flip(void) -{ - data18B20 = read(); - dataready = true; - startConversion(); -} -bool Sf18B20::Run(unsigned period) -{ - if (begin()) - { - startConversion(); - dataready = false; - flipper.attach(this,&Sf18B20::flip,period); - return true; - } - return false; -} -void Sf18B20::Stop(void) -{ - flipper.detach(); - dataready = false; -} - -double Sf18B20::Read18B20(void) -{ - return data18B20; -} -bool Sf18B20::DataReady(void) -{ - if (dataready) { - dataready = false; - return true; - } - return false; -}
diff -r 3d3ba015f6af -r ddee20f8438d Sf18B20.h --- a/Sf18B20.h Mon Apr 30 07:56:28 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#ifndef SfDS1820_H_ -#define SfDS1820_H_ -#include "DS1820.h" -class Sf18B20 : public DS1820 -{ -public: - Sf18B20(PinName pin); - bool Run(unsigned period); - void Stop(void); - double Read18B20(void); - bool DataReady(void); -private: - Ticker flipper; - double data18B20; - bool dataready; - void flip(void); -}; -#endif