78#define ADT7310_CONF_FAULT_QUEUE_MASK (0x03)
79#define ADT7310_CONF_FAULT_QUEUE_SHIFT (0)
80#define ADT7310_CONF_FAULT_QUEUE(x) (((x) << ADT7310_CONF_FAULT_QUEUE_SHIFT) & ADT7310_CONF_FAULT_QUEUE_MASK)
81#define ADT7310_CONF_CT_POL_MASK (0x04)
82#define ADT7310_CONF_CT_POL_SHIFT (2)
83#define ADT7310_CONF_CT_POL(x) (((x) << ADT7310_CONF_CT_POL_SHIFT) & ADT7310_CONF_CT_POL_MASK)
84#define ADT7310_CONF_INT_POL_MASK (0x08)
85#define ADT7310_CONF_INT_POL_SHIFT (3)
86#define ADT7310_CONF_INT_POL(x) (((x) << ADT7310_CONF_INT_POL_SHIFT) & ADT7310_CONF_INT_POL_MASK)
87#define ADT7310_CONF_INTCT_MODE_MASK (0x10)
88#define ADT7310_CONF_INTCT_MODE_SHIFT (4)
89#define ADT7310_CONF_INTCT_MODE(x) (((x) << ADT7310_CONF_INTCT_MODE_SHIFT) & ADT7310_CONF_INTCT_MODE_MASK)
90#define ADT7310_CONF_OPERATION_MODE_MASK (0x60)
91#define ADT7310_CONF_OPERATION_MODE_SHIFT (5)
92#define ADT7310_CONF_OPERATION_MODE(x) (((x) << ADT7310_CONF_OPERATION_MODE_SHIFT) & ADT7310_CONF_OPERATION_MODE_MASK)
93#define ADT7310_CONF_RESOLUTION_MASK (0x80)
94#define ADT7310_CONF_RESOLUTION_SHIFT (7)
95#define ADT7310_CONF_RESOLUTION(x) (((x) << ADT7310_CONF_RESOLUTION_SHIFT) & ADT7310_CONF_RESOLUTION_MASK)
100#define ADT7310_MODE_CONTINUOUS (ADT7310_CONF_OPERATION_MODE(0))
104#define ADT7310_MODE_ONE_SHOT (ADT7310_CONF_OPERATION_MODE(1))
108#define ADT7310_MODE_1SPS (ADT7310_CONF_OPERATION_MODE(2))
112#define ADT7310_MODE_SHUTDOWN (ADT7310_CONF_OPERATION_MODE(3))
Low-level GPIO peripheral driver interface definitions.
int16_t adt7310_read_raw(const adt7310_t *dev)
Read raw temperature register value.
float adt7310_read_float(const adt7310_t *dev)
Read temperature value from sensor and convert to degrees Celsius.
int adt7310_init(adt7310_t *dev, spi_t spi, spi_clk_t clk, gpio_t cs)
Initialize the ADT7310 sensor driver.
int32_t adt7310_read(const adt7310_t *dev)
Read temperature value from sensor and convert to milli-degrees Celsius.
int adt7310_set_config(adt7310_t *dev, uint8_t config)
Set configuration register of an ADT7310 sensor.
Low-level SPI peripheral driver interface definition.
Device descriptor for ADT7310 sensors.
spi_t spi
SPI bus the sensor is connected to.
gpio_t cs
CS pin GPIO handle.
bool initialized
sensor status, true if sensor is initialized
bool high_res
Sensor resolution, true if configured to 16 bit resolution.
spi_clk_t clk
SPI bus clock speed.