diff --git a/opendps/dps-model.h b/opendps/dps-model.h new file mode 100644 index 00000000..755d208a --- /dev/null +++ b/opendps/dps-model.h @@ -0,0 +1,8 @@ +#ifndef __DPS_MODEL_H__ +#define __DPS_MODEL_H__ + +// if no other DPSxxxx model is specified, we will assume DPS5005 +#define DPS5015 + + +#endif // __DPS_MODEL_H__ \ No newline at end of file diff --git a/opendps/hw.c b/opendps/hw.c index 5fad84c0..52b04adf 100644 --- a/opendps/hw.c +++ b/opendps/hw.c @@ -39,6 +39,7 @@ #include "pwrctl.h" #include "hw.h" #include "event.h" +#include "dps-model.h" static void tim2_init(void); static void clock_init(void); @@ -514,8 +515,11 @@ static void gpio_init(void) // PC13 I 0 Flt // gpio_set_mode(GPIOC, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO13); +#ifdef DPS5015 + gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); +#endif - // PC14 I 0 Flt + // PC14 I 0 Flt gpio_set_mode(GPIOC, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO14); // PC15 I 0 Flt diff --git a/opendps/pwrctl.c b/opendps/pwrctl.c index bed825de..2caa6d92 100644 --- a/opendps/pwrctl.c +++ b/opendps/pwrctl.c @@ -23,6 +23,7 @@ */ #include "pwrctl.h" +#include "dps-model.h" #include #include #include @@ -100,12 +101,27 @@ uint32_t pwrctl_get_ilimit(void) */ void pwrctl_enable_vout(bool enable) { - v_out_enabled = enable; - if (v_out_enabled) { - gpio_clear(GPIOB, GPIO11); - } else { - gpio_set(GPIOB, GPIO11); - } + v_out_enabled = enable; + if (v_out_enabled) + { +#ifdef DPS5015 + //gpio_clear(GPIOA, GPIO9); // this is power control on '5015 + gpio_set(GPIOB, GPIO11); // B11 is fan control on '5015 + gpio_clear(GPIOC, GPIO13); // C13 is power control on '5015 +#else + gpio_clear(GPIOB, GPIO11); // B11 is power control on '5005 +#endif + } + else + { +#ifdef DPS5015 + //gpio_set(GPIOA, GPIO9); // gpio_set(GPIOB, GPIO11); + gpio_clear(GPIOB, GPIO11); // B11 is fan control on '5015 + gpio_set(GPIOC, GPIO13); // C13 is power control on '5015 +#else + gpio_set(GPIOB, GPIO11); // B11 is power control on '5005 +#endif + } } /**