lps331ap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
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 
23 #ifndef LPS331AP_H
24 #define LPS331AP_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include <stdint.h>
31 #include "periph/i2c.h"
32 
36 #define LPS331AP_DEFAULT_ADDRESS 0x5c
37 
41 typedef struct {
43  uint8_t address;
44 } lps331ap_t;
45 
49 typedef enum {
55 
59 typedef struct {
61  uint8_t addr;
64 
76 int lps331ap_init(lps331ap_t *dev, i2c_t i2c, uint8_t address, lps331ap_rate_t rate);
77 
86 
95 
104 int lps331ap_enable(lps331ap_t *dev);
105 
114 int lps331ap_disable(lps331ap_t *dev);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif /* LPS331AP_H */
121 
sample with 25Hz
Definition: lps331ap.h:53
sample with 12.5Hz
Definition: lps331ap.h:52
Device descriptor for LPS331AP sensors.
Definition: lps331ap.h:41
int lps331ap_disable(lps331ap_t *dev)
Disable the given sensor.
int lps331ap_init(lps331ap_t *dev, i2c_t i2c, uint8_t address, lps331ap_rate_t rate)
Initialize a given LPS331AP pressure sensor.
int lps331ap_read_pres(lps331ap_t *dev)
Read a pressure value from the given sensor, returned in mbar.
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:104
lps331ap_rate_t rate
tell sensor to sample with this rate
Definition: lps331ap.h:62
i2c_t i2c
I2C bus the sensor is connected to.
Definition: lps331ap.h:60
i2c_t i2c
I2C device the sensor is connected to.
Definition: lps331ap.h:42
uint8_t address
I2C bus address of the sensor.
Definition: lps331ap.h:43
sample with 1Hz
Definition: lps331ap.h:50
int lps331ap_read_temp(lps331ap_t *dev)
Read a temperature value from the given sensor, returned in m°C.
int lps331ap_enable(lps331ap_t *dev)
Enable the given sensor.
sample with 7Hz
Definition: lps331ap.h:51
lps331ap_rate_t
Possible sampling rates for LPS331AP sensors.
Definition: lps331ap.h:49
uint8_t addr
the devices address on the bus
Definition: lps331ap.h:61
Struct holding all parameters needed for device initialization.
Definition: lps331ap.h:59
Low-level I2C peripheral driver interface definition.