bah oui

Dependencies:   OneWire

Dependents:   STM32_Button_Interrupt_dla_taty

Sf18B20.cpp

Committer:
schnf30
Date:
2018-04-30
Revision:
14:f375b7de7856

File content as of revision 14:f375b7de7856:

#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;
}