fan2 2.0.0.0
Public Function

Functions

void fan2_cfg_setup (fan2_cfg_t *cfg)
 Configuration Object Initialization function.
 
fan2_err_t fan2_init (fan2_t *ctx, fan2_cfg_t *cfg)
 Click Initialization function.
 
void fan2_default_cfg (fan2_t *ctx)
 Click Default Configuration function.
 
fan2_err_t fan2_generic_write_byte (fan2_t *ctx, uint8_t reg_addr, uint8_t data_in)
 Generic Byte Write function.
 
fan2_err_t fan2_generic_read_byte (fan2_t *ctx, uint8_t reg_addr, uint8_t *data_out)
 Generic Byte Read function.
 
fan2_err_t fan2_generic_write_word (fan2_t *ctx, uint8_t reg_addr, uint16_t data_in)
 Generic Word Write function.
 
fan2_err_t fan2_generic_read_word (fan2_t *ctx, uint8_t reg_addr, uint16_t *data_out)
 Generic Word Read function.
 
fan2_err_t fan2_read_temp (fan2_t *ctx, uint8_t temp_addr, float *temp_cels)
 Temperature Read function.
 
fan2_err_t fan2_write_temp (fan2_t *ctx, uint8_t temp_addr, float temp_cels)
 Temperature Write function.
 
fan2_err_t fan2_read_tacho (fan2_t *ctx, uint8_t tacho_addr, uint16_t *tacho_rpm)
 Tachometer Read function.
 
void fan2_write_tacho_threshold (fan2_t *ctx, uint32_t tacho_rpm)
 Tachometer Threshold Write function.
 
fan2_err_t fan2_direct_speed_control (fan2_t *ctx, float speed_per)
 Direct Fan Speed Control function.
 
float fan2_read_current_speed (fan2_t *ctx)
 Current Fan Speed Read function.
 
uint8_t fan2_status (fan2_t *ctx, uint8_t flag_mask)
 Status Check function.
 
fan2_err_t fan2_write_lut (fan2_t *ctx, uint8_t lut_addr, uint8_t *lut_data, uint8_t n_data)
 Lookup Table Write function.
 
void fan2_sw_reset (fan2_t *ctx)
 Software Reset function.
 
uint8_t fan2_get_alr_pin (fan2_t *ctx)
 Alert Pin Check function.
 
uint8_t fan2_get_shd_pin (fan2_t *ctx)
 Shutdown Pin Check function.
 
uint8_t fan2_get_ff_pin (fan2_t *ctx)
 Fan-Failure Pin Check function.
 
uint8_t fan2_get_int_pin (fan2_t *ctx)
 Fault Pin Check function.
 

Detailed Description

Function Documentation

◆ fan2_cfg_setup()

void fan2_cfg_setup ( fan2_cfg_t * cfg)

Configuration Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to initial state.

Note
All used pins will be set to unconnected state.

◆ fan2_default_cfg()

