/* * Blower.h * * Created on: Aug 1, 2018 * Author: avi */ #ifndef DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ #define DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ #define I2C_DAC_ADDRESS 0x98 //Command Byte #define AD5691R_CMD_NOOP 0x00 #define AD5691R_CMD_WRITE_INPUT_REG 0x10 #define AD5691R_CMD_UPDATE_DAC_REG 0x20 #define AD5691R_CMD_WRITE_INPUT_N_UPDATE_REG 0x30 #define AD5691R_CMD_WRITE_CONTROL_REG 0x40 #define AD5691R_DONT_CARE_DATA_BYTE 0x00 #define Default_Voltage 3000 //4V #define DAC_I2C_BASE 2 typedef union { struct { uint8_t Command; uint8_t Data_High; uint8_t Data_Low; }Bytes; uint8_t Write_DAC_I2C_Buf[3]; }DAC_Union; //AD5691R Control Data High Byte #define AD5691R_Control_Reset 0x80 #define AD5691R_Control_Normal_Mode 0x00 #define AD5691R_Control_Power_Down_1K 0x20 #define AD5691R_Control_Power_Down_100K 0x40 #define AD5691R_Control_Power_Down_Three_State 0x60 #define AD5691R_Control_Reference_Enabled 0x00 #define AD5691R_Control_Reference_Disabled 0x10 #define AD5691R_Control_Gain_0V_VREF 0x00 #define AD5691R_Control_Gain_0V_2VREF 0x08 uint32_t Turn_the_Blower_On(); uint32_t Control_Voltage_To_Blower(uint32_t mV); uint32_t Turn_the_Blower_Off(); uint32_t getBlowerState(void); uint32_t Gradual_Increase_Blower(uint32_t Initial_mV,uint32_t Target_mV); uint32_t Cancel_Gradual_Increase_Blower(uint32_t Initial_mV); #endif /* DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ */