Add LCD menu for DAC

This commit is contained in:
jaysonkelly
2016-10-03 16:15:29 -06:00
committed by Scott Lahteine
parent 00261cbfcb
commit 13c9dcc600
6 changed files with 85 additions and 13 deletions

View File

@ -34,7 +34,7 @@
#if ENABLED(DAC_STEPPER_CURRENT)
uint16_t mcp4728_values[4];
uint16_t mcp4728_values[XYZE];
/**
* Begin I2C, get current values (input register and eeprom) of mcp4728
@ -112,6 +112,17 @@ uint16_t mcp4728_getVout(uint8_t channel) {
}
*/
/* Returns DAC values as a 0-100 percentage of drive strength */
uint16_t mcp4728_getDrvPct(uint8_t channel) {return (uint16_t)(.5+(((float)mcp4728_values[channel]*100)/DAC_STEPPER_MAX));}
/* Recieves all Drive strengths as 0-100 percent values, updates DAC Values array and calls fastwrite to update the DAC */
void mcp4728_setDrvPct(int16_t pct[XYZE]) {
for (uint8_t i=0; i <= 3; i++) {
mcp4728_values[i] = ((float)pct[i] * DAC_STEPPER_MAX)/100;
}
mcp4728_fastWrite();
}
/**
* FastWrite input register values - All DAC ouput update. refer to DATASHEET 5.6.1
* DAC Input and PowerDown bits update.