Browse Source

No patch needed for non-libmaple analogWrite

See https://github.com/pinchies/Marlin/pull/1#issuecomment-471388743
pull/1/head
Scott Lahteine 6 years ago
parent
commit
67bee06e43
  1. 2
      Marlin/src/HAL/HAL_AVR/fastio_AVR.h
  2. 2
      Marlin/src/HAL/HAL_DUE/fastio_Due.h
  3. 2
      Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h
  4. 2
      Marlin/src/HAL/HAL_LINUX/fastio.h
  5. 2
      Marlin/src/HAL/HAL_LPC1768/fastio.h
  6. 2
      Marlin/src/HAL/HAL_STM32/fastio_STM32.h
  7. 1
      Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h
  8. 2
      Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h
  9. 2
      Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h
  10. 2
      Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h
  11. 2
      Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h
  12. 2
      Marlin/src/Marlin.cpp
  13. 2
      Marlin/src/feature/caselight.cpp
  14. 2
      Marlin/src/feature/controllerfan.cpp
  15. 2
      Marlin/src/feature/leds/leds.cpp
  16. 4
      Marlin/src/gcode/control/M3-M5.cpp
  17. 2
      Marlin/src/gcode/control/M42.cpp
  18. 2
      Marlin/src/module/endstops.cpp
  19. 10
      Marlin/src/module/planner.cpp
  20. 2
      Marlin/src/module/stepper.cpp
  21. 2
      Marlin/src/module/temperature.cpp

2
Marlin/src/HAL/HAL_AVR/fastio_AVR.h

@ -94,8 +94,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#endif
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
#define READ(IO) _READ(IO)
#define WRITE(IO,V) _WRITE(IO,V)
#define TOGGLE(IO) _TOGGLE(IO)

2
Marlin/src/HAL/HAL_DUE/fastio_Due.h

