No patch needed for non-libmaple analogWrite

See https://github.com/pinchies/Marlin/pull/1#issuecomment-471388743
This commit is contained in:
Scott Lahteine 2019-03-13 07:21:10 -05:00
parent f89b375fb9
commit 67bee06e43
21 changed files with 15 additions and 36 deletions

View file

@ -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)

View file

@ -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!

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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
//

View file

@ -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
//

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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

View file

@ -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) {

View file

@ -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;
}

View file

@ -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
}

View file

@ -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)

View file

@ -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)