Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
53 #define FAN6_MAP_MIKROBUS( cfg, mikrobus ) \
54 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
56 cfg.io1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
57 cfg.sdn = MIKROBUS( mikrobus, MIKROBUS_RST ); \
58 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
59 cfg.io2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
60 cfg.alr = MIKROBUS( mikrobus, MIKROBUS_INT );
67 #define FAN6_RETVAL uint8_t
70 #define FAN6_INIT_ERROR 0xFF
77 #define FAN6_INTERNAL_TEMP_READ_REG 0x00
78 #define FAN6_EXTDIODE1_TEMP_READ_REG 0x02
79 #define FAN6_EXTDIODE2_TEMP_READ_REG 0x04
80 #define FAN6_EXTDIODE3_TEMP_READ_REG 0x06
81 #define FAN6_CRITICAL_TEMP_REG 0x0A
82 #define FAN6_PUSHED_TEMP1_REG 0x0C
83 #define FAN6_PUSHED_TEMP2_REG 0x0D
84 #define FAN6_TRIP_SET_VOLTAGE_REG 0x10
85 #define FAN6_EXTDIODE1_IDEALITY_REG 0x11
86 #define FAN6_EXTDIODE2_IDEALITY_REG 0x12
87 #define FAN6_EXTDIODE1_BETA_CONFIG_REG 0x14
88 #define FAN6_EXTDIODE2_BETA_CONFIG_REG 0x15
89 #define FAN6_EXTDIODE_REC_CONFIG_REG 0x17
90 #define FAN6_EXTDIODE1_TCRIT_LIMIT_REG 0x19
91 #define FAN6_EXTDIODE2_TCRIT_LIMIT_REG 0x1A
92 #define FAN6_EXTDIODE3_TCRIT_LIMIT_REG 0x1B
93 #define FAN6_INTDIODE_TCRIT_LIMIT_REG 0x1D
94 #define FAN6_TCRIT_STATUS_REG 0x1F
95 #define FAN6_CONFIGURATION_REG 0x20
96 #define FAN6_CONFIGURATION2_REG 0x21
97 #define FAN6_INTERRUPT_STATUS_REG 0x23
98 #define FAN6_HIGH_LIMIT_STATUS_REG 0x24
99 #define FAN6_LOW_LIMIT_STATUS_REG 0x25
100 #define FAN6_DIODE_FAULT_REG 0x26
101 #define FAN6_FAN_STATUS_REG 0x27
102 #define FAN6_INTERRUPT_EN_REG 0x28
103 #define FAN6_FAN_INTERRUPT_EN_REG 0x29
104 #define FAN6_PWM_CONFIG_REG 0x2A
105 #define FAN6_PWM_BASE_FREQ_REG 0x2B
106 #define FAN6_EXTDIODE1_HIGHTEMP_LIMIT_REG 0x30
107 #define FAN6_EXTDIODE2_HIGHTEMP_LIMIT_REG 0x31
108 #define FAN6_EXTDIODE3_HIGHTEMP_LIMIT_REG 0x32
109 #define FAN6_INTDIODE_HIGHTEMP_LIMIT_REG 0x34
110 #define FAN6_EXTDIODE1_LOWTEMP_LIMIT_REG 0x38
111 #define FAN6_EXTDIODE2_LOWTEMP_LIMIT_REG 0x39
112 #define FAN6_EXTDIODE3_LOWTEMP_LIMIT_REG 0x3A
113 #define FAN6_INTDIODE_LOWTEMP_LIMIT_REG 0x3C
114 #define FAN6_FAN_SETTING_REG 0x40
115 #define FAN6_PWM_DIVIDE_REG 0x41
116 #define FAN6_FAN_CONFIG1_REG 0x42
117 #define FAN6_FAN_CONFIG2_REG 0x43
118 #define FAN6_GAIN_REG 0x45
119 #define FAN6_FAN_SPINUP_CONFIG_REG 0x46
120 #define FAN6_FAN_STEP_REG 0x47
121 #define FAN6_FAN_MIN_DRIVE_REG 0x48
122 #define FAN6_FAN_VALID_TACH_COUNT_REG 0x49
123 #define FAN6_FAN_DRIVE_FAIL_BAND_REG 0x4A
124 #define FAN6_TACH_TARGET_REG 0x4C
125 #define FAN6_TACH_READING_REG 0x4E
126 #define FAN6_LUT_CONFIG_REG 0x50
127 #define FAN6_LUT_DRIVE1_REG 0x51
128 #define FAN6_LUT_TEMP1_SETTING1_REG 0x52
129 #define FAN6_LUT_TEMP2_SETTING1_REG 0x53
130 #define FAN6_LUT_TEMP3_SETTING1_REG 0x54
131 #define FAN6_LUT_INTTEMP_SETTING1_REG 0x55
132 #define FAN6_LUT_DRIVE2_REG 0x56
133 #define FAN6_LUT_TEMP1_SETTING2_REG 0x57
134 #define FAN6_LUT_TEMP2_SETTING2_REG 0x58
135 #define FAN6_LUT_TEMP3_SETTING2_REG 0x59
136 #define FAN6_LUT_INTTEMP_SETTING2_REG 0x5A
137 #define FAN6_LUT_DRIVE3_REG 0x5B
138 #define FAN6_LUT_TEMP1_SETTING3_REG 0x5C
139 #define FAN6_LUT_TEMP2_SETTING3_REG 0x5D
140 #define FAN6_LUT_TEMP3_SETTING3_REG 0x5E
141 #define FAN6_LUT_INTTEMP_SETTING3_REG 0x5F
142 #define FAN6_LUT_DRIVE4_REG 0x60
143 #define FAN6_LUT_TEMP1_SETTING4_REG 0x61
144 #define FAN6_LUT_TEMP2_SETTING4_REG 0x62
145 #define FAN6_LUT_TEMP3_SETTING4_REG 0x63
146 #define FAN6_LUT_INTTEMP_SETTING4_REG 0x64
147 #define FAN6_LUT_DRIVE5_REG 0x65
148 #define FAN6_LUT_TEMP1_SETTING5_REG 0x66
149 #define FAN6_LUT_TEMP2_SETTING5_REG 0x67
150 #define FAN6_LUT_TEMP3_SETTING5_REG 0x68
151 #define FAN6_LUT_INTTEMP_SETTING5_REG 0x69
152 #define FAN6_LUT_DRIVE6_REG 0x6A
153 #define FAN6_LUT_TEMP1_SETTING6_REG 0x6B
154 #define FAN6_LUT_TEMP2_SETTING6_REG 0x6C
155 #define FAN6_LUT_TEMP3_SETTING6_REG 0x6D
156 #define FAN6_LUT_INTTEMP_SETTING6_REG 0x6E
157 #define FAN6_LUT_DRIVE7_REG 0x6F
158 #define FAN6_LUT_TEMP1_SETTING7_REG 0x70
159 #define FAN6_LUT_TEMP2_SETTING7_REG 0x71
160 #define FAN6_LUT_TEMP3_SETTING7_REG 0x72
161 #define FAN6_LUT_INTTEMP_SETTING7_REG 0x73
162 #define FAN6_LUT_DRIVE8_REG 0x74
163 #define FAN6_LUT_TEMP1_SETTING8_REG 0x75
164 #define FAN6_LUT_TEMP2_SETTING8_REG 0x76
165 #define FAN6_LUT_TEMP3_SETTING8_REG 0x77
166 #define FAN6_LUT_INTTEMP_SETTING8_REG 0x78
167 #define FAN6_GPIO_DIR_REG 0xE1
168 #define FAN6_GPIO_OUTPUT_CONFIG_REG 0xE2
169 #define FAN6_GPIO_INPUT_REG 0xE3
170 #define FAN6_GPIO_OUTPUT_REG 0xE4
171 #define FAN6_GPIO_INTERR_EN_REG 0xE5
172 #define FAN6_GPIO_STATUS_REG 0xE6
173 #define FAN6_SW_LOCK_REG 0xEF
174 #define FAN6_PRODUCT_FEATURES_REG 0xFC
175 #define FAN6_PRODUCT_ID_REG 0xFD
176 #define FAN6_MANUFACTURER_ID_REG 0xFE
177 #define FAN6_REVISION_REG 0xFF
184 #define FAN6_AUTOBETA_DETECTION_DISABLED 0x00
185 #define FAN6_AUTOBETA_DETECTION_ENABLED 0x10
186 #define FAN6_MIN_BETA_80MILI 0x00
187 #define FAN6_MIN_BETA_111MILI 0x01
188 #define FAN6_MIN_BETA_176MILI 0x02
189 #define FAN6_MIN_BETA_290MILI 0x03
190 #define FAN6_MIN_BETA_480MILI 0x04
191 #define FAN6_MIN_BETA_900MILI 0x05
192 #define FAN6_MIN_BETA_2330MILI 0x06
193 #define FAN6_MIN_BETA_DISABLED 0x07
200 #define FAN6_EXTDIODE_REC_DISABLED 0x00
201 #define FAN6_EXTDIODE3_REC_ENABLED 0x04
202 #define FAN6_EXTDIODE2_REC_ENABLED 0x02
203 #define FAN6_EXTDIODE1_REC_ENABLED 0x01
210 #define FAN6_ALERT_PIN_UNMASKED 0x00
211 #define FAN6_ALERT_PIN_MASKED 0x80
212 #define FAN6_EXTDIODE_SYS_SHDN_PIN_NOT_LINKED 0x00
213 #define FAN6_EXTDIODE3_SYS_SHDN_PIN_LINKED 0x08
214 #define FAN6_EXTDIODE2_SYS_SHDN_PIN_LINKED 0x04
215 #define FAN6_EXTDIODE1_SYS_SHDN_PIN_LINKED 0x02
216 #define FAN6_ANTIPARALLEL_DIODE_FUNCT_DISABLED 0x00
217 #define FAN6_ANTIPARALLEL_DIODE_FUNCT_ENABLED 0x01
224 #define FAN6_DYNAMIC_AVERAGING_ENABLED 0x00
225 #define FAN6_DYNAMIC_AVERAGING_DISABLED 0x40
226 #define FAN6_SMBUS_ENABLED 0x00
227 #define FAN6_SMBUS_DISABLED 0x20
228 #define FAN6_DIGITAL_AVERAGING_ENABLED 0x00
229 #define FAN6_DIGITAL_AVERAGING_DISABLED 0x10
230 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_1 0x00
231 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_2 0x04
232 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_3 0x08
233 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_4 0x0C
234 #define FAN6_CONVERSION_RATE_1_PERSEC 0x00
235 #define FAN6_CONVERSION_RATE_2_PERSEC 0x01
236 #define FAN6_CONVERSION_RATE_4_PERSEC 0x02
237 #define FAN6_CONVERSION_RATE_CONTINUOUS 0x03
244 #define FAN6_ALL_INTERRUPTS_DISABLED 0x00
245 #define FAN6_EXTDIODE3_INTERRUPT_ENABLED 0x08
246 #define FAN6_EXTDIODE2_INTERRUPT_ENABLED 0x04
247 #define FAN6_EXTDIODE1_INTERRUPT_ENABLED 0x02
248 #define FAN6_INTDIODE_INTERRUPT_ENABLED 0x01
255 #define FAN6_ALL_FAN_INTERRUPTS_DISABLED 0x00
256 #define FAN6_FAN_SPIN_BIT_ENABLED 0x02
257 #define FAN6_FAN_STALL_BIT_ENABLED 0x01
264 #define FAN6_PWM_PIN_OPEN_DRAIN 0x00
265 #define FAN6_PWM_PIN_PUSH_PULL 0x10
266 #define FAN6_NORMAL_POLARITY 0x00
267 #define FAN6_INVERTED_POLARITY 0x01
274 #define FAN6_PWM_BASE_FREQ_26000HZ 0x00
275 #define FAN6_PWM_BASE_FREQ_19531HZ 0x01
276 #define FAN6_PWM_BASE_FREQ_4882HZ 0x02
277 #define FAN6_PWM_BASE_FREQ_2441HZ 0x03
284 #define FAN6_0_PERCENT_SPEED 0x00
285 #define FAN6_25_PERCENTS_SPEED 0x40
286 #define FAN6_50_PERCENTS_SPEED 0x80
287 #define FAN6_75_PERCENTS_SPEED 0xC0
288 #define FAN6_100_PERCENTS_SPEED 0xFF
295 #define FAN6_CONTROL_CIRCUITRY_DISABLED 0x00
296 #define FAN6_CONTROL_CIRCUITRY_ENABLED 0x80
297 #define FAN6_RANGE_MIN_500RPM 0x00
298 #define FAN6_RANGE_MIN_1000RPM 0x20
299 #define FAN6_RANGE_MIN_2000RPM 0x40
300 #define FAN6_RANGE_MIN_4000RPM 0x60
301 #define FAN6_MIN_3_EDGES 0x00
302 #define FAN6_MIN_5_EDGES 0x08
303 #define FAN6_MIN_7_EDGES 0x10
304 #define FAN6_MIN_9_EDGES 0x18
305 #define FAN6_UPDATE_TIME_100_MILISEC 0x00
306 #define FAN6_UPDATE_TIME_200_MILISEC 0x01
307 #define FAN6_UPDATE_TIME_300_MILISEC 0x02
308 #define FAN6_UPDATE_TIME_400_MILISEC 0x03
309 #define FAN6_UPDATE_TIME_500_MILISEC 0x04
310 #define FAN6_UPDATE_TIME_800_MILISEC 0x05
311 #define FAN6_UPDATE_TIME_1200_MILISEC 0x06
312 #define FAN6_UPDATE_TIME_1600_MILISEC 0x07
319 #define FAN6_RAMP_RATE_CONT_DISABLED 0x00
320 #define FAN6_RAMP_RATE_CONT_ENABLED 0x40
321 #define FAN6_GLITCH_FILTER_DISABLED 0x00
322 #define FAN6_GLITCH_FILTER_ENABLED 0x20
323 #define FAN6_NO_DERIVATIVE 0x00
324 #define FAN6_BASIC_DERIVATIVE 0x08
325 #define FAN6_STEP_DERIVATIVE 0x10
326 #define FAN6_BOTH_DERIVATIVE 0x18
327 #define FAN6_ERROR_RANGE_0RPM 0x00
328 #define FAN6_ERROR_RANGE_50RPM 0x02
329 #define FAN6_ERROR_RANGE_100RPM 0x04
330 #define FAN6_ERROR_RANGE_200RPM 0x06
337 #define FAN6_GAIN_1X 0x00
338 #define FAN6_GAIN_2X 0x15
339 #define FAN6_GAIN_4X 0x2A
340 #define FAN6_GAIN_8X 0x3F
347 #define FAN6_UPDATE_PERIODS_DISABLED 0x00
348 #define FAN6_16_UPDATE_PERIODS 0x40
349 #define FAN6_32_UPDATE_PERIODS 0x80
350 #define FAN6_64_UPDATE_PERIODS 0xC0
351 #define FAN6_100_PERCENTS_PWM_DRIVE_ENABLED 0x00
352 #define FAN6_100_PERCENTS_PWM_DRIVE_DISABLED 0x20
353 #define FAN6_SPINUP_DRIVELEVEL_30_PERCENTS 0x00
354 #define FAN6_SPINUP_DRIVELEVEL_35_PERCENTS 0x04
355 #define FAN6_SPINUP_DRIVELEVEL_40_PERCENTS 0x08
356 #define FAN6_SPINUP_DRIVELEVEL_45_PERCENTS 0x0C
357 #define FAN6_SPINUP_DRIVELEVEL_50_PERCENTS 0x10
358 #define FAN6_SPINUP_DRIVELEVEL_55_PERCENTS 0x14
359 #define FAN6_SPINUP_DRIVELEVEL_60_PERCENTS 0x18
360 #define FAN6_SPINUP_DRIVELEVEL_65_PERCENTS 0x1C
361 #define FAN6_SPINUP_TIME_250_MILISEC 0x00
362 #define FAN6_SPINUP_TIME_500_MILISEC 0x01
363 #define FAN6_SPINUP_TIME_1_SEC 0x02
364 #define FAN6_SPINUP_TIME_2_SEC 0x03
371 #define FAN6_PUSH_TEMP_NOT_LOADED 0x00
372 #define FAN6_PUSH_TEMP1_LOADED 0x80
373 #define FAN6_PUSH_TEMP2_LOADED 0x40
374 #define FAN6_LUT_ENABLED 0x00
375 #define FAN6_LUT_LOCKED 0x20
376 #define FAN6_RPM_TACH_ENABLED 0x00
377 #define FAN6_PWM_DUTY_ENABLED 0x10
384 #define FAN6_GPIO_DIR_INPUT 0x00
385 #define FAN6_GPIO2_DIR_OUTPUT 0x02
386 #define FAN6_GPIO1_DIR_OUTPUT 0x01
393 #define FAN6_GPIO_AS_OPEN_DRAIN 0x00
394 #define FAN6_GPIO2_AS_PUSH_PULL 0x02
395 #define FAN6_GPIO1_AS_PUSH_PULL 0x01
402 #define FAN6_GPIO_INTERR_DISABLED 0x00
403 #define FAN6_GPIO2_INTERR_ENABLED 0x02
404 #define FAN6_GPIO1_INTERR_ENABLED 0x01
411 #define FAN6_SW_NOT_LOCKED 0x00
412 #define FAN6_SW_LOCKED 0x01
void fan6_read_eeprom(fan6_t *ctx, uint8_t *data_out)
EEPROM read function.
pin_name_t io1
Definition: fan6.h:465
void fan6_set_gpio_1(fan6_t *ctx, const uint8_t state)
GPIO 1 Set function.
uint8_t adc_mode
Definition: fan6.h:447
void fan6_set_pwm_lut_mode(fan6_t *ctx, const uint8_t tach_count)
Set PWM With LUT Mode function.
digital_out_t en
Definition: fan6.h:430
float fan6_get_temperature(fan6_t *ctx, const uint8_t temp_address)
Temperature Get function.
uint32_t fan6_read_tachometer(fan6_t *ctx)
Tachometer Read function.
uint32_t i2c_speed
Definition: fan6.h:473
void fan6_generic_read(fan6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
pin_name_t scl
Definition: fan6.h:460
void fan6_cfg_setup(fan6_cfg_t *cfg)
Config Object Initialization function.
Click ctx object definition.
Definition: fan6.h:426
uint8_t config_byte2
Definition: fan6.h:449
uint16_t fan6_read_reg(fan6_t *ctx, const uint8_t register_address)
Generic read function.
i2c_master_t i2c
Definition: fan6.h:440
digital_in_t alr
Definition: fan6.h:436
digital_out_t io1
Definition: fan6.h:429
uint8_t slave_address
Definition: fan6.h:444
digital_in_t sdn
Definition: fan6.h:434
void fan6_set_pwm_mode(fan6_t *ctx, const uint8_t pwm_duty)
PWM mode set function.
void fan6_generic_write(fan6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
pin_name_t sda
Definition: fan6.h:461
pin_name_t sdn
Definition: fan6.h:466
uint8_t config_byte1
Definition: fan6.h:448
Click configuration structure definition.
Definition: fan6.h:457
pin_name_t en
Definition: fan6.h:467
void fan6_push_temperature(fan6_t *ctx, const uint8_t temp_address, const uint8_t temp_selection)
Temperature Push function.
uint8_t fan6_receive_byte(fan6_t *ctx, const uint8_t register_address)
Byte receive function.
FAN6_RETVAL fan6_init(fan6_t *ctx, fan6_cfg_t *cfg)
Initialization function.
#define FAN6_RETVAL
Definition: fan6.h:67
void fan6_set_fan_speed_con_mode(fan6_t *ctx, const uint8_t minimum_drive, const uint8_t tach_count, const uint16_t tach_target)
Fan Speed Control Mode Set function.
void fan6_enable_device(fan6_t *ctx, const uint8_t state)
Device Enable function.
pin_name_t alr
Definition: fan6.h:469
uint8_t i2c_address
Definition: fan6.h:474
digital_in_t io2
Definition: fan6.h:435
uint8_t check_ptr
Definition: fan6.h:446
void fan6_default_cfg(fan6_t *ctx)
Click Default Configuration function.
pin_name_t io2
Definition: fan6.h:468
void fan6_set_fsc_lut_mode(fan6_t *ctx, const uint8_t minimum_drive, const uint8_t tach_count)
Set FSC With LUT Mode function.
uint8_t fan6_indicate_critical_thermal_shutdown(fan6_t *ctx)
Interrupt Pin Get function.
void fan6_write_reg(fan6_t *ctx, const uint8_t register_address, const uint16_t transfer_data)
Generic write function.
uint8_t fan6_get_gpio_2(fan6_t *ctx)
GPIO 2 Get function.