Skip to content

Commit

Permalink
update ref voltage; set default output to 10.0V; Remove erase from 'm…
Browse files Browse the repository at this point in the history
…ake flash '
  • Loading branch information
XuNeo committed Nov 13, 2018
1 parent 666daba commit 4492dd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ clean:
@echo "clean done"

flash: $(TARGET_BIN)
st-flash erase
st-flash write $(PROJECT).bin 0x8000000
erase:
st-flash erase
st-flash erase
9 changes: 6 additions & 3 deletions src/bsp/ad5791.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
* used to track current dac code.
*/
static uint32_t dac_code20b = 0;
static float vref_volt = 10.0f; /* 10V by default. */
static float vref_volt = 10.002838f; /* 10V by default. */
/**
* @brief A simple delay function used to meet AD5791 timing.
* @return none.
*/
static void ad5791_delay(void)
{
uint32_t i = 10;
volatile uint32_t i = 100;
while(i--);
}
/**
Expand Down Expand Up @@ -120,6 +120,8 @@ static void ad5791_sctrl(uint32_t ctrl_set)
{
ad5791_send24b(AD5791_CMD(AD5791REG_SCTRL, ctrl_set));
}

void ad5791_set_volt(float volt);
/**
* @brief Init AD5791 related GPIO peripheral etc.
* @return none.
Expand All @@ -145,7 +147,8 @@ void ad5791_init(void)
ad5791_ctrl(AD5791CTRL_A1_OFF|AD5791CTRL_CODE_BIN|AD5791CTRL_COMP10V|AD5791CTRL_OPGND_NORMAL|\
AD5791CTRL_OUT_NORMAL|AD5791CTRL_SDO_DIS);
ad5791_set_clrcode(0);
ad5791_write_data(0x10000);
ad5791_write_data(0x80000);
ad5791_set_volt(10.0f);
}

/**
Expand Down

0 comments on commit 4492dd1

Please sign in to comment.