Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AT30TSE75X Temperature Sensor

This driver provides API for AT30TSE75X temperature sensor through I2C interface.

See Quick Start Guide for the SAM AT30TSE75X Temperature Sensor Driver.

Dependencies

This driver depends on the following module:

API Overview

Modules

 Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the AT30TSE75X Temperature Sensor.
 

Macros

#define AT30TSE752_EEPROM_TWI_ADDR   0x57
 
#define AT30TSE754_EEPROM_TWI_ADDR   0x56
 
#define AT30TSE758_EEPROM_TWI_ADDR   0x54
 
#define AT30TSE_CONFIG_CMP_INT   (1 << 9)
 
#define AT30TSE_CONFIG_FT0   (1 << 11)
 
#define AT30TSE_CONFIG_FT1   (1 << 12)
 
#define AT30TSE_CONFIG_FTQ(value)   ((AT30TSE_CONFIG_FTQ_Msk & ((value) << AT30TSE_CONFIG_FTQ_Pos)))
 
#define AT30TSE_CONFIG_FTQ_1_fault   0
 
#define AT30TSE_CONFIG_FTQ_Msk   (0x03 << AT30TSE_CONFIG_FTQ_Pos)
 
#define AT30TSE_CONFIG_FTQ_Pos   13
 
#define AT30TSE_CONFIG_NVRBSY   (1 << 0)
 
#define AT30TSE_CONFIG_OS   (1 << 15)
 
#define AT30TSE_CONFIG_POL   (1 << 10)
 
#define AT30TSE_CONFIG_R0   (1 << 13)
 
#define AT30TSE_CONFIG_R1   (1 << 14)
 
#define AT30TSE_CONFIG_REG   0x01
 
#define AT30TSE_CONFIG_REG_SIZE   2
 
#define AT30TSE_CONFIG_RES(value)   ((AT30TSE_CONFIG_RES_Msk & ((value) << AT30TSE_CONFIG_RES_Pos)))
 
#define AT30TSE_CONFIG_RES_10_bit   1
 
#define AT30TSE_CONFIG_RES_11_bit   2
 
#define AT30TSE_CONFIG_RES_12_bit   3
 
#define AT30TSE_CONFIG_RES_2_fault   1
 
#define AT30TSE_CONFIG_RES_4_fault   2
 
#define AT30TSE_CONFIG_RES_6_fault   3
 
#define AT30TSE_CONFIG_RES_9_bit   0
 
#define AT30TSE_CONFIG_RES_Msk   (0x03 << AT30TSE_CONFIG_RES_Pos)
 
#define AT30TSE_CONFIG_RES_Pos   13
 
#define AT30TSE_CONFIG_SD   (1 << 8)
 
#define AT30TSE_NON_VOLATILE_REG   0x10
 
#define AT30TSE_TEMPERATURE_REG   0x00
 
#define AT30TSE_TEMPERATURE_REG_SIZE   2
 
#define AT30TSE_TEMPERATURE_TWI_ADDR   0x4F
 
#define AT30TSE_THIGH_REG   0x03
 
#define AT30TSE_THIGH_REG_SIZE   2
 
#define AT30TSE_TLOW_REG   0x02
 
#define AT30TSE_TLOW_REG_SIZE   2
 
#define AT30TSE_VOLATILE_REG   0x00
 

Functions

void at30tse_eeprom_read (uint8_t *data, uint8_t length, uint8_t word_addr, uint8_t page)
 Reads data from the EEPROM. More...
 
void at30tse_eeprom_write (uint8_t *data, uint8_t length, uint8_t word_addr, uint8_t page)
 Writes the EEPROM with data provided. More...
 
void at30tse_init (void)
 Configures the TWHIS master to be used with the AT30TSE75X device. More...
 
uint16_t at30tse_read_register (uint8_t reg, uint8_t reg_type, uint8_t reg_size)
 Reads the value from the register reg. More...
 
double at30tse_read_temperature (void)
 Reads the temperature value. More...
 
void at30tse_set_register_pointer (uint8_t reg, uint8_t reg_type)
 Sets the register pointer with specified reg value. More...
 
void at30tse_write_config_register (uint16_t value)
 Writes the configuration register reg with the value passed. More...
 
void at30tse_write_register (uint8_t reg, uint8_t reg_type, uint8_t reg_size, uint16_t reg_value)
 Writes the specified register reg with the reg_value passed. More...
 

#define AT30TSE752_EEPROM_TWI_ADDR   0x57
#define AT30TSE754_EEPROM_TWI_ADDR   0x56
#define AT30TSE758_EEPROM_TWI_ADDR   0x54
#define AT30TSE_CONFIG_CMP_INT   (1 << 9)
#define AT30TSE_CONFIG_FT0   (1 << 11)
#define AT30TSE_CONFIG_FT1   (1 << 12)
#define AT30TSE_CONFIG_FTQ (   value)    ((AT30TSE_CONFIG_FTQ_Msk & ((value) << AT30TSE_CONFIG_FTQ_Pos)))
#define AT30TSE_CONFIG_FTQ_1_fault   0
#define AT30TSE_CONFIG_FTQ_Msk   (0x03 << AT30TSE_CONFIG_FTQ_Pos)
#define AT30TSE_CONFIG_FTQ_Pos   13
#define AT30TSE_CONFIG_NVRBSY   (1 << 0)
#define AT30TSE_CONFIG_OS   (1 << 15)
#define AT30TSE_CONFIG_POL   (1 << 10)
#define AT30TSE_CONFIG_R0   (1 << 13)
#define AT30TSE_CONFIG_R1   (1 << 14)
#define AT30TSE_CONFIG_REG   0x01
#define AT30TSE_CONFIG_REG_SIZE   2
#define AT30TSE_CONFIG_RES (   value)    ((AT30TSE_CONFIG_RES_Msk & ((value) << AT30TSE_CONFIG_RES_Pos)))

