Make digitalPotWrite depend on HAS_DIGIPOTSS

This commit is contained in:
Scott Lahteine 2016-03-19 18:44:08 -07:00
parent f96bc03081
commit 5d0570cea0
3 changed files with 16 additions and 13 deletions

View File

@ -5660,10 +5660,12 @@ inline void gcode_M907() {
* M908: Control digital trimpot directly (M908 P<pin> S<current>) * M908: Control digital trimpot directly (M908 P<pin> S<current>)
*/ */
inline void gcode_M908() { inline void gcode_M908() {
#if HAS_DIGIPOTSS
digitalPotWrite( digitalPotWrite(
code_seen('P') ? code_value() : 0, code_seen('P') ? code_value() : 0,
code_seen('S') ? code_value() : 0 code_seen('S') ? code_value() : 0
); );
#endif
#ifdef DAC_STEPPER_CURRENT #ifdef DAC_STEPPER_CURRENT
dac_current_raw( dac_current_raw(
code_seen('P') ? code_value_long() : -1, code_seen('P') ? code_value_long() : -1,

View File

@ -1174,19 +1174,18 @@ void quickStop() {
#endif //BABYSTEPPING #endif //BABYSTEPPING
// From Arduino DigitalPotControl example #if HAS_DIGIPOTSS
void digitalPotWrite(int address, int value) {
#if HAS_DIGIPOTSS // From Arduino DigitalPotControl example
void digitalPotWrite(int address, int value) {
digitalWrite(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip digitalWrite(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip
SPI.transfer(address); // send in the address and value via SPI: SPI.transfer(address); // send in the address and value via SPI:
SPI.transfer(value); SPI.transfer(value);
digitalWrite(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip: digitalWrite(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip:
//delay(10); //delay(10);
#else }
UNUSED(address);
UNUSED(value); #endif //HAS_DIGIPOTSS
#endif
}
// Initialize Digipot Motor Current // Initialize Digipot Motor Current
void digipot_init() { void digipot_init() {

View File

@ -62,7 +62,9 @@ extern block_t* current_block; // A pointer to the block currently being traced
void quickStop(); void quickStop();
void digitalPotWrite(int address, int value); #if HAS_DIGIPOTSS
void digitalPotWrite(int address, int value);
#endif
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2); void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
void microstep_mode(uint8_t driver, uint8_t stepping); void microstep_mode(uint8_t driver, uint8_t stepping);
void digipot_init(); void digipot_init();