Atmel Software Framework

at30ts.h File Reference

Management of the AT30TS Temperature Sensor component.

This file contains definitions and services related to the features of the AT30TS Temperature Sensor.

Copyright (C) 2015-2016 Atmel Corporation. All rights reserved.

#include "compiler.h"
#include "string.h"
#include "twi_master.h"
#include "conf_at30ts.h"

Data Structures

struct  _sensor_data::_limits
 
struct  _sensor_data::_nvlimits
 
struct  _sensor_data
 
struct  _sensor_data::_temperature
 
struct  _ts_device
 Information about a AT30TS device. More...
 

Macros

#define AT30TS_GENERAL_ERROR   (-1)
 
#define AT30TS_INVALID_EEPROM_ADDRESS   (-5)
 
#define AT30TS_INVALID_SIZE   (-6)
 
#define AT30TS_NVRBSY_BUSY   (-8)
 
#define AT30TS_OUT_OF_BOUNDS   (-7)
 
#define AT30TS_REG_LOCKED   (-4)
 
#define AT30TS_SUCCESS   (0)
 
#define AT30TS_TWI_READ_NACK   (-3)
 
#define AT30TS_TWI_WRITE_NACK   (-2)
 
#define CAPABIL_REG   0x00 /* !< Capability (R) Default = 0x00D7 */
 
#define CONFIG_REG   0x01 /* !< Vol Config (R/W) Default = N/A */
 
#define CONFIGUR_REG   0x01 /* !< Configuration (R/W) Default = 0x0000 */
 
#define CPY_NVOL_VOL_REG
 
#define CPY_VOL_NVOL_REG
 
#define DEV_ID_REG   0x07 /* !< Dev ID/Revision (R) Default = 0x8201 */
 
#define EEPROM_WP_ADDRESS   0x60 /* !< EEPROM's WP TWI-address */
 
#define MANF_ID_REG   0x06 /* !< Manufacturer ID (R) Default = 0x001F */
 
#define NV_CONFIG_REG   0x11 /* !< NonVol Config (R/W) Default = 0x0000 */
 
#define NV_THILIM_REG   0x13 /* !< NonVol Hi Lim (R/W) Default = 0x0500 */
 
#define NV_TLOLIM_REG   0x12 /* !< NonVol Lo Lim (R/W) Default = 0x04B0 */
 
#define NVRBSY   0x01 /* !< Nonvolatile Registers Busy */
 
#define PAGE_SIZE   0x10 /* !< EEPROM page size */
 
#define RLCK_MSK   0x02 /* !< Nonvolatile Register Lock */
 
#define RLCKDWN_MSK   0x04 /* !< Nonvolatile Register Lockdown */
 
#define SMBUS_TO_REG   0x22 /* !< SMBus Timeout (R/W) Default = 0x0000 */
 
#define TCOPYR
 
#define TCOPYW
 
#define TEMP_DATA_REG   0x05 /* !< Temperature Data (R) Default = N/A */
 
#define TEMPER_REG   0x00 /* !< Temperature Data (R) Default = 0x0000 */
 
#define THILIM_REG   0x03 /* !< Vol Hi Lim (R/W) Default = N/A */
 
#define TLOLIM_REG   0x02 /* !< Vol Lo Lim (R/W) Default = N/A */
 
#define TPROG   5 /* !< NV Register Program Time (ms), max */
 
#define TRIP_CRT_REG   0x04 /* !< Critical Alarm (R/W) Default = 0x0000 */
 
#define TRIP_LWR_REG   0x03 /* !< Lower Alarm (R/W) Default = 0x0000 */
 
#define TRIP_UPR_REG   0x02 /* !< Upper Alarm (R/W) Default = 0x0000 */
 

Typedefs

typedef enum config_options_002b config_options_002b_t
 
typedef enum config_options config_options_t
 
typedef enum device_type device_type_t
 
typedef enum nvconfig_options nvconfig_options_t
 
typedef enum opt_flag_002b opt_flag_002b_t
 
typedef enum opt_flag opt_flag_t
 
typedef struct _sensor_data sensor_data_t
 
typedef struct _ts_device ts_device_t
 Information about a AT30TS device. More...
 

Enumerations