@ -190,8 +190,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
/**
* Ports and functions
* Added as necessary or if I feel like it- not a comprehensive list!

2
Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h

@ -61,8 +61,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
#define PWM_PIN(P) true
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)

2
Marlin/src/HAL/HAL_LINUX/fastio.h

@ -126,6 +126,4 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)

2
Marlin/src/HAL/HAL_LPC1768/fastio.h

@ -128,5 +128,3 @@
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)

2
Marlin/src/HAL/HAL_STM32/fastio_STM32.h

@ -84,5 +84,3 @@ void FastIO_init(); // Must be called before using fast io macros
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)

1
Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h

@ -56,4 +56,3 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)

2
Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h

@ -59,8 +59,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
//
// Pins Definitions
//

2
Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h

@ -58,8 +58,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
//
// Pins Definitions
//

2
Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h

@ -90,8 +90,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
#define PWM_PIN(P) digitalPinHasPWM(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)

2
Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h

@ -89,8 +89,6 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
#define PWM_PIN(P) digitalPinHasPWM(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)

2
Marlin/src/Marlin.cpp

@ -976,7 +976,7 @@ void setup() {
#endif
#if ENABLED(SPINDLE_LASER_PWM) && defined(SPINDLE_LASER_PWM_PIN) && SPINDLE_LASER_PWM_PIN >= 0
SET_PWM(SPINDLE_LASER_PWM_PIN);
ANALOG_WRITE(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // set to lowest speed
analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // set to lowest speed
#endif
#endif

2
Marlin/src/feature/caselight.cpp

@ -70,7 +70,7 @@ void update_case_light() {
#else // !CASE_LIGHT_USE_NEOPIXEL
if (PWM_PIN(CASE_LIGHT_PIN))
ANALOG_WRITE(CASE_LIGHT_PIN, n10ct);
analogWrite(CASE_LIGHT_PIN, n10ct);
else {
const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);

2
Marlin/src/feature/controllerfan.cpp

@ -81,7 +81,7 @@ void controllerfan_update() {
// allows digital or PWM fan output to be used (see M42 handling)
WRITE(CONTROLLER_FAN_PIN, speed);
ANALOG_WRITE(CONTROLLER_FAN_PIN, speed);
analogWrite(CONTROLLER_FAN_PIN, speed);
}
}

2
Marlin/src/feature/leds/leds.cpp

@ -112,7 +112,7 @@ void LEDLights::set_color(const LEDColor &incol
// This variant uses 3-4 separate pins for the RGB(W) components.
// If the pins can do PWM then their intensity will be set.
#define UPDATE_RGBW(C,c) do{ if (PWM_PIN(RGB_LED_##C##_PIN)) ANALOG_WRITE(RGB_LED_##C##_PIN, incol.r); else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0)
#define UPDATE_RGBW(C,c) do{ if (PWM_PIN(RGB_LED_##C##_PIN)) analogWrite(RGB_LED_##C##_PIN, incol.r); else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0)
UPDATE_RGBW(R,r);
UPDATE_RGBW(G,g);
UPDATE_RGBW(B,b);

4
Marlin/src/gcode/control/M3-M5.cpp

@ -74,7 +74,7 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY);
inline void set_spindle_laser_ocr(const uint8_t ocr) {
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
ANALOG_WRITE(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
}
#if ENABLED(SPINDLE_LASER_PWM)
@ -82,7 +82,7 @@ inline void set_spindle_laser_ocr(const uint8_t ocr) {
void update_spindle_laser_power() {
if (spindle_laser_power == 0) {
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low)
ANALOG_WRITE(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte
analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte
delay_for_power_down();
}
else { // Convert RPM to PWM duty cycle

2
Marlin/src/gcode/control/M42.cpp

@ -51,7 +51,7 @@ void GcodeSuite::M42() {
pinMode(pin, OUTPUT);
extDigitalWrite(pin, pin_status);
ANALOG_WRITE(pin, pin_status);
analogWrite(pin, pin_status);
#if FAN_COUNT > 0
switch (pin) {

2
Marlin/src/module/endstops.cpp

@ -886,7 +886,7 @@ void Endstops::update() {
ES_REPORT_CHANGE(Z3_MAX);
#endif
SERIAL_ECHOLNPGM("\n");
ANALOG_WRITE(LED_PIN, local_LED_status);
analogWrite(LED_PIN, local_LED_status);
local_LED_status ^= 255;
old_live_state_local = live_state_local;
}

10
Marlin/src/module/planner.cpp

@ -1290,13 +1290,13 @@ void Planner::check_axes_activity() {
#else
#if HAS_FAN0
ANALOG_WRITE(FAN_PIN, CALC_FAN_SPEED(0));
analogWrite(FAN_PIN, CALC_FAN_SPEED(0));
#endif
#if HAS_FAN1
ANALOG_WRITE(FAN1_PIN, CALC_FAN_SPEED(1));
analogWrite(FAN1_PIN, CALC_FAN_SPEED(1));
#endif
#if HAS_FAN2
ANALOG_WRITE(FAN2_PIN, CALC_FAN_SPEED(2));
analogWrite(FAN2_PIN, CALC_FAN_SPEED(2));
#endif
#endif
@ -1308,10 +1308,10 @@ void Planner::check_axes_activity() {
#if ENABLED(BARICUDA)
#if HAS_HEATER_1
ANALOG_WRITE(HEATER_1_PIN, tail_valve_pressure);
analogWrite(HEATER_1_PIN, tail_valve_pressure);
#endif
#if HAS_HEATER_2
ANALOG_WRITE(HEATER_2_PIN, tail_e_to_p_pressure);
analogWrite(HEATER_2_PIN, tail_e_to_p_pressure);
#endif
#endif
}

2
Marlin/src/module/stepper.cpp

@ -2510,7 +2510,7 @@ void Stepper::report_positions() {
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
motor_current_setting[driver] = current; // update motor_current_setting
#define _WRITE_CURRENT_PWM(P) ANALOG_WRITE(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE))
#define _WRITE_CURRENT_PWM(P) analogWrite(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE))
switch (driver) {
case 0:
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)

2
Marlin/src/module/temperature.cpp

@ -657,7 +657,7 @@ int Temperature::getHeaterPower(const int heater) {
#define _UPDATE_AUTO_FAN(P,D,A) do{ \
if (PWM_PIN(P##_AUTO_FAN_PIN) && EXTRUDER_AUTO_FAN_SPEED < 255) \
ANALOG_WRITE(P##_AUTO_FAN_PIN, A); \
analogWrite(P##_AUTO_FAN_PIN, A); \
else \
WRITE(P##_AUTO_FAN_PIN, D); \
}while(0)

Loading…
Cancel
Save