gbmanager/ds18b20.h

23 lines
No EOL
445 B
C++

#ifndef DS18B20_H
#define DS18B20_H
#include "ds18b20.pio.h"
#include "hardware/gpio.h"
#include "pico/stdlib.h"
class DS18B20 {
public:
DS18B20(PIO pio, uint8_t gpio);
float getTemperature();
void convert();
private:
uint8_t crc8(uint8_t *data, uint8_t len);
void writeBytes(uint8_t bytes[], int len);
void readBytes(uint8_t bytes[], int len);
PIO pio;
uint8_t gpio;
uint stateMachineIndex;
};
#endif