summaryrefslogtreecommitdiff
path: root/zephyr/shim/include/temp_sensor/temp_sensor.h
blob: b0cadd430388bb04b8a7c5481f99ae1758aab76a (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
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef ZEPHYR_SHIM_INCLUDE_TEMP_SENSOR_TEMP_SENSOR_H_
#define ZEPHYR_SHIM_INCLUDE_TEMP_SENSOR_TEMP_SENSOR_H_

#include <devicetree.h>

#ifdef CONFIG_PLATFORM_EC_TEMP_SENSOR

#define ZSHIM_TEMP_SENSOR_ID(node_id) DT_STRING_UPPER_TOKEN(node_id, enum_name)
#define TEMP_SENSOR_ID_WITH_COMMA(node_id) ZSHIM_TEMP_SENSOR_ID(node_id),

enum temp_sensor_id {
#if DT_NODE_EXISTS(DT_PATH(named_temp_sensors))
	DT_FOREACH_CHILD(DT_PATH(named_temp_sensors),
			 TEMP_SENSOR_ID_WITH_COMMA)
#endif /* named_temp_sensors */
	TEMP_SENSOR_COUNT
};

#undef TEMP_SENSOR_ID_WITH_COMMA

#endif /* CONFIG_PLATFORM_EC_TEMP_SENSOR */

#endif /* ZEPHYR_SHIM_INCLUDE_TEMP_SENSOR_TEMP_SENSOR_H_ */