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

#ifndef __CROS_EC_CONFIG_CHIP_H
#error "This file must only be included from config_chip.h and it should be" \
	"included in all zephyr builds automatically"
#endif

#define BATTERY_ENUM(val) DT_CAT(BATTERY_, val)
#define BATTERY_TYPE(id) BATTERY_ENUM(DT_STRING_UPPER_TOKEN(id, enum_name))
#define BATTERY_TYPE_WITH_COMMA(id) BATTERY_TYPE(id),

/* This produces a list of BATTERY_<ENUM_NAME> identifiers */
/* clang-format off */
enum battery_type {
#if DT_HAS_COMPAT_STATUS_OKAY(battery_smart)
	DT_FOREACH_STATUS_OKAY(battery_smart, BATTERY_TYPE_WITH_COMMA)
#endif
	BATTERY_TYPE_COUNT,
};
/* clang-format on */

#undef BATTERY_TYPE_WITH_COMMA

#if DT_NODE_EXISTS(DT_NODELABEL(default_battery_3s))
extern const enum battery_type DEFAULT_BATTERY_TYPE_3S;
#endif