Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

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...
 

void attach_device ( uint8_t  device_addr,
device_type_t  type 
)

attach_device, initialize epprom variable associcated with device

Parameters
device_addrdevice address register offset address
typedevice type
Returns
none

References AT30TS75, AT30TS750, AT30TSE002B, AT30TSE752, AT30TSE754, AT30TSE758, _ts_device::device_type, _ts_device::eeprom_size, and _ts_device::ts_reg_addr.

int8_t check_NVRBSY ( void  )

Checks at30ts75 NVRBSY, RLCKDWN and RCLK bits.

Returns
AT30TS_SUCCESS if all bits = 0, error code otherwise

References AT30TS_NVRBSY_BUSY, AT30TS_REG_LOCKED, at30ts_status, AT30TS_SUCCESS, CONFIG_REG, NV_CONFIG_REG, NVRBSY, RLCK_MSK, RLCKDWN_MSK, ts_read_register(), and TWI_SUCCESS.

Referenced by ts75_copy_nonvol_vol_register(), ts75_copy_vol_nonvol_register(), and ts_write_register().

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 sensor_data)

Read nonvolatile config register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References at30ts_iobuf, at30ts_status, buftoval, CONFIG_REG, CONFIGUR_REG, ts_read_register(), and sensor_data_t::value.

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 sensor_data)

Read nonvolatile config register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
AT30TS_SUCCESS if all bits = 0, error code otherwise

References at30ts_iobuf, at30ts_status, buftoval, NV_CONFIG_REG, ts_read_register(), and sensor_data_t::value.

uint8_t read_nvthigh ( sensor_data_t sensor_data)

Read nonvolatile tHIGH limit register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References at30ts_iobuf, at30ts_status, buftoval, NV_THILIM_REG, and ts_read_register().

uint8_t read_nvtlow ( sensor_data_t sensor_data)

Read nonvolatile tLOW limit register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References at30ts_iobuf, at30ts_status, buftoval, NV_TLOLIM_REG, and ts_read_register().

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 sensor_data)

Read temperature register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References at30ts_status, AT30TS_TWI_WRITE_NACK, TEMP_DATA_REG, TEMPER_REG, sensor_data_t::temperature, ts_read_register(), and TWI_SUCCESS.

uint8_t read_temperature_high ( sensor_data_t sensor_data)

Read tHIGH limit register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References at30ts_iobuf, at30ts_status, buftoval, THILIM_REG, TRIP_UPR_REG, and ts_read_register().

uint8_t read_temperature_low ( sensor_data_t sensor_data)

Read tLOW limit register.

Parameters
*sensor_dataWhere to store the retrieved data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References at30ts_iobuf, at30ts_status, buftoval, TLOLIM_REG, TRIP_LWR_REG, and ts_read_register().

uint8_t set_nvconfig_option ( sensor_data_t data,
opt_flag_t  flag,
nvconfig_options_t  opt 
)

Set bit(s) in nonvolatile configuration register.

Returns
AT30TS_SUCCESS if all bits = 0, error code otherwise

References AT30TS_CMP_INT_MODE, AT30TS_FAULT, at30ts_iobuf, AT30TS_OS, AT30TS_POL, AT30TS_RES, AT30TS_RLCK, AT30TS_RLCKDWN, AT30TS_SD, buftoval, NV_CONFIG_REG, ts_read_register(), sensor_data_t::value, and write_config().

int8_t ts75_copy_nonvol_vol_register ( void  )

Copy nonvolatile registers to volatile registers.

Returns
TWI_SUCCESS if copy was successful, error code otherwise

References twi_package_t::addr_length, at30ts_status, AT30TS_SUCCESS, AT30TS_TWI_WRITE_NACK, twi_package_t::buffer, check_NVRBSY(), twi_package_t::chip, copy_nonvol_vol_register, twi_package_t::length, _ts_device::ts_reg_addr, TWI_SUCCESS, and twi_write().

int8_t ts75_copy_vol_nonvol_register ( void  )

Copy volatile registers to nonvolatile registers.

Returns
TWI_SUCCESS if copy was successful, error code otherwise

References twi_package_t::addr_length, at30ts_status, AT30TS_SUCCESS, AT30TS_TWI_WRITE_NACK, twi_package_t::buffer, check_NVRBSY(), twi_package_t::chip, copy_vol_nonvol_register, twi_package_t::length, _ts_device::ts_reg_addr, TWI_SUCCESS, and twi_write().

int8_t ts75_probe_nonvol_register ( uint8_t  device_addr)

Probe at30ts75 nonvolatile configuration register.

Parameters
device_addrat30ts75 device address
Returns
TWI_SUCCESS if device ACK's, error code otherwise

References twi_package_t::addr_length, at30ts_status, AT30TS_TWI_WRITE_NACK, twi_package_t::buffer, twi_package_t::chip, twi_package_t::length, nv_config, TWI_SUCCESS, and twi_write().

int8_t ts_ack_polling ( uint8_t  addr)

ACK polling function.

