fan5 2.1.0.0
fan5.h File Reference

This file contains API for Fan 5 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  fan5_t
 Fan 5 Click context object. More...
 
struct  fan5_cfg_t
 Fan 5 Click configuration object. More...
 

Macros

#define FAN5_RPM1_REG   0x00
 Fan 5 description register.
 
#define FAN5_RPM2_REG   0x01
 
#define FAN5_FAN_FAULT1_REG   0x02
 
#define FAN5_FAN_FAULT2_REG   0x03
 
#define FAN5_CONFIG_REG   0x04
 
#define FAN5_STATUS_REG   0x05
 
#define FAN5_DUTY_CYCLE_REG   0x06
 
#define FAN5_MFR_ID_REG   0x07
 
#define FAN5_VER_ID_REG   0x08
 
#define FAN5_CLEAR_FLT   0x80
 Fan 5 description setting.
 
#define FAN5_8_BIT_RESOLUTION   0x00
 
#define FAN5_9_BIT_RESOLUTION   0x40
 
#define FAN5_VOUT_BASED_ON_DYTY_REG   0x20
 
#define FAN5_VOUT_BASED_ON_VIN   0x00
 
#define FAN5_FAN2_PPR_1   0x00
 
#define FAN5_FAN2_PPR_2   0x08
 
#define FAN5_FAN2_PPR_4   0x10
 
#define FAN5_FAN2_PPR_8   0x18
 
#define FAN5_FAN1_PPR_1   0x00
 
#define FAN5_FAN1_PPR_2   0x02
 
#define FAN5_FAN1_PPR_4   0x04
 
#define FAN5_FAN1_PPR_8   0x06
 
#define FAN5_SHUTDOWN_MODE   0x01
 
#define FAN5_NORMAL_MODE   0x00
 
#define FAN5_MAX_RPM_VALUE   12750
 
#define FAN5_OTF_FLAG   0x20
 Fan 5 fault flags.
 
#define FAN5_R2CO_FLAG   0x10
 
#define FAN5_R1CO_FLAG   0x08
 
#define FAN5_VSTAT_FLAG   0x04
 
#define FAN5_F2F_FLAG   0x02
 
#define FAN5_F1F_FLAG   0x01
 
#define FAN5_30_PER_DUTY   0x00
 Fan 5 duty cycle setting.
 
#define FAN5_35_PER_DUTY   0x01
 
#define FAN5_40_PER_DUTY   0x02
 
#define FAN5_44_PER_DUTY   0x03
 
#define FAN5_49_PER_DUTY   0x04
 
#define FAN5_53_PER_DUTY   0x05
 
#define FAN5_58_PER_DUTY   0x06
 
#define FAN5_63_PER_DUTY   0x07
 
#define FAN5_67_PER_DUTY   0x08
 
#define FAN5_72_PER_DUTY   0x09
 
#define FAN5_77_PER_DUTY   0x0A
 
#define FAN5_81_PER_DUTY   0x0B
 
#define FAN5_86_PER_DUTY   0x0C
 
#define FAN5_90_PER_DUTY   0x0D
 
#define FAN5_95_PER_DUTY   0x0E
 
#define FAN5_100_PER_DUTY   0x0F
 
#define FAN5_DEVICE_ADDRESS   0x1B
 Fan 5 device address setting.
 
#define FAN5_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  fan5_return_value_t { FAN5_OK = 0 , FAN5_ERROR = -1 , FAN5_FAULT = -2 }
 Fan 5 Click return value data. More...
 

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

This file contains API for Fan 5 Click Driver.

Enumeration Type Documentation

◆ fan5_return_value_t

Fan 5 Click return value data.

Predefined enum values for driver return values.

Enumerator
FAN5_OK 
FAN5_ERROR 
FAN5_FAULT