Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define HWMONITOR_REG_CONFIGURATION 0x00
60 #define HWMONITOR_REG_INT_STATUS_1 0x01
61 #define HWMONITOR_REG_INT_STATUS_2 0x02
62 #define HWMONITOR_REG_INT_MASK_1 0x03
63 #define HWMONITOR_REG_INT_MASK_2 0x04
64 #define HWMONITOR_REG_FAN_DIVISOR 0x05
65 #define HWMONITOR_REG_OS_T_RES_CONFIG 0x06
66 #define HWMONITOR_REG_CONVERSION_RATE 0x07
67 #define HWMONITOR_REG_CHANNEL_DISABLE 0x08
68 #define HWMONITOR_REG_RAM_IN_0 0x20
69 #define HWMONITOR_REG_RAM_IN_1 0x21
70 #define HWMONITOR_REG_RAM_IN_2 0x22
71 #define HWMONITOR_REG_RAM_IN_3 0x23
72 #define HWMONITOR_REG_RAM_IN_4 0x24
73 #define HWMONITOR_REG_RAM_IN_5 0x25
74 #define HWMONITOR_REG_RAM_IN_6 0x26
75 #define HWMONITOR_REG_RAM_TEMPERATURE 0x27
76 #define HWMONITOR_REG_RAM_FAN_1 0x28
77 #define HWMONITOR_REG_RAM_FAN_2 0x29
78 #define HWMONITOR_REG_RAM_LIM_IN_0_H 0x2A
79 #define HWMONITOR_REG_RAM_LIM_IN_0_L 0x2B
80 #define HWMONITOR_REG_RAM_LIM_IN_1_H 0x2C
81 #define HWMONITOR_REG_RAM_LIM_IN_1_L 0x2D
82 #define HWMONITOR_REG_RAM_LIM_IN_2_H 0x2E
83 #define HWMONITOR_REG_RAM_LIM_IN_2_L 0x2F
84 #define HWMONITOR_REG_RAM_LIM_IN_3_H 0x30
85 #define HWMONITOR_REG_RAM_LIM_IN_3_L 0x31
86 #define HWMONITOR_REG_RAM_LIM_IN_4_H 0x32
87 #define HWMONITOR_REG_RAM_LIM_IN_4_L 0x33
88 #define HWMONITOR_REG_RAM_LIM_IN_5_H 0x34
89 #define HWMONITOR_REG_RAM_LIM_IN_5_L 0x35
90 #define HWMONITOR_REG_RAM_LIM_IN_6_H 0x36
91 #define HWMONITOR_REG_RAM_LIM_IN_6_L 0x37
92 #define HWMONITOR_REG_RAM_LIM_HOT_H 0x38
93 #define HWMONITOR_REG_RAM_LIM_HOT_L 0x39
94 #define HWMONITOR_REG_RAM_LIM_TEMP_H 0x3A
95 #define HWMONITOR_REG_RAM_LIM_TEMP_L 0x3B
96 #define HWMONITOR_REG_RAM_CURRENT_LIM_FUN_1 0x3C
97 #define HWMONITOR_REG_RAM_CURRENT_LIM_FUN_2 0x3D
98 #define HWMONITOR_REG_RAM_MANUFACTURE_ID 0x3E
99 #define HWMONITOR_REG_RAM_REVISION_ID 0x3F
117 #define HWMONITOR_SET_CONFIG_START_DIS 0x00
118 #define HWMONITOR_SET_CONFIG_START_EN 0x01
119 #define HWMONITOR_SET_CONFIG_INT_DIS 0x00
120 #define HWMONITOR_SET_CONFIG_INT_EN 0x01
121 #define HWMONITOR_SET_CONFIG_INT_OPEN_DRAIN 0x00
122 #define HWMONITOR_SET_CONFIG_INT_ACT_LOW 0x01
123 #define HWMONITOR_SET_CONFIG_INT_CLR_DIS 0x00
124 #define HWMONITOR_SET_CONFIG_INT_CLR_EN 0x01
125 #define HWMONITOR_SET_CONFIG_CHA_NCLR_GPI 0x00
126 #define HWMONITOR_SET_CONFIG_CHA_GPI 0x01
127 #define HWMONITOR_SET_CONFIG_GPO_LOW 0x00
128 #define HWMONITOR_SET_CONFIG_GPO_HIGH 0x01
129 #define HWMONITOR_SET_CONFIG_PWR_ON 0x00
130 #define HWMONITOR_SET_CONFIG_PWR_DIS 0x01
136 #define HWMONITOR_SET_FAN1_MODE_COUNT 0x00
137 #define HWMONITOR_SET_FAN1_MODE_SENS_INPUT 0x01
138 #define HWMONITOR_SET_FAN2_MODE_COUNT 0x00
139 #define HWMONITOR_SET_FAN2_MODE_SENS_INPUT 0x02
140 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV1 0x00
141 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV2 0x04
142 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV4 0x08
143 #define HWMONITOR_SET_FAN1_CTRL_SPEED_DIV8 0x0C
144 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV1 0x00
145 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV2 0x10
146 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV4 0x20
147 #define HWMONITOR_SET_FAN2_CTRL_SPEED_DIV8 0x30
148 #define HWMONITOR_SET_MODE_OS_DISABLE 0x00
149 #define HWMONITOR_SET_MODE_OS_ENABLE 0x01
150 #define HWMONITOR_SET_MODE_RST_DISABLE 0x00
151 #define HWMONITOR_SET_MODE_RST_ENABLE 0x01
157 #define HWMONITOR_SET_TEMP_RES_8_bit 0x00
158 #define HWMONITOR_SET_TEMP_RES_11_bit 0x01
159 #define HWMONITOR_TEMP_RES_11_bit_BIT_MASK 0x08
165 #define HWMONITOR_SET_ALL_CH_ENABLE 0x00
166 #define HWMONITOR_SET_ALL_CH_DISABLE 0xFF
172 #define HWMONITOR_MANUFACTURERS_ID 0x01
173 #define HWMONITOR_STEPPING_DIE_REVISION_ID 0x08
179 #define HWMONITOR_IN_0 0
180 #define HWMONITOR_IN_1 1
181 #define HWMONITOR_IN_2 2
182 #define HWMONITOR_IN_3 3
183 #define HWMONITOR_IN_4 4
184 #define HWMONITOR_IN_5 5
185 #define HWMONITOR_IN_6 6
186 #define HWMONITOR_FAN_1 0
187 #define HWMONITOR_FAN_2 1
194 #define HWMONITOR_DEVICE_ADDRESS_0 0x28
195 #define HWMONITOR_DEVICE_ADDRESS_1 0x29
196 #define HWMONITOR_DEVICE_ADDRESS_2 0x2A
197 #define HWMONITOR_DEVICE_ADDRESS_3 0x2B
198 #define HWMONITOR_DEVICE_ADDRESS_4 0x2C
199 #define HWMONITOR_DEVICE_ADDRESS_5 0x2D
200 #define HWMONITOR_DEVICE_ADDRESS_6 0x2E
201 #define HWMONITOR_DEVICE_ADDRESS_7 0x2F
219 #define HWMONITOR_MAP_MIKROBUS( cfg, mikrobus ) \
220 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
221 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
222 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
223 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
542 #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:258
uint8_t init
Definition: hwmonitor.h:277
uint8_t slave_address
Definition: hwmonitor.h:244
uint8_t chas_clear
Definition: hwmonitor.h:275
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:276
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:272
hwmonitor_return_value_t
HW Monitor Click return value data.
Definition: hwmonitor.h:286
uint8_t int_pol_sel
Definition: hwmonitor.h:273
pin_name_t scl
Definition: hwmonitor.h:254
@ HWMONITOR_OK
Definition: hwmonitor.h:287
uint8_t start
Definition: hwmonitor.h:271
i2c_master_t i2c
Definition: hwmonitor.h:241
pin_name_t sda
Definition: hwmonitor.h:255
pin_name_t rst
Definition: hwmonitor.h:257
@ HWMONITOR_ERROR
Definition: hwmonitor.h:288
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:270
uint32_t i2c_speed
Definition: hwmonitor.h:260
digital_in_t int_pin
Definition: hwmonitor.h:238
HW Monitor Click context object.
Definition: hwmonitor.h:233
uint8_t int_clear
Definition: hwmonitor.h:274
digital_out_t rst
Definition: hwmonitor.h:235
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:261
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:253
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.