Use BOARD_HAS_* macro to identify key hardware features
These macros replace the direct use of DT_ macros in many locations and make the code more readable.
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2021 Martin Jäger / Libre Solar
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Defines for conditional compiling based on existing board features
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define BOARD_HAS_DCDC DT_NODE_EXISTS(DT_PATH(dcdc))
|
||||
#define BOARD_HAS_PWM_PORT DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), pwm_switch))
|
||||
#define BOARD_HAS_LOAD_OUTPUT DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), load))
|
||||
#define BOARD_HAS_USB_OUTPUT DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), usb_pwr))
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
Reference in New Issue
Block a user