templog7 2.1.0.0
templog7.h File Reference

This file contains API for Temp-Log 7 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_one_wire.h"

Go to the source code of this file.

Data Structures

struct  templog7_scratchpad_1_t
 Temp-Log 7 scratchpad 1 object. More...
 
struct  templog7_scratchpad_2_t
 Temp-Log 7 scratchpad 2 object. More...
 
struct  templog7_t
 Temp-Log 7 Click context object. More...
 
struct  templog7_cfg_t
 Temp-Log 7 Click configuration object. More...
 

Macros

#define TEMPLOG7_CMD_CONVERT_TEMP   0x44
 Temp-Log 7 commands list.
 
#define TEMPLOG7_CMD_ALERT_SEARCH   0xEC
 
#define TEMPLOG7_CMD_WRITE_SCRATCHPAD_1   0x4E
 
#define TEMPLOG7_CMD_READ_SCRATCHPAD_1   0xBE
 
#define TEMPLOG7_CMD_COPY_SCRATCHPAD_1   0x48
 
#define TEMPLOG7_CMD_WRITE_SCRATCHPAD_2   0x0F
 
#define TEMPLOG7_CMD_READ_SCRATCHPAD_2   0xAA
 
#define TEMPLOG7_CMD_COPY_SCRATCHPAD_2   0x55
 
#define TEMPLOG7_CMD_READ_EEPROM   0xF0
 
#define TEMPLOG7_CMD_GPIO_WRITE   0xA5
 
#define TEMPLOG7_CMD_GPIO_READ   0xF5
 
#define TEMPLOG7_TEMP_RES_16BIT   0.0078125f
 Temp-Log 7 temperature calculation values.
 
#define TEMPLOG7_TEMP_RES_12BIT   0.0625f
 
#define TEMPLOG7_STATUS_ALERT_HIGH   0x80
 Temp-Log 7 status register settings.
 
#define TEMPLOG7_STATUS_ALERT_LOW   0x40
 
#define TEMPLOG7_STATUS_RESERVED   0x30
 
#define TEMPLOG7_STATUS_DATA_VALID   0x08
 
#define TEMPLOG7_STATUS_POWER_MODE   0x04
 
#define TEMPLOG7_STATUS_ARB_DONE   0x02
 
#define TEMPLOG7_STATUS_LOCK_STATUS   0x01
 
#define TEMPLOG7_CFG1_TEMP_FMT_12_BIT   0x00
 Temp-Log 7 config 1 register settings.
 
#define TEMPLOG7_CFG1_TEMP_FMT_16_BIT   0x80
 
#define TEMPLOG7_CFG1_TEMP_FMT_MASK   0x80
 
#define TEMPLOG7_CFG1_RESERVED   0x40
 
#define TEMPLOG7_CFG1_CONV_TIME_SEL_3MS   0x00
 
#define TEMPLOG7_CFG1_CONV_TIME_SEL_5p5MS   0x20
 
#define TEMPLOG7_CFG1_CONV_TIME_SEL_MASK   0x20
 
#define TEMPLOG7_CFG1_ALERT_MODE_ALERT   0x00
 
#define TEMPLOG7_CFG1_ALERT_MODE_COMPARATOR   0x10
 
#define TEMPLOG7_CFG1_ALERT_MODE_MASK   0x10
 
#define TEMPLOG7_CFG1_AVG_SEL_NO_AVG   0x00
 
#define TEMPLOG7_CFG1_AVG_SEL_8_B2B_CONV   0x08
 
#define TEMPLOG7_CFG1_AVG_SEL_MASK   0x08
 
#define TEMPLOG7_CFG1_CONV_MODE_SEL_ONE_SHOT   0x00
 
#define TEMPLOG7_CFG1_CONV_MODE_SEL_STACKED   0x01
 
#define TEMPLOG7_CFG1_CONV_MODE_SEL_AUTO   0x02
 
#define TEMPLOG7_CFG1_CONV_MODE_SEL_MASK   0x07
 
#define TEMPLOG7_CFG2_OD_DIS   0x00
 Temp-Log 7 config 2 register settings.
 
#define TEMPLOG7_CFG2_OD_EN   0x80
 
#define TEMPLOG7_CFG2_OD_MASK   0x80
 
#define TEMPLOG7_CFG2_FLEX_ADDR_MODE_HOST   0x00
 
#define TEMPLOG7_CFG2_FLEX_ADDR_MODE_IO   0x20
 
