thermo2 2.0.0.0
Modules | Functions
Thermo 2 Click Driver

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

Modules

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

Functions

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

Detailed Description

API for configuring and manipulating Thermo 2 Click driver.

Function Documentation

◆ thermo2_cfg_setup()

void thermo2_cfg_setup ( thermo2_cfg_t cfg)

Thermo 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ thermo2_check_communication()

err_t thermo2_check_communication ( thermo2_t ctx)

Thermo 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 thermo2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ thermo2_default_cfg()

err_t thermo2_default_cfg ( thermo2_t ctx)

Thermo 2 default configuration function.

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

Parameters
[in]ctx: Click context object. See thermo2_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.

◆ thermo2_gpio_selection()

void thermo2_gpio_selection ( thermo2_cfg_t cfg,
thermo2_gpio_sel_t  gpio_sel 
)

Thermo 2 driver interface setup function.

This function sets a communication GPIO pin which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See thermo2_cfg_t object definition for detailed explanation.
[in]gpio_sel: GPIO pin selection. See thermo2_gpio_sel_t object definition for detailed explanation.
Returns
Nothing.
Note
This gpio selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ thermo2_init()

err_t thermo2_init ( thermo2_t ctx,
thermo2_cfg_t cfg 
)

Thermo 2 initialization function.

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

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

◆ thermo2_read_scratchpad()

err_t thermo2_read_scratchpad ( thermo2_t ctx,
uint8_t *  scratchpad 
)

Thermo 2 read scratchpad function.

This function reads the scratchpad bytes.

Parameters
[in]ctx: Click context object. See thermo2_t object definition for detailed explanation.
[out]scratchpad: Scratchpad [5-bytes] of device with the address set in ctx->config.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ thermo2_read_temperature()

err_t thermo2_read_temperature ( thermo2_t ctx,
float *  temperature 
)

Thermo 2 read temperature function.

This function reads the temperature value in Celsius.

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

◆ thermo2_select_device()

err_t thermo2_select_device ( thermo2_t ctx)

Thermo 2 select device function.

This function selects the device by performing a skip or match ROM commands depending on the address value set in the configuration byte.

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

◆ thermo2_start_measurement()

err_t thermo2_start_measurement ( thermo2_t ctx)

Thermo 2 start measurement function.

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

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

◆ thermo2_write_scratchpad()

err_t thermo2_write_scratchpad ( thermo2_t ctx,
uint8_t  temp_high,
uint8_t  temp_low,
uint8_t  config 
)

Thermo 2 write scratchpad function.

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

Parameters
[in]ctx: Click context object. See thermo2_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.