-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathds18b20.h
42 lines (27 loc) · 992 Bytes
/
ds18b20.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#ifndef __DS18B20_H__
#define __DS18B20_H__
//#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "common_lib/one_wire.h"
#include "common_lib/utils.h"
#include "common_lib/usart.h"
// Structure for returning list of devices on one wire
typedef struct {
uint8_t size;
one_wire_device *devices;
} ds18b20_devices;
ds18b20_devices ds18b20_init(GPIO_TypeDef *gpio, uint16_t port, TIM_TypeDef *timer);
void ds18b20_set_precision(uint8_t precission);
ds18b20_devices ds18b20_get_devices(bool scan);
void ds18b20_convert_temperature_simple(void);
float ds18b20_read_temperature_simple(void);
void ds18b20_convert_temperature_all(ds18b20_devices devices);
float *ds18b20_read_temperature_all(ds18b20_devices devices);
void ds18b20_wait_for_conversion(void);
float ds18b20_decode_temperature(void);
float ds18b20_get_temperature_simple(void);
float *ds18b20_get_temperature_all(ds18b20_devices devices);
#endif // __DS18B20_H__