Referenced by main().

#define AT30TSE_CONFIG_RES_10_bit   1
#define AT30TSE_CONFIG_RES_11_bit   2
#define AT30TSE_CONFIG_RES_12_bit   3

Referenced by at30tse_read_temperature(), and main().

#define AT30TSE_CONFIG_RES_2_fault   1
#define AT30TSE_CONFIG_RES_4_fault   2
#define AT30TSE_CONFIG_RES_6_fault   3
#define AT30TSE_CONFIG_RES_9_bit   0
#define AT30TSE_CONFIG_RES_Msk   (0x03 << AT30TSE_CONFIG_RES_Pos)
#define AT30TSE_CONFIG_RES_Pos   13
#define AT30TSE_CONFIG_SD   (1 << 8)
#define AT30TSE_NON_VOLATILE_REG   0x10
#define AT30TSE_TEMPERATURE_REG   0x00
#define AT30TSE_TEMPERATURE_REG_SIZE   2
#define AT30TSE_TEMPERATURE_TWI_ADDR   0x4F
#define AT30TSE_THIGH_REG   0x03

Referenced by main().

#define AT30TSE_THIGH_REG_SIZE   2

Referenced by main().

#define AT30TSE_TLOW_REG   0x02

Referenced by main().

#define AT30TSE_TLOW_REG_SIZE   2

Referenced by main().

#define AT30TSE_VOLATILE_REG   0x00

void at30tse_eeprom_read ( uint8_t *  data,
uint8_t  length,
uint8_t  word_addr,
uint8_t  page 
)

Reads data from the EEPROM.

Parameters
[out]*dataPointer to the data buffer.
[in]lengthNumber of data bytes.
[in]word_addrWord address of the EEPROM.
[in]pagePage number of the EEPROM.

References twihs_packet::addr, twihs_packet::addr_length, AT30TSE758_EEPROM_TWI_ADDR, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_read(), and TWIHS_SUCCESS.

void at30tse_eeprom_write ( uint8_t *  data,
uint8_t  length,
uint8_t  word_addr,
uint8_t  page 
)

Writes the EEPROM with data provided.

Parameters
[out]*dataPointer to the data buffer.
[in]lengthNumber of data bytes.
[in]word_addrWord address of the EEPROM.
[in]pagePage number of the EEPROM.

References twihs_packet::addr, twihs_packet::addr_length, AT30TSE758_EEPROM_TWI_ADDR, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_write(), and TWIHS_SUCCESS.

void at30tse_init ( void  )

Configures the TWHIS master to be used with the AT30TSE75X device.

References twihs_options::master_clk, pmc_enable_periph_clk(), twihs_options::speed, sysclk_get_cpu_hz(), TWIHS_CLK, twihs_master_init(), and TWIHS_SUCCESS.

Referenced by main().

uint16_t at30tse_read_register ( uint8_t  reg,
uint8_t  reg_type,
uint8_t  reg_size 
)

Reads the value from the register reg.

Parameters
[in]regRegister to read.
[in]reg_typeType of the register (Volatile or Non-volatile).
[in]reg_sizeRegister size.
Returns
Register value.

References twihs_packet::addr, twihs_packet::addr_length, AT30TSE_TEMPERATURE_TWI_ADDR, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_read(), and TWIHS_SUCCESS.

Referenced by at30tse_read_temperature(), at30tse_write_config_register(), and main().

double at30tse_read_temperature ( void  )
void at30tse_set_register_pointer ( uint8_t  reg,
uint8_t  reg_type 
)

Sets the register pointer with specified reg value.

Parameters
[in]regRegister value of the pointer register.
[in]reg_typeRegister type being pointed by pointer register.

References twihs_packet::addr, twihs_packet::addr_length, AT30TSE_TEMPERATURE_TWI_ADDR, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_write(), and TWIHS_SUCCESS.

void at30tse_write_config_register ( uint16_t  value)

Writes the configuration register reg with the value passed.

Parameters
[in]valueRegister value to be written.

References AT30TSE_CONFIG_R0, AT30TSE_CONFIG_R1, AT30TSE_CONFIG_REG, AT30TSE_CONFIG_REG_SIZE, AT30TSE_CONFIG_RES_Msk, AT30TSE_CONFIG_RES_Pos, at30tse_read_register(), AT30TSE_VOLATILE_REG, and at30tse_write_register().

Referenced by main().

void at30tse_write_register ( uint8_t  reg,
uint8_t  reg_type,
uint8_t  reg_size,
uint16_t  reg_value 
)

Writes the specified register reg with the reg_value passed.

Parameters
[in]regRegister to write.
[in]reg_typeType of the register (Volatile or Non-volatile).
[in]reg_sizeRegister size.
[in]reg_valueValue to be written to reg.

References twihs_packet::addr, twihs_packet::addr_length, AT30TSE_TEMPERATURE_TWI_ADDR, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_write(), and TWIHS_SUCCESS.

Referenced by at30tse_write_config_register().