thermostat2 2.0.0.0
thermostat2.h File Reference

This file contains API for Thermostat 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  thermostat2_t
 Thermostat 2 Click context object. More...
 
struct  thermostat2_cfg_t
 Thermostat 2 Click configuration object. More...
 

Macros

#define THERMOSTAT2_CMD_WRITE_SCRATCHPAD   0x4E
 Thermostat 2 commands list.
 
#define THERMOSTAT2_CMD_READ_SCRATCHPAD   0xBE
 
#define THERMOSTAT2_CMD_COPY_SCRATCHPAD   0x48
 
#define THERMOSTAT2_CMD_CONVERT_TEMPERATURE   0x44
 
#define THERMOSTAT2_CMD_RECALL_SCRATCHPAD   0xB8
 
#define THERMOSTAT2_CMD_READ_POWER_SUPPLY   0xB4
 
#define THERMOSTAT2_CONFIG_RESOLUTION_9BIT   0x00
 Thermostat 2 default config values.
 
#define THERMOSTAT2_CONFIG_RESOLUTION_10BIT   0x20
 
#define THERMOSTAT2_CONFIG_RESOLUTION_11BIT   0x40
 
#define THERMOSTAT2_CONFIG_RESOLUTION_12BIT   0x60
 
#define THERMOSTAT2_CONFIG_RESOLUTION_BIT_MASK   0x60
 
#define THERMOSTAT2_CONFIG_RESERVED_BITS   0x1F
 
#define THERMOSTAT2_FAMILY_CODE   0x10
 Thermostat 2 family code value.
 
#define THERMOSTAT2_RESOLUTION_9BIT   0.5
 Thermostat 2 temperature calculation values.
 
#define THERMOSTAT2_RESOLUTION_10BIT   0.25
 
#define THERMOSTAT2_RESOLUTION_11BIT   0.125
 
#define THERMOSTAT2_RESOLUTION_12BIT   0.0625
 
#define THERMOSTAT2_DEFAULT_RESOLUTION   THERMOSTAT2_CONFIG_RESOLUTION_9BIT
 Thermostat 2 default config values.
 
#define THERMOSTAT2_DEFAULT_TEMP_HIGH_ALARM   0xFF
 
#define THERMOSTAT2_DEFAULT_TEMP_LOW_ALARM   0x00
 
#define THERMOSTAT2_RELAY_ON   0x01
 Thermostat 2 temperature values and relay states.
 
#define THERMOSTAT2_RELAY_OFF   0x00
 
#define THERMOSTAT2_TEMPERATURE_LIMIT   28.0
 
#define THERMOSTAT2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  thermostat2_return_value_t { THERMOSTAT2_OK = 0 , THERMOSTAT2_ERROR = -1 }
 Thermostat 2 Click return value data. More...
 

Functions

void thermostat2_cfg_setup (thermostat2_cfg_t *cfg)
 Thermostat 2 configuration object setup function.
 
err_t thermostat2_init (thermostat2_t *ctx, thermostat2_cfg_t *cfg)
 Thermostat 2 initialization function.
 
err_t thermostat2_default_cfg (thermostat2_t *ctx)
 Thermostat 2 default configuration function.
 
err_t thermostat2_check_communication (thermostat2_t *ctx)
 Thermostat 2 check communication function.
 
err_t thermostat2_read_scratchpad (thermostat2_t *ctx, uint8_t *scratchpad)
 Thermostat 2 read scratchpad function.
 
err_t thermostat2_write_scratchpad (thermostat2_t *ctx, uint8_t temp_high, uint8_t temp_low, uint8_t config)
 Thermostat 2 write scratchpad function.
 
err_t thermostat2_start_measurement (thermostat2_t *ctx)
 Thermostat 2 start measurement function.
 
void thermostat2_relay_state (thermostat2_t *ctx, uint8_t state)
 Thermostat 2 relay state function.
 
err_t thermostat2_read_temperature (thermostat2_t *ctx, float *temperature)
 Thermostat 2 read temperature function.
 

Detailed Description

This file contains API for Thermostat 2 Click Driver.

Enumeration Type Documentation

◆ thermostat2_return_value_t

Thermostat 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
THERMOSTAT2_OK 
THERMOSTAT2_ERROR