gbmanager/ds18b20.h

23 lines
445 B
C
Raw Normal View History

2022-05-31 09:47:29 +02:00
#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