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
57 enum {
61  SEESAW_SOIL_BUSERR = -3
62 };
63 
67 typedef struct {
69  uint8_t addr;
71 
75 typedef struct {
78 
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 */
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition: i2c.h:145
int seesaw_soil_temperature(const seesaw_soil_t *dev, int16_t *temp)
Convenience function for reading temperature.
int seesaw_soil_init(seesaw_soil_t *dev, const seesaw_soil_params_t *params)
Initialize the given Seesaw Soil device.
int seesaw_soil_moisture(const seesaw_soil_t *dev, uint16_t *moist)
Convenience function for reading ca.
@ SEESAW_SOIL_OK
everything went as expected
Definition: seesaw_soil.h:58
@ SEESAW_SOIL_NODEV
no SEESAW_SOIL device found on the bus
Definition: seesaw_soil.h:59
@ SEESAW_SOIL_BUSERR
error during I2C communication
Definition: seesaw_soil.h:61
@ SEESAW_SOIL_NOBUS
errors while initializing the I2C bus
Definition: seesaw_soil.h:60
Low-level I2C peripheral driver interface definition.
Register definitions for Seesaw Soil devices.
Parameters needed for device initialization.
Definition: seesaw_soil.h:67
uint8_t addr
address on that bus
Definition: seesaw_soil.h:69
i2c_t i2c
bus the device is connected to
Definition: seesaw_soil.h:68
Device descriptor for Seesaw Soil sensors.
Definition: seesaw_soil.h:75
seesaw_soil_params_t params
Configuration parameters.
Definition: seesaw_soil.h:76