#define TEMPLOG7_CFG2_FLEX_ADDR_MODE_RES   0x40
 
#define TEMPLOG7_CFG2_FLEX_ADDR_MODE_IO_RES   0x60
 
#define TEMPLOG7_CFG2_FLEX_ADDR_MODE_MASK   0x60
 
#define TEMPLOG7_CFG2_ARB_MODE_DIS   0x00
 
#define TEMPLOG7_CFG2_ARB_MODE_SOFT_EN   0x10
 
#define TEMPLOG7_CFG2_ARB_MODE_FAST_EN   0x18
 
#define TEMPLOG7_CFG2_ARB_MODE_MASK   0x18
 
#define TEMPLOG7_CFG2_HYSTERESIS_5_C   0x00
 
#define TEMPLOG7_CFG2_HYSTERESIS_10_C   0x02
 
#define TEMPLOG7_CFG2_HYSTERESIS_15_C   0x04
 
#define TEMPLOG7_CFG2_HYSTERESIS_20_C   0x06
 
#define TEMPLOG7_CFG2_HYSTERESIS_MASK   0x06
 
#define TEMPLOG7_CFG2_LOCK_DIS   0x00
 
#define TEMPLOG7_CFG2_LOCK_EN   0x01
 
#define TEMPLOG7_CFG2_LOCK_MASK   0x01
 
#define TEMPLOG7_TEMP_ALERT_LOW   5.0f
 Temp-Log 7 default temperature alert and offset values.
 
#define TEMPLOG7_TEMP_ALERT_HIGH   40.0f
 
#define TEMPLOG7_TEMP_OFFSET   0.0f
 
#define TEMPLOG7_IO_READ_NIO3_STATE   0x80
 Temp-Log 7 IO read register settings.
 
#define TEMPLOG7_IO_READ_NIO2_STATE   0x40
 
#define TEMPLOG7_IO_READ_NIO1_STATE   0x20
 
#define TEMPLOG7_IO_READ_NIO0_STATE   0x10
 
#define TEMPLOG7_IO_READ_IO3_STATE   0x08
 
#define TEMPLOG7_IO_READ_IO2_STATE   0x04
 
#define TEMPLOG7_IO_READ_IO1_STATE   0x02
 
#define TEMPLOG7_IO_READ_IO0_STATE   0x01
 
#define TEMPLOG7_IO_CFG_IO3_SEL_INPUT   0x00
 Temp-Log 7 IO config register settings.
 
#define TEMPLOG7_IO_CFG_IO3_SEL_OUTPUT_LOW   0x80
 
#define TEMPLOG7_IO_CFG_IO3_SEL_OUTPUT_HIGH   0xC0
 
#define TEMPLOG7_IO_CFG_IO3_SEL_MASK   0xC0
 
#define TEMPLOG7_IO_CFG_IO2_SEL_INPUT   0x00
 
#define TEMPLOG7_IO_CFG_IO2_SEL_ALERT   0x10
 
#define TEMPLOG7_IO_CFG_IO2_SEL_OUTPUT_LOW   0x20
 
#define TEMPLOG7_IO_CFG_IO2_SEL_OUTPUT_HIGH   0x30
 
#define TEMPLOG7_IO_CFG_IO2_SEL_MASK   0x30
 
#define TEMPLOG7_IO_CFG_IO1_SEL_INPUT   0x00
 
#define TEMPLOG7_IO_CFG_IO1_SEL_OUTPUT_LOW   0x08
 
#define TEMPLOG7_IO_CFG_IO1_SEL_OUTPUT_HIGH   0x0C
 
#define TEMPLOG7_IO_CFG_IO1_SEL_MASK   0x0C
 
#define TEMPLOG7_IO_CFG_IO0_SEL_INPUT   0x00
 
#define TEMPLOG7_IO_CFG_IO0_SEL_OUTPUT_LOW   0x02
 
#define TEMPLOG7_IO_CFG_IO0_SEL_OUTPUT_HIGH   0x03
 
#define TEMPLOG7_IO_CFG_IO0_SEL_MASK   0x03
 
#define TEMPLOG7_IO_CHECK_CODE_OK   0xAA
 
#define TEMPLOG7_EEPROM_ADDR_MIN   0x00
 Temp-Log 7 EEPROM settings.
 
#define TEMPLOG7_EEPROM_ADDR_MAX   0xFF
 
