The HH10D is a humidity-to-frequency sensor that includes factory calibrated constants accessed through I2C.
#include <string.h>
#if ! (BSP430_CONSOLE - 0)
#error Console is not configured correctly
#endif
#if ! (BSP430_UPTIME - 0)
#error Uptime is not configured correctly
#endif
#if ! (BSP430_TIMER_CCACLK - 0)
#error Application requires CCACLK support
#endif
#ifndef APP_HH10D_PORT_PERIPH_HANDLE
#error No HH10D port specified
#endif
#ifndef APP_HH10D_INTERVAL_S
#define APP_HH10D_INTERVAL_S 2
#endif
void main ()
{
unsigned long uptime_Hz;
int rc;
cprintf(
"\nhh10d " __DATE__
" " __TIME__
"\n");
if (NULL == hh10d_port) {
cprintf(
"\nERROR: No port HAL; did you enable configBSP430_HAL_%s?\n",
xBSP430portName(APP_HH10D_PORT_PERIPH_HANDLE) ?:
"whatever");
return;
}
memset(&hh10d, 0, sizeof(hh10d));
cprintf(
"HH10D I2C on %s at %p, bus rate %lu Hz, address 0x%02x\n",
APP_HH10D_I2C_ADDRESS);
#if BSP430_PLATFORM_PERIPHERAL_HELP
#endif
cprintf(
"Monitoring HH10D on %s.%u using timer %s\n",
cprintf(
"Uptime CC block %s.%u at %lu Hz sample duration %u ticks for interval %us\n",
APP_HH10D_UPTIME_CC_INDEX, uptime_Hz,
0, 0);
if (! i2c) {
return;
}
if (0 != rc) {
cprintf(
"ERR: getCalibration returned %d\n", rc);
return;
}
next_ni);
while (1) {
unsigned long now_utt;
unsigned int lpc;
int hum_ppth;
do {
} while (0);
cprintf(
"%s: Count %u ; humidity %u ppth\n",
}
}
#define BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 1
#define configBSP430_PLATFORM_SPIN_FOR_JUMPER 1
#define configBSP430_PLATFORM_PERIPHERAL_HELP 1
#define configBSP430_CONSOLE 1
#define configBSP430_UPTIME 1
#define configBSP430_TIMER_CCACLK 1
#define configBSP430_TIMER_CCACLK_CLK_PORT 1
#define configBSP430_TIMER_CCACLK_CLK_PORT_HAL 1
#define APP_HH10D_PORT_PERIPH_HANDLE BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE
#define APP_HH10D_PORT_BIT BSP430_TIMER_CCACLK_CLK_PORT_BIT
#define APP_HH10D_TIMER_PERIPH_HANDLE BSP430_TIMER_CCACLK_PERIPH_HANDLE
#define APP_HH10D_UPTIME_CC_INDEX 1
#define configBSP430_SERIAL_ENABLE_I2C 1
#if (BSP430_PLATFORM_EXP430F5438 - 0) || (BSP430_PLATFORM_TRXEB - 0)
#define APP_HH10D_I2C_PERIPH_HANDLE BSP430_PERIPH_USCI5_B3
#define configBSP430_HAL_USCI5_B3 1
#elif (BSP430_PLATFORM_EXP430F5529 - 0)
#define APP_HH10D_I2C_PERIPH_HANDLE BSP430_PERIPH_USCI5_B0
#define configBSP430_HAL_USCI5_B0 1
#elif (BSP430_PLATFORM_EXP430F5529LP - 0)
#define APP_HH10D_I2C_PERIPH_HANDLE BSP430_PERIPH_USCI5_B1
#define configBSP430_HAL_USCI5_B1 1
#elif ((BSP430_PLATFORM_EXP430FR5739 - 0) \
|| (BSP430_PLATFORM_EXP430FR4133 - 0) \
|| (BSP430_PLATFORM_EXP430FR5969 - 0) \
|| (BSP430_PLATFORM_WOLVERINE - 0))
#define APP_HH10D_I2C_PERIPH_HANDLE BSP430_PERIPH_EUSCI_B0
#define configBSP430_HAL_EUSCI_B0 1
#else
#define APP_HH10D_I2C_PERIPH_HANDLE BSP430_PERIPH_USCI_B0
#define configBSP430_HAL_USCI_B0 1
#endif
#define APP_HH10D_I2C_ADDRESS 0x51
#if (BSP430_PLATFORM_EXP430F5529 - 0)
#define configBSP430_PLATFORM_EXP430F5529_CCACLK_NEED_CLK 1
#endif
PLATFORM ?= exp430fr5739
TEST_PLATFORMS_EXCLUDE=em430 surf wolverine exp430fr5969
MODULES=$(MODULES_PLATFORM)
MODULES += $(MODULES_CONSOLE) $(MODULES_UPTIME)
MODULES += $(MODULES_TIMER)
MODULES += periph/port
VPATH += $(BSP430_ROOT)/src/sensors
MODULES += sensors/hh10d
SRC=main.c
include $(BSP430_ROOT)/make/Makefile.common