Skip to content

Commit

Permalink
support for DPS5015 power and fan control
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi authored and kanflo committed May 16, 2017
1 parent 24a83f8 commit b25b1a0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
8 changes: 8 additions & 0 deletions 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__
6 changes: 5 additions & 1 deletion opendps/hw.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
28 changes: 22 additions & 6 deletions opendps/pwrctl.c
Expand Up @@ -23,6 +23,7 @@
*/

#include "pwrctl.h"
#include "dps-model.h"
#include <stdio.h>
#include <gpio.h>
#include <dac.h>
Expand Down Expand Up @@ -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
}
}

/**
Expand Down

0 comments on commit b25b1a0

Please sign in to comment.