Merge pull request #7014 from fiveangle/fix_get-set_DrvPct_declarations

fix get/setDrvPct declarations
This commit is contained in:
Scott Lahteine 2017-06-10 19:06:50 -05:00 committed by GitHub
commit 83263076dc
2 changed files with 4 additions and 4 deletions

View File

@ -114,13 +114,13 @@ uint16_t mcp4728_getVout(uint8_t channel) {
/** /**
* Returns DAC values as a 0-100 percentage of drive strength * Returns DAC values as a 0-100 percentage of drive strength
*/ */
uint16_t mcp4728_getDrvPct(uint8_t channel) { return uint16_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); } uint8_t mcp4728_getDrvPct(uint8_t channel) { return uint8_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
/** /**
* Receives all Drive strengths as 0-100 percent values, updates * Receives all Drive strengths as 0-100 percent values, updates
* DAC Values array and calls fastwrite to update the DAC. * DAC Values array and calls fastwrite to update the DAC.
*/ */
void mcp4728_setDrvPct(uint16_t pct[XYZE]) { void mcp4728_setDrvPct(uint8_t pct[XYZE]) {
LOOP_XYZE(i) mcp4728_values[i] = 0.01 * pct[i] * (DAC_STEPPER_MAX); LOOP_XYZE(i) mcp4728_values[i] = 0.01 * pct[i] * (DAC_STEPPER_MAX);
mcp4728_fastWrite(); mcp4728_fastWrite();
} }

View File

@ -59,8 +59,8 @@ uint8_t mcp4728_setGain_all(uint8_t value);
uint16_t mcp4728_getValue(uint8_t channel); uint16_t mcp4728_getValue(uint8_t channel);
uint8_t mcp4728_fastWrite(); uint8_t mcp4728_fastWrite();
uint8_t mcp4728_simpleCommand(byte simpleCommand); uint8_t mcp4728_simpleCommand(byte simpleCommand);
uint16_t mcp4728_getDrvPct(uint8_t channel); uint8_t mcp4728_getDrvPct(uint8_t channel);
void mcp4728_setDrvPct(uint16_t pct[XYZE]); void mcp4728_setDrvPct(uint8_t pct[XYZE]);
#endif #endif
#endif // DAC_MCP4728_H #endif // DAC_MCP4728_H