Go to the documentation of this file.
39 #ifdef PREINIT_SUPPORTED
43 #ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
73 #define HWMONITOR_REG_CONFIGURATION 0x00
74 #define HWMONITOR_REG_INT_STATUS_1 0x01
75 #define HWMONITOR_REG_INT_STATUS_2 0x02
76 #define HWMONITOR_REG_INT_MASK_1 0x03
77 #define HWMONITOR_REG_INT_MASK_2 0x04
78 #define HWMONITOR_REG_FAN_DIVISOR 0x05
79 #define HWMONITOR_REG_OS_T_RES_CONFIG 0x06
80 #define HWMONITOR_REG_CONVERSION_RATE 0x07
81 #define HWMONITOR_REG_CHANNEL_DISABLE 0x08
82 #define HWMONITOR_REG_RAM_IN_0 0x20
83 #define HWMONITOR_REG_RAM_IN_1 0x21
84 #define HWMONITOR_REG_RAM_IN_2 0x22
85 #define HWMONITOR_REG_RAM_IN_3 0x23
86 #define HWMONITOR_REG_RAM_IN_4 0x24
87 #define HWMONITOR_REG_RAM_IN_5 0x25
88 #define HWMONITOR_REG_RAM_IN_6 0x26
89 #define HWMONITOR_REG_RAM_TEMPERATURE 0x27
90 #define HWMONITOR_REG_RAM_FAN_1 0x28
91 #define HWMONITOR_REG_RAM_FAN_2 0x29
92 #define HWMONITOR_REG_RAM_LIM_IN_0_H 0x2A
93 #define HWMONITOR_REG_RAM_LIM_IN_0_L 0x2B
94 #define HWMONITOR_REG_RAM_LIM_IN_1_H 0x2C
95 #define HWMONITOR_REG_RAM_LIM_IN_1_L 0x2D
96 #define HWMONITOR_REG_RAM_LIM_IN_2_H 0x2E
97 #define HWMONITOR_REG_RAM_LIM_IN_2_L 0x2F
98 #define HWMONITOR_REG_RAM_LIM_IN_3_H 0x30
99 #define HWMONITOR_REG_RAM_LIM_IN_3_L 0x31
100 #define HWMONITOR_REG_RAM_LIM_IN_4_H 0x32
101 #define HWMONITOR_REG_RAM_LIM_IN_4_L 0x33
102 #define HWMONITOR_REG_RAM_LIM_IN_5_H 0x34
103 #define HWMONITOR_REG_RAM_LIM_IN_5_L 0x35
104 #define HWMONITOR_REG_RAM_LIM_IN_6_H 0x36
105 #define HWMONITOR_REG_RAM_LIM_IN_6_L 0x37
106 #define HWMONITOR_REG_RAM_LIM_HOT_H 0x38
107 #define HWMONITOR_REG_RAM_LIM_HOT_L 0x39
108 #define HWMONITOR_REG_RAM_LIM_TEMP_H 0x3A
109 #define HWMONITOR_REG_RAM_LIM_TEMP_L 0x3B
110 #define HWMONITOR_REG_RAM_CURRENT_LIM_FUN_1 0x3C
111 #define HWMONITOR_REG_RAM_CURRENT_LIM_FUN_2 0x3D
112 #define HWMONITOR_REG_RAM_MANUFACTURE_ID 0x3E
113 #define HWMONITOR_REG_RAM_REVISION_ID 0x3F
131 #define HWMONITOR_SET_CONFIG_START_DIS 0x00
132 #define HWMONITOR_SET_CONFIG_START_EN 0x01
133 #define HWMONITOR_SET_CONFIG_INT_DIS 0x00
134 #define HWMONITOR_SET_CONFIG_INT_EN 0x01
135 #define HWMONITOR_SET_CONFIG_INT_OPEN_DRAIN 0x00
136 #define HWMONITOR_SET_CONFIG_INT_ACT_LOW 0x01
137 #define HWMONITOR_SET_CONFIG_INT_CLR_DIS 0x00
138 #define HWMONITOR_SET_CONFIG_INT_CLR_EN 0x01
139 #define HWMONITOR_SET_CONFIG_CHA_NCLR_GPI 0x00
140 #define HWMONITOR_SET_CONFIG_CHA_GPI 0x01
141 #define HWMONITOR_SET_CONFIG_GPO_LOW 0x00
142 #define HWMONITOR_SET_CONFIG_GPO_HIGH 0x01
143 #define HWMONITOR_SET_CONFIG_PWR_ON 0x00
144 #define HWMONITOR_SET_CONFIG_PWR_DIS 0x01
150 #define HWMONITOR_SET_FAN1_MODE_COUNT 0x00
151 #define HWMONITOR_SET_FAN1_MODE_SENS_INPUT 0x01
152 #define HWMONITOR_SET_FAN2_MODE_COUNT 0x00
153 #define HWMONITOR_SET_FAN2_MODE_SENS_INPUT 0x02
154 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV1 0x00
155 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV2 0x04
156 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV4 0x08
157 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV8 0x0C
158 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV1 0x00
159 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV2 0x10
160 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV4 0x20
161 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV8 0x30
162 #define HWMONITOR_SET_MODE_OS_DISABLE 0x00
163 #define HWMONITOR_SET_MODE_OS_ENABLE 0x01
164 #define HWMONITOR_SET_MODE_RST_DISABLE 0x00
165 #define HWMONITOR_SET_MODE_RST_ENABLE 0x01
171 #define HWMONITOR_SET_TEMP_RES_8_bit 0x00
172 #define HWMONITOR_SET_TEMP_RES_11_bit 0x01
173 #define HWMONITOR_TEMP_RES_11_bit_BIT_MASK 0x08
179 #define HWMONITOR_SET_ALL_CH_ENABLE 0x00
180 #define HWMONITOR_SET_ALL_CH_DISABLE 0xFF
186 #define HWMONITOR_MANUFACTURERS_ID 0x01
187 #define HWMONITOR_STEPPING_DIE_REVISION_ID 0x08
193 #define HWMONITOR_IN_0 0
194 #define HWMONITOR_IN_1 1
195 #define HWMONITOR_IN_2 2
196 #define HWMONITOR_IN_3 3
197 #define HWMONITOR_IN_4 4
198 #define HWMONITOR_IN_5 5
199 #define HWMONITOR_IN_6 6
200 #define HWMONITOR_FAN_1 0
201 #define HWMONITOR_FAN_2 1
208 #define HWMONITOR_DEVICE_ADDRESS_0 0x28
209 #define HWMONITOR_DEVICE_ADDRESS_1 0x29
210 #define HWMONITOR_DEVICE_ADDRESS_2 0x2A
211 #define HWMONITOR_DEVICE_ADDRESS_3 0x2B
212 #define HWMONITOR_DEVICE_ADDRESS_4 0x2C
213 #define HWMONITOR_DEVICE_ADDRESS_5 0x2D
214 #define HWMONITOR_DEVICE_ADDRESS_6 0x2E
215 #define HWMONITOR_DEVICE_ADDRESS_7 0x2F
233 #define HWMONITOR_MAP_MIKROBUS( cfg, mikrobus ) \
234 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
235 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
236 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
237 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
556 #endif // HWMONITOR_H
err_t hwmonitor_generic_write(hwmonitor_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
HW Monitor I2C writing function.
err_t hwmonitor_set_config(hwmonitor_t *ctx, hwmonitor_config_t config)
HW Monitor set the configuration function.
err_t hwmonitor_init(hwmonitor_t *ctx, hwmonitor_cfg_t *cfg)
HW Monitor initialization function.
uint8_t hwmonitor_get_int_pin(hwmonitor_t *ctx)
HW Monitor gets interrupt function.
pin_name_t int_pin
Definition: hwmonitor.h:272
uint8_t init
Definition: hwmonitor.h:291
uint8_t slave_address
Definition: hwmonitor.h:258
uint8_t chas_clear
Definition: hwmonitor.h:289
err_t hwmonitor_set_analog_in_limit(hwmonitor_t *ctx, uint8_t in_pos, uint16_t upper_limit, uint16_t lower_limit)
HW Monitor set analog inputs voltage limits function.
err_t hwmonitor_set_ch_out(hwmonitor_t *ctx, uint8_t ch_out)
HW Monitor set voltage/temperature channel function.
uint8_t gpo
Definition: hwmonitor.h:290
err_t hwmonitor_get_temperature(hwmonitor_t *ctx, float *temperature)
HW Monitor gets temperature function.
err_t hwmonitor_generic_read(hwmonitor_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
HW Monitor I2C reading function.
err_t hwmonitor_default_cfg(hwmonitor_t *ctx)
HW Monitor default configuration function.
uint8_t int_enable
Definition: hwmonitor.h:286
hwmonitor_return_value_t
HW Monitor Click return value data.
Definition: hwmonitor.h:300
uint8_t int_pol_sel
Definition: hwmonitor.h:287
pin_name_t scl
Definition: hwmonitor.h:268
@ HWMONITOR_OK
Definition: hwmonitor.h:301
uint8_t start
Definition: hwmonitor.h:285
i2c_master_t i2c
Definition: hwmonitor.h:255
pin_name_t sda
Definition: hwmonitor.h:269
pin_name_t rst
Definition: hwmonitor.h:271
@ HWMONITOR_ERROR
Definition: hwmonitor.h:302
err_t hwmonitor_get_analog_inputs(hwmonitor_t *ctx, uint8_t in_pos, float *voltage)
HW Monitor gets analog inputs voltage function.
HW Monitor Click configuration object.
Definition: hwmonitor.h:284
uint32_t i2c_speed
Definition: hwmonitor.h:274
digital_in_t int_pin
Definition: hwmonitor.h:252
HW Monitor Click context object.
Definition: hwmonitor.h:247
uint8_t int_clear
Definition: hwmonitor.h:288
digital_out_t rst
Definition: hwmonitor.h:249
err_t hwmonitor_set_temp_res(hwmonitor_t *ctx, uint8_t temp_res)
HW Monitor set temperature resolution function.
err_t hwmonitor_get_device_id(hwmonitor_t *ctx, uint8_t *manufacture_id, uint8_t *revision_id)
HW Monitor gets device ID function.
uint8_t i2c_address
Definition: hwmonitor.h:275
err_t hwmonitor_get_fan_output(hwmonitor_t *ctx, uint8_t fan_pos, uint8_t *fan_output)
HW Monitor gets FAN output function.
HW Monitor Click configuration object.
Definition: hwmonitor.h:267
void hwmonitor_cfg_setup(hwmonitor_cfg_t *cfg)
HW Monitor configuration object setup function.
void hwmonitor_reset(hwmonitor_t *ctx)
HW Monitor reset function.
err_t hwmonitor_get_config(hwmonitor_t *ctx, hwmonitor_config_t *config)
HW Monitor gets configuration function.