fan5 2.1.0.0
Fan 5 Click Driver

API for configuring and manipulating Fan 5 Click driver. More...

Topics

 Fan 5 Registers List
 List of registers of Fan 5 Click driver.
 
 Fan 5 Registers Settings
 Settings for registers of Fan 5 Click driver.
 
 Fan 5 MikroBUS Map
 MikroBUS pin mapping of Fan 5 Click driver.
 

Functions

void fan5_cfg_setup (fan5_cfg_t *cfg)
 Fan 5 configuration object setup function.
 
err_t fan5_init (fan5_t *ctx, fan5_cfg_t *cfg)
 Fan 5 initialization function.
 
err_t fan5_default_cfg (fan5_t *ctx)
 Fan 5 default configuration function.
 
err_t fan5_generic_write (fan5_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Fan 5 I2C writing function.
 
err_t fan5_generic_read (fan5_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Fan 5 I2C reading function.
 
err_t fan5_reg_write (fan5_t *ctx, uint8_t reg, uint8_t data_in)
 Fan 5 I2C writing into register function.
 
err_t fan5_reg_read (fan5_t *ctx, uint8_t reg, uint8_t *data_out)
 Fan 5 I2C reading register function.
 
err_t fan5_get_mfr_id (fan5_t *ctx, uint8_t *mfr_id)
 Fan 5 read manufacturer identification.
 
err_t fan5_get_rpm1 (fan5_t *ctx, uint16_t *fan1_speed)
 Fan 5 get speed of FAN1.
 
err_t fan5_get_rpm2 (fan5_t *ctx, uint16_t *fan2_speed)
 Fan 5 get speed of FAN2.
 
err_t fan5_set_fan_fault1 (fan5_t *ctx, uint16_t fault1_value)
 Fan 5 set FAN1 fault threshold.
 
err_t fan5_set_fan_fault2 (fan5_t *ctx, uint16_t fault2_value)
 Fan 5 set FAN2 fault threshold.
 
err_t fan5_set_duty_cycle (fan5_t *ctx, uint8_t duty_cycle)
 Fan 5 set duty cycle.
 
err_t fan5_get_status_flags (fan5_t *ctx, uint8_t *status_data)
 Fan 5 get status flags.
 
err_t fan5_get_fault_state (fan5_t *ctx)
 Fan 5 get fault state.
 
err_t fan5_clear_flt_flag (fan5_t *ctx)
 Fan 5 clear status flags.
 
err_t fan5_turn_on_fans (fan5_t *ctx)
 Fan 5 turn on fans.
 
err_t fan5_turn_off_fans (fan5_t *ctx)
 Fan 5 turn off fans.
 

Detailed Description

API for configuring and manipulating Fan 5 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ fan5_cfg_setup()

void fan5_cfg_setup ( fan5_cfg_t * cfg)

Fan 5 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See fan5_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ fan5_clear_flt_flag()

err_t fan5_clear_flt_flag ( fan5_t * ctx)

Fan 5 clear status flags.

This function is used to clear the status register flags.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_default_cfg()

err_t fan5_default_cfg ( fan5_t * ctx)

Fan 5 default configuration function.

This function executes a default configuration of Fan 5 click board.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ fan5_generic_read()

err_t fan5_generic_read ( fan5_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Fan 5 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_generic_write()

err_t fan5_generic_write ( fan5_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Fan 5 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_get_fault_state()

err_t fan5_get_fault_state ( fan5_t * ctx)

Fan 5 get fault state.

This function is used to read state of the flt pin.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -2 - Fault triggered. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_get_mfr_id()

err_t fan5_get_mfr_id ( fan5_t * ctx,
uint8_t * mfr_id )

Fan 5 read manufacturer identification.

This function reads a manufacturer identification regisret by using I2C serial interface.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[out]mfr_id: Read manufacturer identification.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_get_rpm1()

err_t fan5_get_rpm1 ( fan5_t * ctx,
uint16_t * fan1_speed )

Fan 5 get speed of FAN1.

This function reads the speed of the FAN1 by reading the appropriate register and multiplying that data with a constant.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[out]fan1_speed: Speed of FAN1.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
If this value is exceeded, R1CO in the Status Register will be set.

◆ fan5_get_rpm2()

err_t fan5_get_rpm2 ( fan5_t * ctx,
uint16_t * fan2_speed )

Fan 5 get speed of FAN2.

This function reads the speed of the FAN2 by reading the appropriate register and multiplying that data with a constant.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[out]fan2_speed: Speed of FAN2.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
If this value is exceeded, R2CO in the Status Register will be set.

◆ fan5_get_status_flags()

err_t fan5_get_status_flags ( fan5_t * ctx,
uint8_t * status_data )

Fan 5 get status flags.

This function is used to read the status register in order to get faults that might occur.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[out]status_data: Read data from the status register.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_init()

err_t fan5_init ( fan5_t * ctx,
fan5_cfg_t * cfg )

Fan 5 initialization function.

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

Parameters
[out]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See fan5_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_reg_read()

err_t fan5_reg_read ( fan5_t * ctx,
uint8_t reg,
uint8_t * data_out )

Fan 5 I2C reading register function.

This function reads a byte of data from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_reg_write()

err_t fan5_reg_write ( fan5_t * ctx,
uint8_t reg,
uint8_t data_in )

Fan 5 I2C writing into register function.

This function writes a data byte into the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_set_duty_cycle()

err_t fan5_set_duty_cycle ( fan5_t * ctx,
uint8_t duty_cycle )

Fan 5 set duty cycle.

This function is used to set duty cycle that is used to control speed of the fans.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]duty_cycle: Duty cycle value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Use predefined values for the duty cycle.

◆ fan5_set_fan_fault1()

err_t fan5_set_fan_fault1 ( fan5_t * ctx,
uint16_t fault1_value )

Fan 5 set FAN1 fault threshold.

This function is used to set FAN1 speed threshold, if the speed drops below this value for more than 2.4 seconds, F1F in the Status Register will be set.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]fault1_value: Low speed threshold of FAN1.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
RPM threshold can be set in 50 RPM increments.

◆ fan5_set_fan_fault2()

err_t fan5_set_fan_fault2 ( fan5_t * ctx,
uint16_t fault2_value )

Fan 5 set FAN2 fault threshold.

This function is used to set FAN2 speed threshold, if the speed drops below this value for more than 2.4 seconds, F1F in the Status Register will be set.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
[in]fault2_value: Low speed threshold of FAN2.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
RPM threshold can be set in 50 RPM increments.

◆ fan5_turn_off_fans()

err_t fan5_turn_off_fans ( fan5_t * ctx)

Fan 5 turn off fans.

This function is used to turn off FAN1 and FAN2 outputs.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ fan5_turn_on_fans()

err_t fan5_turn_on_fans ( fan5_t * ctx)

Fan 5 turn on fans.

This function is used to turn on FAN1 and FAN2 outputs.

Parameters
[in]ctx: Click context object. See fan5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.