cooler  2.1.0.0
Data Structures | Macros | Enumerations | Functions
cooler.h File Reference

This file contains API for Cooler Click Driver. More...

#include "mikrosdk_version.h"
#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_analog_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  cooler_t
 Cooler Click context object. More...
 
struct  cooler_cfg_t
 Cooler Click configuration object. More...
 

Macros

#define COOLER_REG_SENSOR_VOLTAGE   0x00
 Cooler description register. More...
 
#define COOLER_REG_LOCAL_TEMPERATURE   0x01
 
#define COOLER_REG_CONFIGURATION   0x02
 
#define COOLER_REG_OBJECT_TEMPERATURE   0x03
 
#define COOLER_REG_STATUS   0x04
 
#define COOLER_REG_STATUS_MASK_AND_ENABLE   0x05
 
#define COOLER_REG_OBJECT_HIGH_LIMIT_TEMP   0x06
 
#define COOLER_REG_OBJECT_LOW_LIMIT_TEMP   0x07
 
#define COOLER_REG_LOCAL_HIGH_LIMIT_TEMP   0x08
 
#define COOLER_REG_LOCAL_LOW_LIMIT_TEMP   0x09
 
#define COOLER_REG_S0_COEFFICIENT   0x0A
 
#define COOLER_REG_A0_COEFFICIENT   0x0B
 
#define COOLER_REG_A1_COEFFICIENT   0x0C
 
#define COOLER_REG_B0_COEFFICIENT   0x0D
 
#define COOLER_REG_B1_COEFFICIENT   0x0E
 
#define COOLER_REG_B2_COEFFICIENT   0x0F
 
#define COOLER_REG_C_COEFFICIENT   0x10
 
#define COOLER_REG_TC0_COEFFICIENT   0X11
 
#define COOLER_REG_TC1_COEFFICIENT   0x12
 
#define COOLER_REG_MANUFACTURER_ID   0x1E
 
#define COOLER_REG_DEVICE_ID   0x1F
 
#define COOLER_REG_MEMORY_ACCESS   0x2A
 
#define COOLER_CFG_MODEON   0x1000u
 Cooler configuration setting. More...
 
#define COOLER_CFG_RESET   0x8000u
 
#define COOLER_CFG_1SAMPLE   0x0000u
 
#define COOLER_CFG_2SAMPLE   0x0200u
 
#define COOLER_CFG_4SAMPLE   0x0400u
 
#define COOLER_CFG_8SAMPLE   0x0600u
 
#define COOLER_CFG_16SAMPLE   0x0800u
 
#define COOLER_CFG_ALERTEN   0x0100u
 
#define COOLER_CFG_ALERTF   0x0080u
 
#define COOLER_CFG_TRANSC   0x0040u
 
#define COOLER_STAT_ALERTEN   0x8000u
 Cooler status mask and enable setting. More...
 
#define COOLER_STAT_CRTEN   0x4000u
 
#define COOLER_DEVICE_ID   0x0078u
 Cooler device ID value. More...
 
#define COOLER_TEMPERATURE_SENS   0.03125f
 Cooler ADC setting. More...
 
#define COOLER_SENSOR_VTG_SENS   0.15625f
 
#define COOLER_ADC_RESOLUTION   0x0FFFu
 Cooler ADC setting. More...
 
#define COOLER_VREF_3V3   3.3f
 
#define COOLER_VREF_5V   5.0f
 
#define COOLER_SET_DEV_ADDR_0   0x40
 Cooler device address setting. More...
 
#define COOLER_SET_DEV_ADDR_1   0x41
 
#define COOLER_SET_DEV_ADDR_2   0x44
 
#define COOLER_SET_DEV_ADDR_3   0x45
 
#define COOLER_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  cooler_drv_t { COOLER_DRV_SEL_ADC, COOLER_DRV_SEL_I2C }
 Cooler Click driver selector. More...
 
enum  cooler_return_value_t { COOLER_OK = 0, COOLER_ERROR = -1 }
 Cooler Click return value data. More...
 
enum  cooler_out_state_t { COOLER_ENABLE = 0, COOLER_DISABLE }
 Cooler Click cooler states selection. More...
 

Functions

void cooler_cfg_setup (cooler_cfg_t *cfg)
 Cooler configuration object setup function. More...
 
err_t cooler_init (cooler_t *ctx, cooler_cfg_t *cfg)
 Cooler initialization function. More...
 
err_t cooler_default_cfg (cooler_t *ctx)
 Cooler default configuration function. More...
 
err_t cooler_generic_write (cooler_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Cooler data writing function. More...
 
err_t cooler_generic_read (cooler_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Cooler data reading function. More...
 
err_t cooler_data_write (cooler_t *ctx, uint8_t reg, uint16_t data_in)
 Cooler 16-bit data writing function. More...
 
err_t cooler_data_read (cooler_t *ctx, uint8_t reg, uint16_t *data_out)
 Cooler 16-bit data reading function. More...
 
err_t cooler_get_device_id (cooler_t *ctx, uint16_t *device_id)
 Cooler get device ID function. More...
 
err_t cooler_sensor_voltage (cooler_t *ctx, float *voltage)
 Cooler get sensor voltage result function. More...
 
err_t cooler_get_object_temperature (cooler_t *ctx, float *temperature)
 Cooler get object temperature function. More...
 
uint8_t cooler_get_alert (cooler_t *ctx)
 Cooler fault indication function. More...
 
err_t cooler_read_raw_adc (cooler_t *ctx, uint16_t *raw_adc)
 Cooler read raw ADC value function. More...
 
err_t cooler_read_voltage (cooler_t *ctx, float *voltage)
 Cooler read voltage level function. More...
 
err_t cooler_set_vref (cooler_t *ctx, float vref)
 Cooler set vref function. More...
 
void cooler_set_in1_pin (cooler_t *ctx)
 Cooler set IN1 pin state function. More...
 
void cooler_clear_in1_pin (cooler_t *ctx)
 Cooler IN1 pin clearing function. More...
 
void cooler_set_in2_pin (cooler_t *ctx)
 Cooler set IN2 pin state function. More...
 
void cooler_clear_in2_pin (cooler_t *ctx)
 Cooler IN2 pin clearing function. More...
 
err_t cooler_set_out_state (cooler_t *ctx, cooler_out_state_t out_state)
 Cooler set output function. More...
 

Detailed Description

This file contains API for Cooler Click Driver.

Enumeration Type Documentation

◆ cooler_drv_t

Cooler Click driver selector.

Selects target driver interface of Cooler Click driver.

Enumerator
COOLER_DRV_SEL_ADC 

ADC driver descriptor.

COOLER_DRV_SEL_I2C 

I2C driver descriptor.

◆ cooler_out_state_t

Cooler Click cooler states selection.

Predefined enum values for cooler states selection.

Enumerator
COOLER_ENABLE 
COOLER_DISABLE 

◆ cooler_return_value_t

Cooler Click return value data.

Predefined enum values for driver return values.

Enumerator
COOLER_OK 
COOLER_ERROR