thermo2 2.0.0.0
thermo2.h File Reference

This file contains API for Thermo 2 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  thermo2_t
 Thermo 2 Click context object. More...
 
struct  thermo2_cfg_t
 Thermo 2 Click configuration object. More...
 

Macros

#define THERMO2_CMD_CONVERT_TEMPERATURE   0x44
 Thermo 2 commands list.
 
#define THERMO2_CMD_WRITE_SCRATCHPAD   0x4E
 
#define THERMO2_CMD_READ_SCRATCHPAD   0xBE
 
#define THERMO2_CMD_COPY_SCRATCHPAD   0x48
 
#define THERMO2_CMD_RECALL_SCRATCHPAD   0xB8
 
#define THERMO2_CMD_READ_POWER_SUPPLY   0xB4
 
#define THERMO2_CONFIG_ADDRESS_0   0x00
 Thermo 2 config register settings.
 
#define THERMO2_CONFIG_ADDRESS_1   0x01
 
#define THERMO2_CONFIG_ADDRESS_2   0x02
 
#define THERMO2_CONFIG_ADDRESS_3   0x03
 
#define THERMO2_CONFIG_ADDRESS_4   0x04
 
#define THERMO2_CONFIG_ADDRESS_5   0x05
 
#define THERMO2_CONFIG_ADDRESS_6   0x06
 
#define THERMO2_CONFIG_ADDRESS_7   0x07
 
#define THERMO2_CONFIG_ADDRESS_8   0x08
 
#define THERMO2_CONFIG_ADDRESS_9   0x09
 
#define THERMO2_CONFIG_ADDRESS_10   0x0A
 
#define THERMO2_CONFIG_ADDRESS_11   0x0B
 
#define THERMO2_CONFIG_ADDRESS_12   0x0C
 
#define THERMO2_CONFIG_ADDRESS_13   0x0D
 
#define THERMO2_CONFIG_ADDRESS_14   0x0E
 
#define THERMO2_CONFIG_ADDRESS_15   0x0F
 
#define THERMO2_CONFIG_ADDRESS_ALL   0x10
 
#define THERMO2_CONFIG_ADDRESS_BIT_MASK   0x1F
 
#define THERMO2_CONFIG_RESOLUTION_9BIT   0x00
 
#define THERMO2_CONFIG_RESOLUTION_10BIT   0x20
 
#define THERMO2_CONFIG_RESOLUTION_11BIT   0x40
 
#define THERMO2_CONFIG_RESOLUTION_12BIT   0x60
 
#define THERMO2_CONFIG_RESOLUTION_BIT_MASK   0x60
 
#define THERMO2_CONFIG_RESERVED_BITS   0x10
 
#define THERMO2_DATA_RESOLUTION   0.0625
 Thermo 2 temperature calculation values.
 
#define THERMO2_FAMILY_CODE   0x3B
 Thermo 2 family code value.
 
#define THERMO2_DEFAULT_ADDRESS   THERMO2_CONFIG_ADDRESS_ALL
 Thermo 2 default config values.
 
#define THERMO2_DEFAULT_RESOLUTION   THERMO2_CONFIG_RESOLUTION_12BIT
 
#define THERMO2_DEFAULT_TEMP_HIGH_ALARM   0xFF
 
#define THERMO2_DEFAULT_TEMP_LOW_ALARM   0x00
 
#define THERMO2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  thermo2_gpio_sel_t { THERMO2_GPIO_0 , THERMO2_GPIO_1 }
 Thermo 2 Click gpio selector. More...
 
enum  thermo2_return_value_t { THERMO2_OK = 0 , THERMO2_ERROR = -1 }
 Thermo 2 Click return value data. More...
 

Functions

void thermo2_cfg_setup (thermo2_cfg_t *cfg)
 Thermo 2 configuration object setup function.
 
void thermo2_gpio_selection (thermo2_cfg_t *cfg, thermo2_gpio_sel_t gpio_sel)
 Thermo 2 driver interface setup function.
 
err_t thermo2_init (thermo2_t *ctx, thermo2_cfg_t *cfg)
 Thermo 2 initialization function.
 
err_t thermo2_default_cfg (thermo2_t *ctx)
 Thermo 2 default configuration function.
 
err_t thermo2_check_communication (thermo2_t *ctx)
 Thermo 2 check communication function.
 
err_t thermo2_select_device (thermo2_t *ctx)
 Thermo 2 select device function.
 
err_t thermo2_start_measurement (thermo2_t *ctx)
 Thermo 2 start measurement function.
 
err_t thermo2_read_scratchpad (thermo2_t *ctx, uint8_t *scratchpad)
 Thermo 2 read scratchpad function.
 
err_t thermo2_write_scratchpad (thermo2_t *ctx, uint8_t temp_high, uint8_t temp_low, uint8_t config)
 Thermo 2 write scratchpad function.
 
err_t thermo2_read_temperature (thermo2_t *ctx, float *temperature)
 Thermo 2 read temperature function.
 

Detailed Description

This file contains API for Thermo 2 Click Driver.

Enumeration Type Documentation

◆ thermo2_gpio_sel_t

Thermo 2 Click gpio selector.

Selects gpio pin of Thermo 2 Click driver.

Enumerator
THERMO2_GPIO_0 

GPIO 0 pin.

THERMO2_GPIO_1 

GPIO 1 pin.

◆ thermo2_return_value_t

Thermo 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
THERMO2_OK 
THERMO2_ERROR