thermostat2 2.0.0.0
Thermostat 2 Click Driver

API for configuring and manipulating Thermostat 2 Click driver. More...

Topics

 Thermostat 2 Commands List
 List of commands of Thermostat 2 Click driver.
 
 Thermostat 2 Settings
 Settings of Thermostat 2 Click driver.
 
 Thermostat 2 MikroBUS Map
 MikroBUS pin mapping of Thermostat 2 Click driver.
 

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

API for configuring and manipulating Thermostat 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ thermostat2_cfg_setup()

void thermostat2_cfg_setup ( thermostat2_cfg_t * cfg)

Thermostat 2 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See thermostat2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ thermostat2_check_communication()

err_t thermostat2_check_communication ( thermostat2_t * ctx)

Thermostat 2 check communication function.

This function checks the communication by reading the ROM address twice and comparing the two results, as well as verifying the family code byte.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ thermostat2_default_cfg()

err_t thermostat2_default_cfg ( thermostat2_t * ctx)

Thermostat 2 default configuration function.

This function executes a default configuration of Thermostat 2 click board.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ thermostat2_init()

err_t thermostat2_init ( thermostat2_t * ctx,
thermostat2_cfg_t * cfg )

Thermostat 2 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See thermostat2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ thermostat2_read_scratchpad()

err_t thermostat2_read_scratchpad ( thermostat2_t * ctx,
uint8_t * scratchpad )

Thermostat 2 read scratchpad function.

This function reads a desired number of scratchpad bytes using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
[out]scratchpad: Output read scratchpad.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ thermostat2_read_temperature()

err_t thermostat2_read_temperature ( thermostat2_t * ctx,
float * temperature )

Thermostat 2 read temperature function.

This function reads the temperature value in Celsius.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
[out]temperature: Pointing to the address where to store temperature.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ thermostat2_relay_state()

void thermostat2_relay_state ( thermostat2_t * ctx,
uint8_t state )

Thermostat 2 relay state function.

This function turns the relay on/off.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
[in]state: On/off state of the relay.
Returns
Nothing.
Note
None.

◆ thermostat2_start_measurement()

err_t thermostat2_start_measurement ( thermostat2_t * ctx)

Thermostat 2 start measurement function.

This function starts the measurement by sending an appropriate command for that.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ thermostat2_write_scratchpad()

err_t thermostat2_write_scratchpad ( thermostat2_t * ctx,
uint8_t temp_high,
uint8_t temp_low,
uint8_t config )

Thermostat 2 write scratchpad function.

This function writes the temperature thresholds and configuration byte to the scratchpad.

Parameters
[in]ctx: Click context object. See thermostat2_t object definition for detailed explanation.
[in]temp_high: Temperature high limit.
[in]temp_low: Temperature low limit.
[in]config: Configuration byte.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.