Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/thermal/tmp451.h
1476 views
1
/*
2
* SOC/PCB Temperature driver for Nintendo Switch's TI TMP451
3
*
4
* Copyright (c) 2018 CTCaer
5
*
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms and conditions of the GNU General Public License,
8
* version 2, as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
* more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef __TMP451_H_
20
#define __TMP451_H_
21
22
#include <utils/types.h>
23
24
#define TMP451_I2C_ADDR 0x4C
25
26
#define TMP451_PCB_TEMP_REG 0x00
27
#define TMP451_SOC_TEMP_REG 0x01
28
29
#define TMP451_CONFIG_REG 0x09
30
#define TMP451_CNV_RATE_REG 0x0A
31
32
#define TMP451_SOC_TMP_DEC_REG 0x10
33
#define TMP451_PCB_TMP_DEC_REG 0x15
34
35
#define TMP451_SOC_TMP_OFH_REG 0x11
36
#define TMP451_SOC_TMP_OFL_REG 0x12
37
38
// If input is false, the return value is packed. MSByte is the integer in oC
39
// and the LSByte is the decimal point truncated to 2 decimal places.
40
// Otherwise it's an integer oC.
41
u16 tmp451_get_soc_temp(bool integer);
42
u16 tmp451_get_pcb_temp(bool integer);
43
void tmp451_init();
44
void tmp451_end();
45
46
#endif /* __TMP451_H_ */
47
48