void fan2_default_cfg ( fan2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes a default configuration for Fan 2 click.

◆ fan2_direct_speed_control()

fan2_err_t fan2_direct_speed_control ( fan2_t * ctx,
float speed_per )

Direct Fan Speed Control function.

Parameters
ctxClick object.
speed_perDesired fan speed in percents [from 0 to 100].
Returns
0x0 - Ok, 0xFF - PWM duty range error.

@description This function allows user to control fan speed directly by changing the PWM duty cycle.

◆ fan2_generic_read_byte()

fan2_err_t fan2_generic_read_byte ( fan2_t * ctx,
uint8_t reg_addr,
uint8_t * data_out )

Generic Byte Read function.

Parameters
ctxClick object.
reg_addrRegister address.
data_outMemory where read data be stored.
Returns
0x0 - Ok, 0xFC - Invalid register address.

@description This function reads one byte data from the desired register.

◆ fan2_generic_read_word()

fan2_err_t fan2_generic_read_word ( fan2_t * ctx,
uint8_t reg_addr,
uint16_t * data_out )

Generic Word Read function.

Parameters
ctxClick object.
reg_addrRegister address.
data_outMemory where read data be stored.
Returns
0x0 - Ok, 0xFC - Invalid register address.

@description This function reads 16-bit data from the desired register.

◆ fan2_generic_write_byte()

fan2_err_t fan2_generic_write_byte ( fan2_t * ctx,
uint8_t reg_addr,
uint8_t data_in )

Generic Byte Write function.

Parameters
ctxClick object.
reg_addrRegister address.
data_inData to be written.
Returns
0x0 - Ok, 0xFC - Invalid register address.

@description This function writes one byte data to the desired register.

◆ fan2_generic_write_word()

fan2_err_t fan2_generic_write_word ( fan2_t * ctx,
uint8_t reg_addr,
uint16_t data_in )

Generic Word Write function.

Parameters
ctxClick object.
reg_addrRegister address.
data_inData to be written.
Returns
0x0 - Ok, 0xFC - Invalid register address.

@description This function writes 16-bit data to the desired register.

◆ fan2_get_alr_pin()

uint8_t fan2_get_alr_pin ( fan2_t * ctx)

Alert Pin Check function.

Parameters
ctxClick object.
Returns
Pin state [bool].

@description This function returns the ALR pin state.

Note
Active-Low Alert Output. Open-drain fault output. ALERT is triggered when a measured temperature exceeds its programmed high limit.

◆ fan2_get_ff_pin()

uint8_t fan2_get_ff_pin ( fan2_t * ctx)

Fan-Failure Pin Check function.

Parameters
ctxClick object.
Returns
Pin state [bool].

@description This function returns the FF pin state.

Note
Active-Low Fan-Failure Output. The device pulls this output low if a fan failure is detected.

◆ fan2_get_int_pin()

uint8_t fan2_get_int_pin ( fan2_t * ctx)

Fault Pin Check function.

Parameters
ctxClick object.
Returns
Pin state [bool].

@description This function returns the INT (FAULT) pin state.

◆ fan2_get_shd_pin()

uint8_t fan2_get_shd_pin ( fan2_t * ctx)

Shutdown Pin Check function.

Parameters
ctxClick object.
Returns
Pin state [bool].

@description This function returns the SHD pin state.

Note
Active-Low Shutdown Output. Open-drain output for system shutdown when overtemperature is detected.

◆ fan2_init()

fan2_err_t fan2_init ( fan2_t * ctx,
fan2_cfg_t * cfg )

Click Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.
Returns
0x0 - Ok, 0xFA - Driver init error, 0xFB - Unsupported pin.

@description This function initializes all necessary pins and peripherals used for this click.

◆ fan2_read_current_speed()

float fan2_read_current_speed ( fan2_t * ctx)

Current Fan Speed Read function.

Parameters
ctxClick object.
Returns
Current fan speed in percents.

@description This function reads the current fan speed and converts this data to percents.

◆ fan2_read_tacho()

fan2_err_t fan2_read_tacho ( fan2_t * ctx,
uint8_t tacho_addr,
uint16_t * tacho_rpm )

Tachometer Read function.

Parameters
ctxClick object.
tacho_addrAddress of any tachometer register.
tacho_rpmMemory where tachometer data be stored.
Returns
0x0 - Ok, 0xFC - Invalid register address.

@description This function reads the tachometer data from the selected tachometer register and converts this data to rpm [rotation per minute].

◆ fan2_read_temp()

fan2_err_t fan2_read_temp ( fan2_t * ctx,
uint8_t temp_addr,
float * temp_cels )

Temperature Read function.

Parameters
ctxClick object.
temp_addrAddress of any temperature register.
temp_celsMemory where temperature data be stored.
Returns
0x0 - Ok, 0xFC - Invalid register address.

@description This function reads the temperature data from the selected temperature register and converts this data to Celsius degrees.

◆ fan2_status()

uint8_t fan2_status ( fan2_t * ctx,
uint8_t flag_mask )

Status Check function.

Parameters
ctxClick object.
flag_maskSelects a desired register bits to be checked.
Returns
Status byte.

@description This function checks the selected status flag bits.

◆ fan2_sw_reset()

void fan2_sw_reset ( fan2_t * ctx)

Software Reset function.

Parameters
ctxClick object.

@description This function executes a software reset and waits until reset operation was done.

◆ fan2_write_lut()

fan2_err_t fan2_write_lut ( fan2_t * ctx,
uint8_t lut_addr,
uint8_t * lut_data,
uint8_t n_data )

Lookup Table Write function.

Parameters
ctxClick object.
lut_addrStart LUT address.
lut_dataData to be written.
n_dataNumber of bytes to be written [from 1 to 48].
Returns
0x0 - Ok, 0xFC - Invalid LUT address, 0xFD - Number of bytes is out of range.

@description This function allows user to write the desired data to Lookup table.

◆ fan2_write_tacho_threshold()

void fan2_write_tacho_threshold ( fan2_t * ctx,
uint32_t tacho_rpm )

Tachometer Threshold Write function.

Parameters
ctxClick object.
tacho_rpmDesired tachometer data in rpm.

@description This function writes the tachometer threshold value in rpm.

◆ fan2_write_temp()

fan2_err_t fan2_write_temp ( fan2_t * ctx,
uint8_t temp_addr,
float temp_cels )

Temperature Write function.

Parameters
ctxClick object.
temp_addrAddress of any temperature register.
temp_celsDesired temperature in Celsius degrees [from 125 to -55].
Returns
0x0 - Ok, 0xFC - Invalid register address, 0xFE - Temperature range error.

@description This function writes the entered temperature [Celsius degrees] to the selected temperature register.