Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/Pmods/PmodTMP2/ADT7420.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ADT7420.h
3 * @brief Header File for ADT7420 Driver.
4 * @author ATofan ([email protected])
5 ********************************************************************************
6 * Copyright 2012(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 ********************************************************************************
40 * SVN Revision: $WCREV$
41 *******************************************************************************/
42
43 #ifndef ADT7420_H_
44 #define ADT7420_H_
45
46 #include "xparameters.h"
47
48 //ADT7420 IIC Address (JP1 - OPEN, JP2 - OPEN)
49 #define I2C_BASEADDR XPAR_AXI_IIC_1_BASEADDR
50 #define ADT7420_IIC_ADDR 0x4B
51
52 //REGISTERS
53 #define TEMP_REG 0x00
54 #define STATUS_REG 0x02
55 #define CONFIG_REG 0x03
56 #define TH_SETP_MSB 0x04
57 #define TH_SETP_LSB 0x05
58 #define TL_SETP_MSB 0x06
59 #define TL_SETP_LSB 0x07
60 #define TCRIT_SETP_MSB 0x08
61 #define TCRIT_SETP_LSB 0x09
62 #define T_HYST_SETP 0x0A
63 #define ID_REG 0x0B
64 #define SOFT_RST_REG 0x2F
65
66 //STATUS_REG BITS
67 #define UNDER_TLOW 4
68 #define OVER_THIGH 5
69 #define OVER_TCRIT 6
70 #define CNV_READY_N 7
71
72 //CONFIG_REG BITS
73 #define FAULT_QUEUE 0
74 #define CT_POL 2
75 #define INT_POL 3
76 #define INT_CT 4
77 #define OP_MODE 5
78 #define RESOLUTION 7
79
80 //ID_REG BITS
81 #define REVISION_ID 0x07
82 #define MANUFACTURE_ID 0xF8
83
84 //FUNCTION PROTOTYPES
85 void ADT7420_Init(void);
86 void ADT7420_DisplayMainMenu(void);
87 void ADT7420_DisplayMenu(void);
88 void ADT7420_PrintID(void);
89 void ADT7420_DisplayResolutionMenu(void);
90 void ADT7420_SetResolution(void);
91 unsigned char ADT7420_GetResolution(char display);
92 int ADT7420_ReadTemp(void);
93 void Display_Temp (short int data);
94 int ADT7420_ConsoleRead(void);
95 void ADT7420_DisplaySetTHighMenu(void);
96 void ADT7420_SetTHigh (int THigh);
97 void ADT7420_PrintTHigh(void);
98 void ADT7420_DisplaySetTLowMenu(void);
99 void ADT7420_SetTLow (int TLow);
100 void ADT7420_PrintTLow(void);
101 void ADT7420_DisplaySetTCritMenu(void);
102 void ADT7420_SetTCrit(int TCrit);
103 void ADT7420_PrintTCrit(void);
104 void ADT7420_DisplaySetTHystMenu(void);
105 void ADT7420_SetHysteresis(int degrees);
106 void ADT7420_PrintHysteresis(void);
107 void ADT7420_DisplaySetFaultQueueMenu(void);
108 void ADT7420_PrintFaultQueue(void);
109 void ADT7420_SetAlertPolarity(char CT, char INT);
110 void SetAlertModeComparator(void);
111 void ADT7420_PrintAlertMode(void);
112 void ADT7420_PrintCTPolarity(void);
113 void ADT7420_PrintINTPolarity(void);
114 void ADT7420_DisplaySettings(void);
115 void DemoProgram(void);
116
117 #endif /* ADT7420_H_ */