#define TEMPLOG7_EEPROM_ADDR_BLOCK   8
 
#define TEMPLOG7_EEPROM_ADDR_MASK   0xFFF8u
 
#define TEMPLOG7_COPY_SCRATCHPAD_2_QUALIFIER   0xA5
 Temp-Log 7 scratchpad 2 settings.
 
#define TEMPLOG7_FAMILY_CODE   0x26
 Temp-Log 7 family code value.
 
#define TEMPLOG7_ADDRESS_0   0x00
 Temp-Log 7 address selection macros.
 
#define TEMPLOG7_ADDRESS_ALL   0xFF
 
#define TEMPLOG7_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  templog7_gpio_sel_t { TEMPLOG7_GPIO_0 , TEMPLOG7_GPIO_1 }
 Temp-Log 7 Click gpio selector. More...
 
enum  templog7_return_value_t { TEMPLOG7_OK = 0 , TEMPLOG7_ERROR = -1 }
 Temp-Log 7 Click return value data. More...
 

Functions

void templog7_cfg_setup (templog7_cfg_t *cfg)
 Temp-Log 7 configuration object setup function.
 
void templog7_gpio_selection (templog7_cfg_t *cfg, templog7_gpio_sel_t gpio_sel)
 Temp-Log 7 driver interface setup function.
 
err_t templog7_init (templog7_t *ctx, templog7_cfg_t *cfg)
 Temp-Log 7 initialization function.
 
err_t templog7_default_cfg (templog7_t *ctx)
 Temp-Log 7 default configuration function.
 
err_t templog7_check_communication (templog7_t *ctx)
 Temp-Log 7 check communication function.
 
err_t templog7_select_device (templog7_t *ctx)
 Temp-Log 7 select device function.
 
err_t templog7_write_scratchpad_1 (templog7_t *ctx, templog7_scratchpad_1_t *scratchpad)
 Temp-Log 7 write scratchpad 1 function.
 
err_t templog7_read_scratchpad_1 (templog7_t *ctx, templog7_scratchpad_1_t *scratchpad)
 Temp-Log 7 read scratchpad 1 function.
 
err_t templog7_copy_scratchpad_1 (templog7_t *ctx)
 Temp-Log 7 copy scratchpad 1 function.
 
err_t templog7_write_scratchpad_2 (templog7_t *ctx, templog7_scratchpad_2_t *scratchpad)
 Temp-Log 7 write scratchpad 2 function.
 
err_t templog7_read_scratchpad_2 (templog7_t *ctx, templog7_scratchpad_2_t *scratchpad)
 Temp-Log 7 read scratchpad 2 function.
 
err_t templog7_copy_scratchpad_2 (templog7_t *ctx)
 Temp-Log 7 copy scratchpad 2 function.
 
err_t templog7_start_measurement (templog7_t *ctx)
 Temp-Log 7 start measurement function.
 
err_t templog7_read_temperature (templog7_t *ctx, float *temperature)
 Temp-Log 7 read temperature function.
 
err_t templog7_write_eeprom (templog7_t *ctx, uint16_t address, uint8_t *data_in, uint16_t len)
 Temp-Log 7 write EEPROM function.
 
err_t templog7_read_eeprom (templog7_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len)
 Temp-Log 7 read EEPROM function.
 
err_t templog7_clear_eeprom (templog7_t *ctx)
 Temp-Log 7 clear EEPROM function.
 
err_t templog7_write_gpio (templog7_t *ctx, uint8_t data_in)
 Temp-Log 7 write gpio function.
 
err_t templog7_read_gpio (templog7_t *ctx, uint8_t *data_out)
 Temp-Log 7 read gpio function.
 
uint8_t templog7_get_alert_pin (templog7_t *ctx)
 Temp-Log 7 get alert pin function.
 

Detailed Description

This file contains API for Temp-Log 7 Click Driver.

Enumeration Type Documentation

◆ templog7_gpio_sel_t

Temp-Log 7 Click gpio selector.

Selects gpio pin of Temp-Log 7 Click driver.

Enumerator
TEMPLOG7_GPIO_0 

GPIO 0 pin.

TEMPLOG7_GPIO_1 

GPIO 1 pin.

◆ templog7_return_value_t

Temp-Log 7 Click return value data.

Predefined enum values for driver return values.

Enumerator
TEMPLOG7_OK 
TEMPLOG7_ERROR