Interface definition for the ADT7310 sensor driver. More...

Detailed Description

Interface definition for the ADT7310 sensor driver.

Author
Joakim NohlgÄrd joaki.nosp@m.m.no.nosp@m.hlgar.nosp@m.d@ei.nosp@m.stec..nosp@m.se

Definition in file adt7310.h.

#include <stdint.h>
#include <stdbool.h>
#include "periph/spi.h"
#include "periph/gpio.h"
+ Include dependency graph for adt7310.h:

Go to the source code of this file.

Data Structures

struct  adt7310_t
 Device descriptor for ADT7310 sensors. More...
 

Functions

int adt7310_set_config (adt7310_t *dev, uint8_t config)
 Set configuration register of an ADT7310 sensor. More...
 
int adt7310_init (adt7310_t *dev, spi_t spi, spi_clk_t clk, gpio_t cs)
 Initialize the ADT7310 sensor driver. More...
 
int16_t adt7310_read_raw (const adt7310_t *dev)
 Read raw temperature register value. More...
 
int32_t adt7310_read (const adt7310_t *dev)
 Read temperature value from sensor and convert to milli-degrees Celsius. More...
 
float adt7310_read_float (const adt7310_t *dev)
 Read temperature value from sensor and convert to degrees Celsius. More...
 

ADT7310 configuration bits

#define ADT7310_CONF_FAULT_QUEUE_MASK   (0x03)
 
#define ADT7310_CONF_FAULT_QUEUE_SHIFT   (0)
 
#define ADT7310_CONF_FAULT_QUEUE(x)   (((x) << ADT7310_CONF_FAULT_QUEUE_SHIFT) & ADT7310_CONF_FAULT_QUEUE_MASK)
 
#define ADT7310_CONF_CT_POL_MASK   (0x04)
 
#define ADT7310_CONF_CT_POL_SHIFT   (2)
 
#define ADT7310_CONF_CT_POL(x)   (((x) << ADT7310_CONF_CT_POL_SHIFT) & ADT7310_CONF_CT_POL_MASK)
 
#define ADT7310_CONF_INT_POL_MASK   (0x08)
 
#define ADT7310_CONF_INT_POL_SHIFT   (3)
 
#define ADT7310_CONF_INT_POL(x)   (((x) << ADT7310_CONF_INT_POL_SHIFT) & ADT7310_CONF_INT_POL_MASK)
 
#define ADT7310_CONF_INTCT_MODE_MASK   (0x10)
 
#define ADT7310_CONF_INTCT_MODE_SHIFT   (4)
 
#define ADT7310_CONF_INTCT_MODE(x)   (((x) << ADT7310_CONF_INTCT_MODE_SHIFT) & ADT7310_CONF_INTCT_MODE_MASK)
 
#define ADT7310_CONF_OPERATION_MODE_MASK   (0x60)
 
#define ADT7310_CONF_OPERATION_MODE_SHIFT   (5)
 
#define ADT7310_CONF_OPERATION_MODE(x)   (((x) << ADT7310_CONF_OPERATION_MODE_SHIFT) & ADT7310_CONF_OPERATION_MODE_MASK)
 
#define ADT7310_CONF_RESOLUTION_MASK   (0x80)
 
#define ADT7310_CONF_RESOLUTION_SHIFT   (7)
 
#define ADT7310_CONF_RESOLUTION(x)   (((x) << ADT7310_CONF_RESOLUTION_SHIFT) & ADT7310_CONF_RESOLUTION_MASK)
 
#define ADT7310_MODE_CONTINUOUS   (ADT7310_CONF_OPERATION_MODE(0))
 Continuous operation mode.
 
#define ADT7310_MODE_ONE_SHOT   (ADT7310_CONF_OPERATION_MODE(1))
 One shot.
 
#define ADT7310_MODE_1SPS   (ADT7310_CONF_OPERATION_MODE(2))
 1 sample per second
 
#define ADT7310_MODE_SHUTDOWN   (ADT7310_CONF_OPERATION_MODE(3))
 Shut down (powersave)