42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
68#define HEATER_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg1.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
81#define HEATER_RETVAL uint8_t
84#define HEATER_INIT_ERROR 0xFF
91#define HEATER_SLAVE_ADDRESS 0x4D
98#define HEATER_LED_ON 1
99#define HEATER_LED_OFF 0
105#define HEATER_SHIFT_DATA 8
106#define HEATER_ADC_VREF 3300.00f
107#define HEATER_MV_RESOLUTION 4096.00f
108#define HEATER_TEMP_RESOLUTION 10.0f
109#define HEATER_TEMP_0 500.0
112#define HEATER_DEF_FREQ 500
#define HEATER_RETVAL
Definition heater.h:81
uint16_t heater_read_data(heater_t *ctx)
Generic function for reading data from device.
void heater_set_led1_status(heater_t *ctx, uint8_t status)
Sets state of the rst pin.
void heater_pwm_stop(heater_t *ctx)
Stop PWM module.
void heater_cfg_setup(heater_cfg_t *cfg, heater_config_t *cfg1)
Config Object Initialization function.
void heater_set_duty_cycle(heater_t *ctx, float duty_cycle)
Generic sets PWM duty cycle.
float heater_read_temp(heater_t *ctx)
Function reads data and converts it to temperature data in degree C.
HEATER_RETVAL heater_init(heater_t *ctx, heater_cfg_t *cfg, heater_config_t *cfg1)
Initialization function.
float heater_read_mv(heater_t *ctx)
Function reads data from device and converts it to mV value.
void heater_set_led2_status(heater_t *ctx, uint8_t status)
Sets state of the cs pin.
void heater_pwm_start(heater_t *ctx)
Start PWM module.
Click configuration structure definition.
Definition heater.h:147
uint32_t i2c_speed
Definition heater.h:161
pin_name_t scl
Definition heater.h:150
pin_name_t sda
Definition heater.h:151
pin_name_t rst
Definition heater.h:156
pin_name_t cs
Definition heater.h:157
uint8_t i2c_address
Definition heater.h:162
uint32_t dev_pwm_freq
Definition heater.h:170
pin_name_t pwm
Definition heater.h:168
Click ctx object definition.
Definition heater.h:125
digital_out_t cs
Definition heater.h:129
uint32_t pwm_freq
Definition heater.h:139
i2c_master_t i2c
Definition heater.h:133
digital_out_t rst
Definition heater.h:128
uint8_t slave_address
Definition heater.h:138
pwm_t pwm
Definition heater.h:134