/* Soil Sensor Firmware * Ambient Temperature, Humidity, and Soil Temperature * Sensiplicity Systems * * Copyright 2015 * * Department of Botany and Plant Pathology * Center for Genome Research and Biocomputing * Oregon State University * Corvallis, OR 97331 * * This program is not free software; you can not redistribute it and/or * modify it at all. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /* This module reads ambient humidity/temperature from the * SI700X and soil temperature from the TMP108. Both communicate * over the I2C bus. */ /* Initialize the I2C bus. */ void init_i2c(void); /* Read the soil temperature using the old sensor present on * PCB revisions 1 and 2. * The return value is the soil temperature, in 1/16 degrees C. * If an error occurs, -273.125C (-4370) will be returned. */ int16_t get_soil_temp_old(void); /* Read the soil temperature in a zone. * The return value is the soil temperature, in 1/16 degrees C. * If an error occurs, -273.125C (-4370) will be returned. */ int16_t get_soil_temp(uint8_t zone); /* Tell the Si7006 to measure the ambient humidity and temperature. * This process takes about 12ms. * Returns 0 on success, -1 on error. */ int8_t measure_humidity(void); /* Read the ambient temperature and humidity. measure_humidity() must be called * before this function. * humidity is the ambient relative humidity. 0=0%RH, 4095=100%RH. * temperature is the ambient temperature, in 1/16 degrees C. * If 0 is returned, the data was read successfully. Otherwise, -1 is returned. * This may occur if not enough time has elapsed since calling measure_humidity(). */ int8_t read_humidity(uint16_t *humidity, int16_t *temperature);