seesaw_soil.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Viktor Gal
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 
26 #ifndef SEESAW_SOIL_H
27 #define SEESAW_SOIL_H
28 
29 #include <stdint.h>
30 
31 #include "periph/i2c.h"
32 #include "seesaw_soil_regs.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
49 #ifndef CONFIG_SEESAW_SOIL_I2C_ADDRESS
50 #define CONFIG_SEESAW_SOIL_I2C_ADDRESS (0x36)
51 #endif
52 
57 enum {
62 };
63 
67 typedef struct {
69  uint8_t addr;
71 
75 typedef struct {
78 
89 int seesaw_soil_init(seesaw_soil_t *dev, const seesaw_soil_params_t *params);
90 
100 int seesaw_soil_temperature(const seesaw_soil_t *dev, int16_t *temp);
101 
112 int seesaw_soil_moisture(const seesaw_soil_t *dev, uint16_t *moist);
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif /* SEESAW_SOIL_H */
119 
SEESAW_SOIL_OK
@ SEESAW_SOIL_OK
everything went as expected
Definition: seesaw_soil.h:58
seesaw_soil_moisture
int seesaw_soil_moisture(const seesaw_soil_t *dev, uint16_t *moist)
Convenience function for reading ca.
SEESAW_SOIL_BUSERR
@ SEESAW_SOIL_BUSERR
error during I2C communication
Definition: seesaw_soil.h:61
seesaw_soil_params_t::i2c
i2c_t i2c
bus the device is connected to
Definition: seesaw_soil.h:68
SEESAW_SOIL_NODEV
@ SEESAW_SOIL_NODEV
no SEESAW_SOIL device found on the bus
Definition: seesaw_soil.h:59
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
seesaw_soil_regs.h
Register definitions for Seesaw Soil devices.
seesaw_soil_init
int seesaw_soil_init(seesaw_soil_t *dev, const seesaw_soil_params_t *params)
Initialize the given Seesaw Soil device.
seesaw_soil_temperature
int seesaw_soil_temperature(const seesaw_soil_t *dev, int16_t *temp)
Convenience function for reading temperature.
seesaw_soil_params_t
Parameters needed for device initialization.
Definition: seesaw_soil.h:67
SEESAW_SOIL_NOBUS
@ SEESAW_SOIL_NOBUS
errors while initializing the I2C bus
Definition: seesaw_soil.h:60
seesaw_soil_t::params
seesaw_soil_params_t params
Configuration parameters.
Definition: seesaw_soil.h:76
seesaw_soil_params_t::addr
uint8_t addr
address on that bus
Definition: seesaw_soil.h:69
seesaw_soil_t
Device descriptor for Seesaw Soil sensors.
Definition: seesaw_soil.h:75
i2c.h
Low-level I2C peripheral driver interface definition.