Loading...
Searching...
No Matches
ds18.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Frits Kuipers
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
38#ifndef DS18_H
39#define DS18_H
40
41#include <stdint.h>
42
43#include "periph/gpio.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
53#define DS18_OK (0)
54#define DS18_ERROR (-1)
65
69typedef struct {
71} ds18_t;
72
83int ds18_init(ds18_t *dev, const ds18_params_t *params);
84
94int ds18_trigger(const ds18_t *dev);
95
105int ds18_read(const ds18_t *dev, int16_t *temperature);
106
120int ds18_get_temperature(const ds18_t *dev, int16_t *temperature);
121
122#ifdef __cplusplus
123}
124#endif
125
127#endif /* DS18_H */
Low-level GPIO peripheral driver interface definitions.
int ds18_read(const ds18_t *dev, int16_t *temperature)
Reads the scratchpad for the last conversion.
int ds18_get_temperature(const ds18_t *dev, int16_t *temperature)
convenience function for triggering a conversion and reading the value
int ds18_trigger(const ds18_t *dev)
Triggers a temperature conversion.
int ds18_init(ds18_t *dev, const ds18_params_t *params)
Initialize a ds18 device.
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:82
Device initialization parameters.
Definition ds18.h:60
gpio_mode_t in_mode
Pin input mode (usually deduced from output mode)
Definition ds18.h:63
gpio_t pin
Pin the sensor is connected to.
Definition ds18.h:61
gpio_mode_t out_mode
Pin output mode.
Definition ds18.h:62
Device descriptor for a ds18 device.
Definition ds18.h:69
ds18_params_t params
Device Parameters.
Definition ds18.h:70