Loading...
Searching...
No Matches
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
9#pragma once
10
27
28#include <stdint.h>
29
30#include "periph/i2c.h"
31#include "seesaw_soil_regs.h"
32
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
48#ifndef CONFIG_SEESAW_SOIL_I2C_ADDRESS
49#define CONFIG_SEESAW_SOIL_I2C_ADDRESS (0x36)
50#endif
52
56enum {
61};
62
66typedef struct {
68 uint8_t addr;
70
77
89
99int seesaw_soil_temperature(const seesaw_soil_t *dev, int16_t *temp);
100
111int seesaw_soil_moisture(const seesaw_soil_t *dev, uint16_t *moist);
112
113#ifdef __cplusplus
114}
115#endif
116
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:144
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:57
@ SEESAW_SOIL_NODEV
no SEESAW_SOIL device found on the bus
Definition seesaw_soil.h:58
@ SEESAW_SOIL_BUSERR
error during I2C communication
Definition seesaw_soil.h:60
@ SEESAW_SOIL_NOBUS
errors while initializing the I2C bus
Definition seesaw_soil.h:59
Low-level I2C peripheral driver interface definition.
Register definitions for Seesaw Soil devices.
Parameters needed for device initialization.
Definition seesaw_soil.h:66
uint8_t addr
address on that bus
Definition seesaw_soil.h:68
i2c_t i2c
bus the device is connected to
Definition seesaw_soil.h:67
Device descriptor for Seesaw Soil sensors.
Definition seesaw_soil.h:74
seesaw_soil_params_t params
Configuration parameters.
Definition seesaw_soil.h:75