Driver for the AT30TSE75x temperature sensor with serial EEPROM. More...

Detailed Description

Driver for the AT30TSE75x temperature sensor with serial EEPROM.

Author
Daniel Krebs githu.nosp@m.b@da.nosp@m.niel-.nosp@m.kreb.nosp@m.s.net

Definition in file at30tse75x.h.

#include <stdint.h>
#include "periph/i2c.h"
+ Include dependency graph for at30tse75x.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  at30tse75x_t
 Device descriptor for a AT30TSE75x device. More...
 

Functions

int at30tse75x_init (at30tse75x_t *dev, i2c_t i2c, uint8_t addr)
 Initialize a AT30TSE75x device. More...
 
int at30tse75x_save_config (const at30tse75x_t *dev)
 Save configuration register to non-volatile backup register. More...
 
int at30tse75x_restore_config (const at30tse75x_t *dev)
 Restore configuration register from non-volatile backup register. More...
 
int at30tse75x_get_config (const at30tse75x_t *dev, uint8_t *data)
 Get content of configuration register. More...
 
int at30tse75x_set_config (const at30tse75x_t *dev, uint8_t data)
 Set content of configuration register. More...
 
int at30tse75x_set_resolution (const at30tse75x_t *dev, at30tse75x_resolution_t resolution)
 Set temperature resolution. More...
 
int at30tse75x_set_mode (const at30tse75x_t *dev, at30tse75x_mode_t mode)
 Set operation mode. More...
 
int at30tse75x_set_alarm_polarity (const at30tse75x_t *dev, at30tse75x_alarm_polatity_t polarity)
 Set polarity of ALERT pin. More...
 
int at30tse75x_set_fault_tolerance (const at30tse75x_t *dev, at30tse75x_fault_tolerance_t tolerance)
 Set tolerance to outlying measurements. More...
 
int at30tse75x_set_limit_low (const at30tse75x_t *dev, int8_t t_low)
 Set T_Low limit. More...
 
int at30tse75x_set_limit_high (const at30tse75x_t *dev, int8_t t_high)
 Set T_High limit. More...
 
int at30tse75x_get_temperature (const at30tse75x_t *dev, float *temperature)
 Get measured temperature. More...
 

AT30TSE75x I2C addresses

#define AT30TSE75X_TEMP_ADDR   (0x48)
 
#define AT30TSE75X_EEPROM_ADDR   (0x50)
 

AT30TSE75x register addresses

#define AT30TSE75X_REG__TEMPERATURE   (0x00)
 
#define AT30TSE75X_REG__CONFIG   (0x01)
 
#define AT30TSE75X_REG__LIMIT_LOW   (0x02)
 
#define AT30TSE75X_REG__LIMIT_HIGH   (0x03)
 
#define AT30TSE75X_REG__NV_CONFIG   (0x11)
 
#define AT30TSE75X_REG__NV_LIMIT_LOW   (0x12)
 
#define AT30TSE75X_REG__NV_LIMIR_HIGH   (0x13)
 

AT30TSE75x number formatting

#define AT30TSE75X_INTEGER_MASK   (0x00ff)
 
#define AT30TSE75X_INTEGER_SHIFT   (0)
 
#define AT30TSE75X_FRACTIONAL_MASK   (0xf000)
 
#define AT30TSE75X_FRACTIONAL_SHIFT   (12)
 
#define AT30TSE75X_FRACTIONAL_BASE   (0.0625f)
 

AT30TSE75x configuration register

Only upper byte can be read/written, so treat as 8-bit register.

#define AT30TSE75X_CONFIG__OS_BIT   (1 << 7)
 
#define AT30TSE75X_CONFIG__RESOLUTION_MASK   (0x60)
 
#define AT30TSE75X_CONFIG__RESOLUTION_SHIFT   (5)
 
#define AT30TSE75X_CONFIG__FTQ_MASK   (0x18)
 
#define AT30TSE75X_CONFIG__FTQ_SHIFT   (3)
 
#define AT30TSE75X_CONFIG__ALERT_POL_BIT   (1 << 2)
 
#define AT30TSE75X_CONFIG__ALARM_MODE_BIT   (1 << 1)
 
#define AT30TSE75X_CONFIG__SHUTDOWN_BIT   (1 << 0)
 

AT30TSE75x commands

#define AT30TSE75X_CMD__SAVE_TO_NVRAM   (0x48)
 
#define AT30TSE75X_CMD__RESTORE_FROM_NVRAM   (0xb8)
 
#define AT30TSE75X_CMD__GENERAL_CALL_RESET   (0x06)
 
#define AT30TSE75X_CMD__GENERAL_CALL_RELATCH   (0x04)
 

AT30TSE75x constants

#define AT30TSE75X_BUS_FREE_TIME_US   (1U)
 

AT30TSE75x configuration types

enum  at30tse75x_resolution_t { AT30TSE75X_RESOLUTION_9BIT = 0, AT30TSE75X_RESOLUTION_10BIT = 1, AT30TSE75X_RESOLUTION_11BIT = 2, AT30TSE75X_RESOLUTION_12BIT = 3 }
 Temperature resolution.
 
enum  at30tse75x_mode_t { AT30TSE75X_MODE_COMPARATOR, AT30TSE75X_MODE_INTERRUPT, AT30TSE75X_MODE_ONE_SHOT }
 Operation mode. More...
 
enum  at30tse75x_fault_tolerance_t { AT30TSE75X_ALARM_AFTER_1 = 0, AT30TSE75X_ALARM_AFTER_2 = 1, AT30TSE75X_ALARM_AFTER_4 = 2, AT30TSE75X_ALARM_AFTER_6 = 3 }
 After how many limit exceeding measurements the ALERT pin is set.
 
enum  at30tse75x_alarm_polatity_t { AT30TSE75X_ALARM_ACTIVE_LOW, AT30TSE75X_ALARM_ACTIVE_HIGH }
 Polarity of the ALERT pin.