Parameters
addrdevice address to ACK poll
Returns
AT30TS_SUCCESS if all bytes were read, otherwise error code: AT30TS_TWI_WRITE_NACK

References AT30TS_SUCCESS, AT30TS_TWI_WRITE_NACK, twi_probe_device(), and TWI_SUCCESS.

Referenced by ts_write_eeprom().

void ts_construct_eeprom_address ( twi_package_t packet,
uint16_t  address 
)

Constructs an eeprom address.

Parameters
[in,out]packetpointer to packet structure
[in]addresseeprom address

References AT30TSE002B, AT30TSE752, AT30TSE754, AT30TSE758, twi_package_t::chip, _ts_device::device_type, and _ts_device::ts_reg_addr.

Referenced by ts_read_eeprom(), and ts_write_eeprom().

int8_t ts_read_eeprom ( uint16_t  address,
uint16_t  size,
uint8_t *  buf 
)

Read EEPROM.

Parameters
addressData word address
sizeSize of the data to read
*bufWhere to store the data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References twi_package_t::addr, twi_package_t::addr_length, AT30TS_INVALID_EEPROM_ADDRESS, at30ts_status, AT30TS_TWI_READ_NACK, AT30TS_TWI_WRITE_NACK, twi_package_t::buffer, _ts_device::eeprom_size, twi_package_t::length, ts_construct_eeprom_address(), twi_read(), TWI_SUCCESS, and twi_write().

int8_t ts_read_register ( const uint8_t  pointer_reg,
uint8_t *  buf 
)

Read at30ts75xx configuration register.

Parameters
pointer_regregister offset address
*bufstore temperature data
Returns
TWI_SUCCESS if all bytes were read, error code otherwise

References twi_package_t::addr_length, AT30TS_TWI_READ_NACK, AT30TS_TWI_WRITE_NACK, twi_package_t::buffer, twi_package_t::chip, twi_package_t::length, _ts_device::ts_reg_addr, twi_read(), TWI_SUCCESS, and twi_write().

Referenced by check_NVRBSY(), read_config(), read_nvconfig(), read_nvthigh(), read_nvtlow(), read_temperature(), read_temperature_high(), read_temperature_low(), set_config_option(), and set_nvconfig_option().

int8_t ts_write_eeprom ( uint16_t  address,
uint16_t  size,
uint8_t *  buf 
)

Write EEPROM.

Parameters
addressData word address
sizeSize of the data to write
*bufData to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References twi_package_t::addr, twi_package_t::addr_length, AT30TS_INVALID_EEPROM_ADDRESS, AT30TS_INVALID_SIZE, at30ts_status, AT30TS_TWI_WRITE_NACK, twi_package_t::buffer, twi_package_t::chip, data, _ts_device::eeprom_size, twi_package_t::length, PAGE_SIZE, ts_ack_polling(), ts_construct_eeprom_address(), TWI_SUCCESS, and twi_write().

Referenced by ts_write_memory().

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)

Parameters
addressData word address
sizeSize of the data to write
*bufData to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_status, PAGE_SIZE, ts_write_eeprom(), and TWI_SUCCESS.

int8_t ts_write_register ( uint8_t *  obuf)
uint8_t twi_read ( twi_package_t packet)

References twi_master_read().

Referenced by ts_read_eeprom(), and ts_read_register().

uint8_t write_config ( uint16_t  val)

Write configuration register.

Parameters
valData to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_iobuf, CONFIG_REG, CONFIGUR_REG, ts_write_register(), and valtobuf.

Referenced by set_config_option(), and set_nvconfig_option().

uint8_t write_nvconfig ( uint16_t  val)

Write nonvolatile configuration register.

Parameters
valData to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_iobuf, NV_CONFIG_REG, ts_write_register(), and valtobuf.

uint8_t write_nvthigh ( uint8_t  sign,
uint8_t  itemp,
uint16_t  ftemp 
)

Write nonvolatile tHIGH limit register.

Parameters
valData to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_iobuf, neg, NV_THILIM_REG, ts_write_register(), and valtobuf.

uint8_t write_nvtlow ( uint8_t  sign,
uint8_t  itemp,
uint16_t  ftemp 
)

Write nonvolatile tLOW limit register.

Parameters
valData to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_iobuf, neg, NV_TLOLIM_REG, ts_write_register(), and valtobuf.

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.

Parameters
signtemperature sign, used for conversion
itempInteger data part to be written
ftempFractional data to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_iobuf, neg, THILIM_REG, TRIP_UPR_REG, ts_write_register(), and valtobuf.

uint8_t write_temperature_low ( uint8_t  sign,
uint8_t  itemp,
uint16_t  ftemp 
)

Write tLOW limit register.

Parameters
signtemperature sign, used for conversion
itempInteger data part to be written
ftempFractional data to be written
Returns
TWI_SUCCESS if all bytes were written, error code otherwise

References at30ts_iobuf, neg, TLOLIM_REG, TRIP_LWR_REG, ts_write_register(), and valtobuf.