Introduce generic "outputs" DTS binding
Replaces previous "switch" and "pwm-out" bindings and allows to reference either gpio or pwm handle and specify maximum current. Also replacing CONFIG_HAS_LOAD and CONFIG_HAS_USB_PWR with DT_ variants.
This commit is contained in:
+4
-4
@@ -37,8 +37,10 @@
|
||||
#define DT_INST_0_PWM_SWITCH_PWM_FREQUENCY 50 // Hz
|
||||
#define DT_INST_0_PWM_SWITCH_CURRENT_MAX 20 // A
|
||||
|
||||
#define CONFIG_HAS_LOAD_OUTPUT 1
|
||||
#define CONFIG_HAS_USB_PWR_OUTPUT 1
|
||||
#define DT_OUTPUTS_LOAD_PRESENT 1
|
||||
#define DT_OUTPUTS_LOAD_CURRENT_MAX 20 // PCB maximum load switch current
|
||||
|
||||
#define DT_OUTPUTS_USB_PWR_PRESENT 1
|
||||
|
||||
// Values that are otherwise defined by Kconfig
|
||||
#define CONFIG_CONTROL_FREQUENCY 10 // Hz
|
||||
@@ -46,8 +48,6 @@
|
||||
#define DT_CHARGE_CONTROLLER_PCB_INTERNAL_TREF_MAX 50
|
||||
#define DT_CHARGE_CONTROLLER_PCB_MOSFETS_TAU_JA 5
|
||||
|
||||
#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current
|
||||
|
||||
#define DT_CHARGE_CONTROLLER_PCB_LS_VOLTAGE_MAX 32 // Maximum voltage at battery port (V)
|
||||
#define DT_CHARGE_CONTROLLER_PCB_HS_VOLTAGE_MAX 55 // Maximum voltage at PV input port (V)
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ void control_on_to_off_overcurrent()
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init);
|
||||
load_init(&load_out, true);
|
||||
|
||||
load_out.current = LOAD_CURRENT_MAX * 1.9; // with factor 2 it is switched off immediately
|
||||
load_out.current = DT_OUTPUTS_LOAD_CURRENT_MAX * 1.9; // with factor 2 it is switched off immediately
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_ON, load_out.state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user