blob: 8f08e8d8c8075a418703c461cdfd2f50ef159983 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* 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_ */
|