Go to the documentation of this file.
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"
67 #define FAN6_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.io1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
71 cfg.sdn = MIKROBUS( mikrobus, MIKROBUS_RST ); \
72 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.io2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
74 cfg.alr = MIKROBUS( mikrobus, MIKROBUS_INT );
81 #define FAN6_RETVAL uint8_t
84 #define FAN6_INIT_ERROR 0xFF
91 #define FAN6_INTERNAL_TEMP_READ_REG 0x00
92 #define FAN6_EXTDIODE1_TEMP_READ_REG 0x02
93 #define FAN6_EXTDIODE2_TEMP_READ_REG 0x04
94 #define FAN6_EXTDIODE3_TEMP_READ_REG 0x06
95 #define FAN6_CRITICAL_TEMP_REG 0x0A
96 #define FAN6_PUSHED_TEMP1_REG 0x0C
97 #define FAN6_PUSHED_TEMP2_REG 0x0D
98 #define FAN6_TRIP_SET_VOLTAGE_REG 0x10
99 #define FAN6_EXTDIODE1_IDEALITY_REG 0x11
100 #define FAN6_EXTDIODE2_IDEALITY_REG 0x12
101 #define FAN6_EXTDIODE1_BETA_CONFIG_REG 0x14
102 #define FAN6_EXTDIODE2_BETA_CONFIG_REG 0x15
103 #define FAN6_EXTDIODE_REC_CONFIG_REG 0x17
104 #define FAN6_EXTDIODE1_TCRIT_LIMIT_REG 0x19
105 #define FAN6_EXTDIODE2_TCRIT_LIMIT_REG 0x1A
106 #define FAN6_EXTDIODE3_TCRIT_LIMIT_REG 0x1B
107 #define FAN6_INTDIODE_TCRIT_LIMIT_REG 0x1D
108 #define FAN6_TCRIT_STATUS_REG 0x1F
109 #define FAN6_CONFIGURATION_REG 0x20
110 #define FAN6_CONFIGURATION2_REG 0x21
111 #define FAN6_INTERRUPT_STATUS_REG 0x23
112 #define FAN6_HIGH_LIMIT_STATUS_REG 0x24
113 #define FAN6_LOW_LIMIT_STATUS_REG 0x25
114 #define FAN6_DIODE_FAULT_REG 0x26
115 #define FAN6_FAN_STATUS_REG 0x27
116 #define FAN6_INTERRUPT_EN_REG 0x28
117 #define FAN6_FAN_INTERRUPT_EN_REG 0x29
118 #define FAN6_PWM_CONFIG_REG 0x2A
119 #define FAN6_PWM_BASE_FREQ_REG 0x2B
120 #define FAN6_EXTDIODE1_HIGHTEMP_LIMIT_REG 0x30
121 #define FAN6_EXTDIODE2_HIGHTEMP_LIMIT_REG 0x31
122 #define FAN6_EXTDIODE3_HIGHTEMP_LIMIT_REG 0x32
123 #define FAN6_INTDIODE_HIGHTEMP_LIMIT_REG 0x34
124 #define FAN6_EXTDIODE1_LOWTEMP_LIMIT_REG 0x38
125 #define FAN6_EXTDIODE2_LOWTEMP_LIMIT_REG 0x39
126 #define FAN6_EXTDIODE3_LOWTEMP_LIMIT_REG 0x3A
127 #define FAN6_INTDIODE_LOWTEMP_LIMIT_REG 0x3C
128 #define FAN6_FAN_SETTING_REG 0x40
129 #define FAN6_PWM_DIVIDE_REG 0x41
130 #define FAN6_FAN_CONFIG1_REG 0x42
131 #define FAN6_FAN_CONFIG2_REG 0x43
132 #define FAN6_GAIN_REG 0x45
133 #define FAN6_FAN_SPINUP_CONFIG_REG 0x46
134 #define FAN6_FAN_STEP_REG 0x47
135 #define FAN6_FAN_MIN_DRIVE_REG 0x48
136 #define FAN6_FAN_VALID_TACH_COUNT_REG 0x49
137 #define FAN6_FAN_DRIVE_FAIL_BAND_REG 0x4A
138 #define FAN6_TACH_TARGET_REG 0x4C
139 #define FAN6_TACH_READING_REG 0x4E
140 #define FAN6_LUT_CONFIG_REG 0x50
141 #define FAN6_LUT_DRIVE1_REG 0x51
142 #define FAN6_LUT_TEMP1_SETTING1_REG 0x52
143 #define FAN6_LUT_TEMP2_SETTING1_REG 0x53
144 #define FAN6_LUT_TEMP3_SETTING1_REG 0x54
145 #define FAN6_LUT_INTTEMP_SETTING1_REG 0x55
146 #define FAN6_LUT_DRIVE2_REG 0x56
147 #define FAN6_LUT_TEMP1_SETTING2_REG 0x57
148 #define FAN6_LUT_TEMP2_SETTING2_REG 0x58
149 #define FAN6_LUT_TEMP3_SETTING2_REG 0x59
150 #define FAN6_LUT_INTTEMP_SETTING2_REG 0x5A
151 #define FAN6_LUT_DRIVE3_REG 0x5B
152 #define FAN6_LUT_TEMP1_SETTING3_REG 0x5C
153 #define FAN6_LUT_TEMP2_SETTING3_REG 0x5D
154 #define FAN6_LUT_TEMP3_SETTING3_REG 0x5E
155 #define FAN6_LUT_INTTEMP_SETTING3_REG 0x5F
156 #define FAN6_LUT_DRIVE4_REG 0x60
157 #define FAN6_LUT_TEMP1_SETTING4_REG 0x61
158 #define FAN6_LUT_TEMP2_SETTING4_REG 0x62
159 #define FAN6_LUT_TEMP3_SETTING4_REG 0x63
160 #define FAN6_LUT_INTTEMP_SETTING4_REG 0x64
161 #define FAN6_LUT_DRIVE5_REG 0x65
162 #define FAN6_LUT_TEMP1_SETTING5_REG 0x66
163 #define FAN6_LUT_TEMP2_SETTING5_REG 0x67
164 #define FAN6_LUT_TEMP3_SETTING5_REG 0x68
165 #define FAN6_LUT_INTTEMP_SETTING5_REG 0x69
166 #define FAN6_LUT_DRIVE6_REG 0x6A
167 #define FAN6_LUT_TEMP1_SETTING6_REG 0x6B
168 #define FAN6_LUT_TEMP2_SETTING6_REG 0x6C
169 #define FAN6_LUT_TEMP3_SETTING6_REG 0x6D
170 #define FAN6_LUT_INTTEMP_SETTING6_REG 0x6E
171 #define FAN6_LUT_DRIVE7_REG 0x6F
172 #define FAN6_LUT_TEMP1_SETTING7_REG 0x70
173 #define FAN6_LUT_TEMP2_SETTING7_REG 0x71
174 #define FAN6_LUT_TEMP3_SETTING7_REG 0x72
175 #define FAN6_LUT_INTTEMP_SETTING7_REG 0x73
176 #define FAN6_LUT_DRIVE8_REG 0x74
177 #define FAN6_LUT_TEMP1_SETTING8_REG 0x75
178 #define FAN6_LUT_TEMP2_SETTING8_REG 0x76
179 #define FAN6_LUT_TEMP3_SETTING8_REG 0x77
180 #define FAN6_LUT_INTTEMP_SETTING8_REG 0x78
181 #define FAN6_GPIO_DIR_REG 0xE1
182 #define FAN6_GPIO_OUTPUT_CONFIG_REG 0xE2
183 #define FAN6_GPIO_INPUT_REG 0xE3
184 #define FAN6_GPIO_OUTPUT_REG 0xE4
185 #define FAN6_GPIO_INTERR_EN_REG 0xE5
186 #define FAN6_GPIO_STATUS_REG 0xE6
187 #define FAN6_SW_LOCK_REG 0xEF
188 #define FAN6_PRODUCT_FEATURES_REG 0xFC
189 #define FAN6_PRODUCT_ID_REG 0xFD
190 #define FAN6_MANUFACTURER_ID_REG 0xFE
191 #define FAN6_REVISION_REG 0xFF
198 #define FAN6_AUTOBETA_DETECTION_DISABLED 0x00
199 #define FAN6_AUTOBETA_DETECTION_ENABLED 0x10
200 #define FAN6_MIN_BETA_80MILI 0x00
201 #define FAN6_MIN_BETA_111MILI 0x01
202 #define FAN6_MIN_BETA_176MILI 0x02
203 #define FAN6_MIN_BETA_290MILI 0x03
204 #define FAN6_MIN_BETA_480MILI 0x04
205 #define FAN6_MIN_BETA_900MILI 0x05
206 #define FAN6_MIN_BETA_2330MILI 0x06
207 #define FAN6_MIN_BETA_DISABLED 0x07
214 #define FAN6_EXTDIODE_REC_DISABLED 0x00
215 #define FAN6_EXTDIODE3_REC_ENABLED 0x04
216 #define FAN6_EXTDIODE2_REC_ENABLED 0x02
217 #define FAN6_EXTDIODE1_REC_ENABLED 0x01
224 #define FAN6_ALERT_PIN_UNMASKED 0x00
225 #define FAN6_ALERT_PIN_MASKED 0x80
226 #define FAN6_EXTDIODE_SYS_SHDN_PIN_NOT_LINKED 0x00
227 #define FAN6_EXTDIODE3_SYS_SHDN_PIN_LINKED 0x08
228 #define FAN6_EXTDIODE2_SYS_SHDN_PIN_LINKED 0x04
229 #define FAN6_EXTDIODE1_SYS_SHDN_PIN_LINKED 0x02
230 #define FAN6_ANTIPARALLEL_DIODE_FUNCT_DISABLED 0x00
231 #define FAN6_ANTIPARALLEL_DIODE_FUNCT_ENABLED 0x01
238 #define FAN6_DYNAMIC_AVERAGING_ENABLED 0x00
239 #define FAN6_DYNAMIC_AVERAGING_DISABLED 0x40
240 #define FAN6_SMBUS_ENABLED 0x00
241 #define FAN6_SMBUS_DISABLED 0x20
242 #define FAN6_DIGITAL_AVERAGING_ENABLED 0x00
243 #define FAN6_DIGITAL_AVERAGING_DISABLED 0x10
244 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_1 0x00
245 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_2 0x04
246 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_3 0x08
247 #define FAN6_CONSECUTIVE_OUTOFLIMIT_NUMBER_4 0x0C
248 #define FAN6_CONVERSION_RATE_1_PERSEC 0x00
249 #define FAN6_CONVERSION_RATE_2_PERSEC 0x01
250 #define FAN6_CONVERSION_RATE_4_PERSEC 0x02
251 #define FAN6_CONVERSION_RATE_CONTINUOUS 0x03
258 #define FAN6_ALL_INTERRUPTS_DISABLED 0x00
259 #define FAN6_EXTDIODE3_INTERRUPT_ENABLED 0x08
260 #define FAN6_EXTDIODE2_INTERRUPT_ENABLED 0x04
261 #define FAN6_EXTDIODE1_INTERRUPT_ENABLED 0x02
262 #define FAN6_INTDIODE_INTERRUPT_ENABLED 0x01
269 #define FAN6_ALL_FAN_INTERRUPTS_DISABLED 0x00
270 #define FAN6_FAN_SPIN_BIT_ENABLED 0x02
271 #define FAN6_FAN_STALL_BIT_ENABLED 0x01
278 #define FAN6_PWM_PIN_OPEN_DRAIN 0x00
279 #define FAN6_PWM_PIN_PUSH_PULL 0x10
280 #define FAN6_NORMAL_POLARITY 0x00
281 #define FAN6_INVERTED_POLARITY 0x01
288 #define FAN6_PWM_BASE_FREQ_26000HZ 0x00
289 #define FAN6_PWM_BASE_FREQ_19531HZ 0x01
290 #define FAN6_PWM_BASE_FREQ_4882HZ 0x02
291 #define FAN6_PWM_BASE_FREQ_2441HZ 0x03
298 #define FAN6_0_PERCENT_SPEED 0x00
299 #define FAN6_25_PERCENTS_SPEED 0x40
300 #define FAN6_50_PERCENTS_SPEED 0x80
301 #define FAN6_75_PERCENTS_SPEED 0xC0
302 #define FAN6_100_PERCENTS_SPEED 0xFF
309 #define FAN6_CONTROL_CIRCUITRY_DISABLED 0x00
310 #define FAN6_CONTROL_CIRCUITRY_ENABLED 0x80
311 #define FAN6_RANGE_MIN_500RPM 0x00
312 #define FAN6_RANGE_MIN_1000RPM 0x20
313 #define FAN6_RANGE_MIN_2000RPM 0x40
314 #define FAN6_RANGE_MIN_4000RPM 0x60
315 #define FAN6_MIN_3_EDGES 0x00
316 #define FAN6_MIN_5_EDGES 0x08
317 #define FAN6_MIN_7_EDGES 0x10
318 #define FAN6_MIN_9_EDGES 0x18
319 #define FAN6_UPDATE_TIME_100_MILISEC 0x00
320 #define FAN6_UPDATE_TIME_200_MILISEC 0x01
321 #define FAN6_UPDATE_TIME_300_MILISEC 0x02
322 #define FAN6_UPDATE_TIME_400_MILISEC 0x03
323 #define FAN6_UPDATE_TIME_500_MILISEC 0x04
324 #define FAN6_UPDATE_TIME_800_MILISEC 0x05
325 #define FAN6_UPDATE_TIME_1200_MILISEC 0x06
326 #define FAN6_UPDATE_TIME_1600_MILISEC 0x07
333 #define FAN6_RAMP_RATE_CONT_DISABLED 0x00
334 #define FAN6_RAMP_RATE_CONT_ENABLED 0x40
335 #define FAN6_GLITCH_FILTER_DISABLED 0x00
336 #define FAN6_GLITCH_FILTER_ENABLED 0x20
337 #define FAN6_NO_DERIVATIVE 0x00
338 #define FAN6_BASIC_DERIVATIVE 0x08
339 #define FAN6_STEP_DERIVATIVE 0x10
340 #define FAN6_BOTH_DERIVATIVE 0x18
341 #define FAN6_ERROR_RANGE_0RPM 0x00
342 #define FAN6_ERROR_RANGE_50RPM 0x02
343 #define FAN6_ERROR_RANGE_100RPM 0x04
344 #define FAN6_ERROR_RANGE_200RPM 0x06
351 #define FAN6_GAIN_1X 0x00
352 #define FAN6_GAIN_2X 0x15
353 #define FAN6_GAIN_4X 0x2A
354 #define FAN6_GAIN_8X 0x3F
361 #define FAN6_UPDATE_PERIODS_DISABLED 0x00
362 #define FAN6_16_UPDATE_PERIODS 0x40
363 #define FAN6_32_UPDATE_PERIODS 0x80
364 #define FAN6_64_UPDATE_PERIODS 0xC0
365 #define FAN6_100_PERCENTS_PWM_DRIVE_ENABLED 0x00
366 #define FAN6_100_PERCENTS_PWM_DRIVE_DISABLED 0x20
367 #define FAN6_SPINUP_DRIVELEVEL_30_PERCENTS 0x00
368 #define FAN6_SPINUP_DRIVELEVEL_35_PERCENTS 0x04
369 #define FAN6_SPINUP_DRIVELEVEL_40_PERCENTS 0x08
370 #define FAN6_SPINUP_DRIVELEVEL_45_PERCENTS 0x0C
371 #define FAN6_SPINUP_DRIVELEVEL_50_PERCENTS 0x10
372 #define FAN6_SPINUP_DRIVELEVEL_55_PERCENTS 0x14
373 #define FAN6_SPINUP_DRIVELEVEL_60_PERCENTS 0x18
374 #define FAN6_SPINUP_DRIVELEVEL_65_PERCENTS 0x1C
375 #define FAN6_SPINUP_TIME_250_MILISEC 0x00
376 #define FAN6_SPINUP_TIME_500_MILISEC 0x01
377 #define FAN6_SPINUP_TIME_1_SEC 0x02
378 #define FAN6_SPINUP_TIME_2_SEC 0x03
385 #define FAN6_PUSH_TEMP_NOT_LOADED 0x00
386 #define FAN6_PUSH_TEMP1_LOADED 0x80
387 #define FAN6_PUSH_TEMP2_LOADED 0x40
388 #define FAN6_LUT_ENABLED 0x00
389 #define FAN6_LUT_LOCKED 0x20
390 #define FAN6_RPM_TACH_ENABLED 0x00
391 #define FAN6_PWM_DUTY_ENABLED 0x10
398 #define FAN6_GPIO_DIR_INPUT 0x00
399 #define FAN6_GPIO2_DIR_OUTPUT 0x02
400 #define FAN6_GPIO1_DIR_OUTPUT 0x01
407 #define FAN6_GPIO_AS_OPEN_DRAIN 0x00
408 #define FAN6_GPIO2_AS_PUSH_PULL 0x02
409 #define FAN6_GPIO1_AS_PUSH_PULL 0x01
416 #define FAN6_GPIO_INTERR_DISABLED 0x00
417 #define FAN6_GPIO2_INTERR_ENABLED 0x02
418 #define FAN6_GPIO1_INTERR_ENABLED 0x01
425 #define FAN6_SW_NOT_LOCKED 0x00
426 #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:479
void fan6_set_gpio_1(fan6_t *ctx, const uint8_t state)
GPIO 1 Set function.
uint8_t adc_mode
Definition: fan6.h:461
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:444
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:487
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:474
void fan6_cfg_setup(fan6_cfg_t *cfg)
Config Object Initialization function.
Click ctx object definition.
Definition: fan6.h:440
uint8_t config_byte2
Definition: fan6.h:463
uint16_t fan6_read_reg(fan6_t *ctx, const uint8_t register_address)
Generic read function.
i2c_master_t i2c
Definition: fan6.h:454
digital_in_t alr
Definition: fan6.h:450
digital_out_t io1
Definition: fan6.h:443
uint8_t slave_address
Definition: fan6.h:458
digital_in_t sdn
Definition: fan6.h:448
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:475
pin_name_t sdn
Definition: fan6.h:480
uint8_t config_byte1
Definition: fan6.h:462
Click configuration structure definition.
Definition: fan6.h:471
pin_name_t en
Definition: fan6.h:481
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:81
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:483
uint8_t i2c_address
Definition: fan6.h:488
digital_in_t io2
Definition: fan6.h:449
uint8_t check_ptr
Definition: fan6.h:460
void fan6_default_cfg(fan6_t *ctx)
Click Default Configuration function.
pin_name_t io2
Definition: fan6.h:482
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.