enum  config_options {
  AT30TS7_SD_DISABLE = 0,
  AT30TS7_SD_ENABLE = 1,
  AT30TS7_CMP = 0,
  AT30TS7_INT = 1,
  AT30TS7_POL_ACTIVE_LOW = 0,
  AT30TS7_POL_ACTIVE_HIGH = 1,
  AT30TS7_FAULT1 = 0,
  AT30TS7_FAULT2 = 1,
  AT30TS7_FAULT4 = 2,
  AT30TS7_FAULT6 = 3,
  AT30TS7_RES09 = 0,
  AT30TS7_RES10 = 1,
  AT30TS7_RES11 = 2,
  AT30TS7_RES12 = 3,
  AT30TS7_OS_DISABLE = 0,
  AT30TS7_OS_ENABLE = 1
}
 Configuration Reg Options for the AT30TS7x/TSE7x. More...
 
enum  config_options_002b {
  AT30TS_002B_CONF_OPT_MODE_CMP = 0,
  AT30TS_002B_CONF_OPT_MODE_INT = 1,
  AT30TS_002B_CONF_OPT_POL_LOW = 0,
  AT30TS_002B_CONF_OPT_POL_HIGH = 1,
  AT30TS_002B_CONF_OPT_CRIT_ALL_ALM = 0,
  AT30TS_002B_CONF_OPT_CRIT_ALM_ONLY = 1,
  AT30TS_002B_CONF_OPT_EVTOUT_DIS = 0,
  AT30TS_002B_CONF_OPT_EVTOUT_EN = 1,
  AT30TS_002B_CONF_OPT_EVTSTS_DIS = 0,
  AT30TS_002B_CONF_OPT_EVTSTS_EN = 1,
  AT30TS_002B_CONF_OPT_EVTCLR_DIS = 0,
  AT30TS_002B_CONF_OPT_EVTCLR_EN = 1,
  AT30TS_002B_CONF_OPT_WINLOCK_DIS = 0,
  AT30TS_002B_CONF_OPT_WINLOCK_EN = 1,
  AT30TS_002B_CONF_OPT_CRTALML_DIS = 0,
  AT30TS_002B_CONF_OPT_CRTALML_EN = 0,
  AT30TS_002B_CONF_OPT_SHTDWN_EN = 0,
  AT30TS_002B_CONF_OPT_SHTDWN_DIS = 1,
  AT30TS_002B_CONF_OPT_HYSTENB_00C = 0,
  AT30TS_002B_CONF_OPT_HYSTENB_15C = 1,
  AT30TS_002B_CONF_OPT_HYSTENB_30C = 2,
  AT30TS_002B_CONF_OPT_HYSTENB_60C = 3
}
 Configuration Reg Options for the for AT30TSE002B device. More...
 
enum  data_types {
  pos,
  neg,
  cel,
  farh,
  raw
}
 Qualifier for the temperature reading. More...
 
enum  device_type {
  AT30TSE002B,
  AT30TS75,
  AT30TS750,
  AT30TSE752,
  AT30TSE754,
  AT30TSE758
}
 AT30TS Family device types. More...
 
enum  nvconfig_options {
  AT30TS7_RLCK_UNLOCK = 0,
  AT30TS7_RLCK_LOCK = 1,
  AT30TS7_RLCKDWN_UNLOCK = 0,
  AT30TS7_RLCKDWN_LOCK = 1,
  AT30TS7_NVSD_DISABLE = 0,
  AT30TS7_NVSD_ENABLE = 1,
  AT30TS7_NVCMP = 0,
  AT30TS7_NVINT = 1,
  AT30TS7_NVPOL_ACTIVE_LOW = 0,
  AT30TS7_NVPOL_ACTIVE_HIGH = 1,
  AT30TS7_NVFAULT1 = 0,
  AT30TS7_NVFAULT2 = 1,
  AT30TS7_NVFAULT4 = 2,
  AT30TS7_NVFAULT6 = 3,
  AT30TS7_NVRES09 = 0,
  AT30TS7_NVRES10 = 1,
  AT30TS7_NVRES11 = 2,
  AT30TS7_NVRES12 = 3
}
 Nonvolatile Configuration Reg Options. More...
 
enum  opt_flag {
  AT30TS_RES,
  AT30TS_FAULT,
  AT30TS_POL,
  AT30TS_CMP_INT_MODE,
  AT30TS_SD,
  AT30TS_OS,
  AT30TS_RLCK,
  AT30TS_RLCKDWN
}
 Configuration Options. More...
 
