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:
Martin Jäger
2021-02-04 17:28:52 +01:00
parent 830315cda0
commit 4eaf89154a
15 changed files with 113 additions and 82 deletions
+3 -3
View File
@@ -93,7 +93,7 @@ void oled_update()
}
// solar panel data
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), pwm_switch))
#if BOARD_HAS_PWM_PORT
if (pwm_switch.active()) {
#else
if (half_bridge_enabled()) {
@@ -108,7 +108,7 @@ void oled_update()
len = snprintf(buf, sizeof(buf), "n/a");
oled.writeString(buf, len);
}
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), pwm_switch))
#if BOARD_HAS_PWM_PORT
if (in_terminal.bus->voltage > bat_terminal.bus->voltage)
#endif
{
@@ -146,7 +146,7 @@ void oled_update()
oled.setTextCursor(0, 56);
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), pwm_switch))
#if BOARD_HAS_PWM_PORT
bool pwm_enabled = pwm_switch.active();
float duty_cycle = pwm_switch.get_duty_cycle();
#else