ENS210 temperature and humidity sensor driver.
More...
#include <assert.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "ENS210.hpp"
#include "1wire/one_wire.h"
#include "1wire/DS28E18.h"
Go to the source code of this file.
|
|
#define | CRC7WIDTH 7 |
| |
|
#define | CRC7POLY 0x89 |
| |
|
#define | CRC7IVEC 0x7F |
| |
|
#define | DATA7WIDTH 17 |
| |
|
#define | DATA7MASK ((1UL<<DATA7WIDTH)-1) |
| |
|
#define | DATA7MSB (1UL<<(DATA7WIDTH-1)) |
| |
|
| enum | ENS210_REG : uint8_t {
ENS210_REG_PART_ID = 0x00,
ENS210_REG_UID = 0x04,
ENS210_REG_SYS_CTRL = 0x10,
ENS210_REG_SYS_STAT = 0x11,
ENS210_REG_SENS_RUN = 0x21,
ENS210_REG_SENS_START = 0x22,
ENS210_REG_SENS_STOP = 0x23,
ENS210_REG_SENS_STAT = 0x24,
ENS210_REG_T_VAL = 0x30,
ENS210_REG_H_VAL = 0x33
} |
| |
ENS210 temperature and humidity sensor driver.
This driver operates an ENS210 over a 1-Wire bus using a DS2485 at the host end and a DS28E18 at the remote end.
- References
- Vendor-provided Arduino driver: https://github.com/sciosense/ENS210_driver (2020-04-06, v3).
- Stack topology
- imxRT1024 -> I2C -> DS2485 -> - - - 1-Wire - - - -> DS28E18 -> I2C -> ENS210
- Notes
- Rather than driving the ENS210 directly from a host I2C controller, this code builds a DS28E18 command sequence and executes it remotely.
- I2C hardware initialization occurs in the platform-specific DS2485_ExecuteCommand implementation.
- Update history
- 27-October-2023 Dave Nadler Initial version.
- Todo:
Add solderOffset support.
Add conditional debug printf support.
Definition in file ENS210.cpp.