libnx v4.9.0
Loading...
Searching...
No Matches
ts.h
Go to the documentation of this file.
1/**
2 * @file ts.h
3 * @brief Temperature measurement (ts) service IPC wrapper.
4 * @author yellows8
5 * @copyright libnx Authors
6 */
7#pragma once
8#include "../types.h"
9#include "../sf/service.h"
10
11/// Location
12typedef enum {
13 TsLocation_Internal = 0, ///< TMP451 Internal: PCB
14 TsLocation_External = 1, ///< TMP451 External: SoC
16
17typedef enum {
18 TsDeviceCode_LocationInternal = 0x41000001u,
19 TsDeviceCode_LocationExternal = 0x41000002u,
20} TsDeviceCode;
21
22typedef struct {
23 Service s;
24} TsSession;
25
26/// Initialize ts.
28
29/// Exit ts.
30void tsExit(void);
31
32/// Gets the Service for ts.
34
35/**
36 * @brief Gets the min/max temperature for the specified \ref TsLocation.
37 * @param[in] location \ref TsLocation
38 * @param[out] min_temperature Output minimum temperature in Celsius.
39 * @param[out] max_temperature Output maximum temperature in Celsius.
40 */
41Result tsGetTemperatureRange(TsLocation location, s32 *min_temperature, s32 *max_temperature);
42
43/**
44 * @brief Gets the temperature for the specified \ref TsLocation.
45 * @param[in] location \ref TsLocation
46 * @param[out] temperature Output temperature in Celsius.
47 */
48Result tsGetTemperature(TsLocation location, s32 *temperature);
49
50/**
51 * @brief Gets the temperature for the specified \ref TsLocation, in MilliC. [1.0.0-13.2.1]
52 * @param[in] location \ref TsLocation
53 * @param[out] temperature Output temperature in MilliC.
54 */
56
57Result tsOpenSession(TsSession *s, u32 device_code); ///< [8.0.0+]
58
59Result tsSessionGetTemperature(TsSession *s, float *temperature); ///< [10.0.0+]
60void tsSessionClose(TsSession *s);
Service object structure.
Definition service.h:14
Definition ts.h:22
Result tsSessionGetTemperature(TsSession *s, float *temperature)
[10.0.0+]
Result tsInitialize(void)
Initialize ts.
TsLocation
Location.
Definition ts.h:12
@ TsLocation_Internal
TMP451 Internal: PCB.
Definition ts.h:13
@ TsLocation_External
TMP451 External: SoC.
Definition ts.h:14
void tsExit(void)
Exit ts.
Result tsGetTemperature(TsLocation location, s32 *temperature)
Gets the temperature for the specified TsLocation.
Service * tsGetServiceSession(void)
Gets the Service for ts.
Result tsGetTemperatureMilliC(TsLocation location, s32 *temperature)
Gets the temperature for the specified TsLocation, in MilliC.
Result tsOpenSession(TsSession *s, u32 device_code)
[8.0.0+]
Result tsGetTemperatureRange(TsLocation location, s32 *min_temperature, s32 *max_temperature)
Gets the min/max temperature for the specified TsLocation.
u32 Result
Function error code result type.
Definition types.h:44
int32_t s32
32-bit signed integer.
Definition types.h:27
uint32_t u32
32-bit unsigned integer.
Definition types.h:21