Browse Source

Use fastio for literal pins

pull/1/head
Scott Lahteine 8 years ago
parent
commit
cb48292338
  1. 10
      Marlin/Marlin_main.cpp
  2. 10
      Marlin/Sd2Card.cpp
  3. 24
      Marlin/stepper.cpp
  4. 3
      Marlin/stepper_dac.cpp
  5. 6
      Marlin/ultralcd_impl_DOGM.h

10
Marlin/Marlin_main.cpp

@ -782,7 +782,7 @@ void setup_killpin() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
void setup_filrunoutpin() { void setup_filrunoutpin() {
pinMode(FIL_RUNOUT_PIN, INPUT); SET_INPUT(FIL_RUNOUT_PIN);
#if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT) #if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT)
WRITE(FIL_RUNOUT_PIN, HIGH); WRITE(FIL_RUNOUT_PIN, HIGH);
#endif #endif
@ -860,10 +860,9 @@ void servo_init() {
*/ */
#if HAS_STEPPER_RESET #if HAS_STEPPER_RESET
void disableStepperDrivers() { void disableStepperDrivers() {
pinMode(STEPPER_RESET_PIN, OUTPUT); OUT_WRITE(STEPPER_RESET_PIN, LOW); // drive it down to hold in reset motor driver chips
digitalWrite(STEPPER_RESET_PIN, LOW); // drive it down to hold in reset motor driver chips
} }
void enableStepperDrivers() { pinMode(STEPPER_RESET_PIN, INPUT); } // set to input, which allows it to be pulled high by pullups void enableStepperDrivers() { SET_INPUT(STEPPER_RESET_PIN); } // set to input, which allows it to be pulled high by pullups
#endif #endif
#if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0 #if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
@ -9194,8 +9193,7 @@ void setup() {
#endif #endif
#if ENABLED(Z_PROBE_SLED) && PIN_EXISTS(SLED) #if ENABLED(Z_PROBE_SLED) && PIN_EXISTS(SLED)
pinMode(SLED_PIN, OUTPUT); OUT_WRITE(SLED_PIN, LOW); // turn it off
digitalWrite(SLED_PIN, LOW); // turn it off
#endif // Z_PROBE_SLED #endif // Z_PROBE_SLED
setup_homepin(); setup_homepin();

10
Marlin/Sd2Card.cpp

@ -302,16 +302,16 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
// set pin modes // set pin modes
pinMode(chipSelectPin_, OUTPUT); pinMode(chipSelectPin_, OUTPUT);
chipSelectHigh(); chipSelectHigh();
pinMode(SPI_MISO_PIN, INPUT); SET_INPUT(SPI_MISO_PIN);
pinMode(SPI_MOSI_PIN, OUTPUT); SET_OUTPUT(SPI_MOSI_PIN);
pinMode(SPI_SCK_PIN, OUTPUT); SET_OUTPUT(SPI_SCK_PIN);
#if DISABLED(SOFTWARE_SPI) #if DISABLED(SOFTWARE_SPI)
// SS must be in output mode even it is not chip select // SS must be in output mode even it is not chip select
pinMode(SS_PIN, OUTPUT); SET_OUTPUT(SS_PIN);
// set SS high - may be chip select for another SPI device // set SS high - may be chip select for another SPI device
#if SET_SPI_SS_HIGH #if SET_SPI_SS_HIGH
digitalWrite(SS_PIN, HIGH); WRITE(SS_PIN, HIGH);
#endif // SET_SPI_SS_HIGH #endif // SET_SPI_SS_HIGH
// set SCK rate for initialization commands // set SCK rate for initialization commands
spiRate_ = SPI_SD_INIT_RATE; spiRate_ = SPI_SD_INIT_RATE;

24
Marlin/stepper.cpp

@ -1155,10 +1155,10 @@ void Stepper::report_positions() {
// From Arduino DigitalPotControl example // From Arduino DigitalPotControl example
void Stepper::digitalPotWrite(int address, int value) { void Stepper::digitalPotWrite(int address, int value) {
digitalWrite(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip WRITE(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: WRITE(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip:
//delay(10); //delay(10);
} }
@ -1275,21 +1275,21 @@ void Stepper::microstep_mode(uint8_t driver, uint8_t stepping_mode) {
void Stepper::microstep_readings() { void Stepper::microstep_readings() {
SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins"); SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins");
SERIAL_PROTOCOLPGM("X: "); SERIAL_PROTOCOLPGM("X: ");
SERIAL_PROTOCOL(digitalRead(X_MS1_PIN)); SERIAL_PROTOCOL(READ(X_MS1_PIN));
SERIAL_PROTOCOLLN(digitalRead(X_MS2_PIN)); SERIAL_PROTOCOLLN(READ(X_MS2_PIN));
SERIAL_PROTOCOLPGM("Y: "); SERIAL_PROTOCOLPGM("Y: ");
SERIAL_PROTOCOL(digitalRead(Y_MS1_PIN)); SERIAL_PROTOCOL(READ(Y_MS1_PIN));
SERIAL_PROTOCOLLN(digitalRead(Y_MS2_PIN)); SERIAL_PROTOCOLLN(READ(Y_MS2_PIN));
SERIAL_PROTOCOLPGM("Z: "); SERIAL_PROTOCOLPGM("Z: ");
SERIAL_PROTOCOL(digitalRead(Z_MS1_PIN)); SERIAL_PROTOCOL(READ(Z_MS1_PIN));
SERIAL_PROTOCOLLN(digitalRead(Z_MS2_PIN)); SERIAL_PROTOCOLLN(READ(Z_MS2_PIN));
SERIAL_PROTOCOLPGM("E0: "); SERIAL_PROTOCOLPGM("E0: ");
SERIAL_PROTOCOL(digitalRead(E0_MS1_PIN)); SERIAL_PROTOCOL(READ(E0_MS1_PIN));
SERIAL_PROTOCOLLN(digitalRead(E0_MS2_PIN)); SERIAL_PROTOCOLLN(READ(E0_MS2_PIN));
#if HAS_MICROSTEPS_E1 #if HAS_MICROSTEPS_E1
SERIAL_PROTOCOLPGM("E1: "); SERIAL_PROTOCOLPGM("E1: ");
SERIAL_PROTOCOL(digitalRead(E1_MS1_PIN)); SERIAL_PROTOCOL(READ(E1_MS1_PIN));
SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN)); SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
#endif #endif
} }

3
Marlin/stepper_dac.cpp

@ -52,8 +52,7 @@
int dac_init() { int dac_init() {
#if PIN_EXISTS(DAC_DISABLE) #if PIN_EXISTS(DAC_DISABLE)
pinMode(DAC_DISABLE_PIN, OUTPUT); OUT_WRITE(DAC_DISABLE_PIN, LOW); // set pin low to enable DAC
digitalWrite(DAC_DISABLE_PIN, LOW); // set pin low to enable DAC
#endif #endif
mcp4728_init(); mcp4728_init();

6
Marlin/ultralcd_impl_DOGM.h

@ -221,13 +221,11 @@ void lcd_printPGM(const char* str) {
static void lcd_implementation_init() { static void lcd_implementation_init() {
#if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
pinMode(LCD_BACKLIGHT_PIN, OUTPUT); OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
digitalWrite(LCD_BACKLIGHT_PIN, HIGH);
#endif #endif
#if PIN_EXISTS(LCD_RESET) #if PIN_EXISTS(LCD_RESET)
pinMode(LCD_RESET_PIN, OUTPUT); OUT_WRITE(LCD_RESET_PIN, HIGH);
digitalWrite(LCD_RESET_PIN, HIGH);
#endif #endif
#if DISABLED(MINIPANEL) // setContrast not working for Mini Panel #if DISABLED(MINIPANEL) // setContrast not working for Mini Panel

Loading…
Cancel
Save