enum  opt_flag_002b {
  AT30TS_002B_CONFBIT_EVTMOD,
  AT30TS_002B_CONFBIT_EVTPOL,
  AT30TS_002B_CONFBIT_CRITEVT,
  AT30TS_002B_CONFBIT_EVTOUT,
  AT30TS_002B_CONFBIT_EVTSTS,
  AT30TS_002B_CONFBIT_EVTCLR,
  AT30TS_002B_CONFBIT_WINLOCK,
  AT30TS_002B_CONFBIT_CRTALML,
  AT30TS_002B_CONFBIT_SHTDWN,
  AT30TS_002B_CONFBIT_HYSTENB
}
 Configuration Reg Bits for the AT30TSE002B device. More...
 
enum  reg_type {
  vol,
  nonvol
}
 Register types in AT30TS device. More...
 

Functions

void attach_device (uint8_t device_addr, device_type_t type)
 attach_device, initialize epprom variable associcated with device More...
 
int8_t check_NVRBSY (void)
 Checks at30ts75 NVRBSY, RLCKDWN and RCLK bits. More...
 
void parse_temp_reading (sensor_data_t *sensor_data)
 
uint8_t read_capability (sensor_data_t *sensor_data)
 
uint8_t read_config (sensor_data_t *data)
 Read nonvolatile config register. More...
 
uint8_t read_devid (sensor_data_t *sensor_data)
 
uint8_t read_manfid (sensor_data_t *sensor_data)
 
uint8_t read_nvconfig (sensor_data_t *data)
 Read nonvolatile config register. More...
 
uint8_t read_nvthigh (sensor_data_t *data)
 Read nonvolatile tHIGH limit register. More...
 
uint8_t read_nvtlow (sensor_data_t *data)
 Read nonvolatile tLOW limit register. More...
 
uint8_t read_smbus (sensor_data_t *sensor_data)
 
uint8_t read_tcrit (sensor_data_t *sensor_data)
 
int8_t read_temperature (sensor_data_t *data)
 Read temperature register. More...
 
uint8_t read_temperature_high (sensor_data_t *data)
 Read tHIGH limit register. More...
 
uint8_t read_temperature_low (sensor_data_t *data)
 Read tLOW limit register. More...
 
uint8_t set_config_option (sensor_data_t *data, opt_flag_t flag, config_options_t opt)
 Set Configuration Options. More...
 
uint8_t set_nvconfig_option (sensor_data_t *data, opt_flag_t flag, nvconfig_options_t opt)
 Set bit(s) in nonvolatile configuration register. More...
 
int8_t ts75_copy_nonvol_vol_register (void)
 Copy nonvolatile registers to volatile registers. More...
 
int8_t ts75_copy_vol_nonvol_register (void)
 Copy volatile registers to nonvolatile registers. More...
 
int8_t ts75_probe_nonvol_register (uint8_t device_addr)
 Probe at30ts75 nonvolatile configuration register. More...
 
int8_t ts_ack_polling (uint8_t addr)
 ACK polling function. More...
 
void ts_construct_eeprom_address (twi_package_t *packet, uint16_t address)
 Constructs an eeprom address. More...
 
int8_t ts_read_eeprom (uint16_t address, uint16_t size, uint8_t *buf)
 Read EEPROM. More...
 
int8_t ts_read_register (const uint8_t pointer_reg, uint8_t *ibuf)
 Read at30ts75xx configuration register. More...
 
int8_t ts_write_eeprom (uint16_t address, uint16_t size, uint8_t *buf)
 Write EEPROM. More...
 
uint8_t ts_write_memory (uint16_t address, uint16_t size, uint8_t *buf)
 Write memory, this function manages writing data beyond a pages size (16 bytes) More...
 
int8_t ts_write_register (uint8_t *obuf)
 Write configuration register. More...
 
uint8_t twi_probe_device (uint8_t addr)
 
uint8_t twi_read (twi_package_t *packet)
 
uint8_t twi_write (twi_package_t *packet)
 
uint8_t write_config (uint16_t val)
 Write configuration register. More...
 
uint8_t write_nvconfig (uint16_t val)
 Write nonvolatile configuration register. More...
 
uint8_t write_nvthigh (uint8_t sign, uint8_t itemp, uint16_t ftemp)
 Write nonvolatile tHIGH limit register. More...
 
uint8_t write_nvtlow (uint8_t sign, uint8_t itemp, uint16_t ftemp)
 Write nonvolatile tLOW limit register. More...
 
uint8_t write_tcrit (uint8_t sign, uint8_t itemp, uint16_t ftemp)
 
uint8_t write_temperature_high (uint8_t sign, uint8_t itemp, uint16_t ftemp)
 Write tHIGH limit register. More...
 
uint8_t write_temperature_low (uint8_t sign, uint8_t itemp, uint16_t ftemp)
 Write tLOW limit register. More...