No patch needed for non-libmaple analogWrite
See https://github.com/pinchies/Marlin/pull/1#issuecomment-471388743
This commit is contained in:
parent
f89b375fb9
commit
67bee06e43
21 changed files with 15 additions and 36 deletions
|
@ -94,8 +94,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
||||||
#define READ(IO) _READ(IO)
|
#define READ(IO) _READ(IO)
|
||||||
#define WRITE(IO,V) _WRITE(IO,V)
|
#define WRITE(IO,V) _WRITE(IO,V)
|
||||||
#define TOGGLE(IO) _TOGGLE(IO)
|
#define TOGGLE(IO) _TOGGLE(IO)
|
||||||
|
|
|
@ -190,8 +190,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ports and functions
|
* Ports and functions
|
||||||
* Added as necessary or if I feel like it- not a comprehensive list!
|
* Added as necessary or if I feel like it- not a comprehensive list!
|
||||||
|
|
|
@ -61,8 +61,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
||||||
#define PWM_PIN(P) true
|
#define PWM_PIN(P) true
|
||||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,4 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
||||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||||
|
|
|
@ -128,5 +128,3 @@
|
||||||
// digitalRead/Write wrappers
|
// digitalRead/Write wrappers
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
|
@ -84,5 +84,3 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||||
// digitalRead/Write wrappers
|
// digitalRead/Write wrappers
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
|
@ -56,4 +56,3 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
|
|
||||||
|
|
|
@ -59,8 +59,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pins Definitions
|
// Pins Definitions
|
||||||
//
|
//
|
||||||
|
|
|
@ -58,8 +58,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pins Definitions
|
// Pins Definitions
|
||||||
//
|
//
|
||||||
|
|
|
@ -90,8 +90,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
||||||
#define PWM_PIN(P) digitalPinHasPWM(P)
|
#define PWM_PIN(P) digitalPinHasPWM(P)
|
||||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,6 @@
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||||
|
|
||||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
|
||||||
|
|
||||||
#define PWM_PIN(P) digitalPinHasPWM(P)
|
#define PWM_PIN(P) digitalPinHasPWM(P)
|
||||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||||
|
|
||||||
|
|
|
@ -976,7 +976,7 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(SPINDLE_LASER_PWM) && defined(SPINDLE_LASER_PWM_PIN) && SPINDLE_LASER_PWM_PIN >= 0
|
#if ENABLED(SPINDLE_LASER_PWM) && defined(SPINDLE_LASER_PWM_PIN) && SPINDLE_LASER_PWM_PIN >= 0
|
||||||
SET_PWM(SPINDLE_LASER_PWM_PIN);
|
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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ void update_case_light() {
|
||||||
#else // !CASE_LIGHT_USE_NEOPIXEL
|
#else // !CASE_LIGHT_USE_NEOPIXEL
|
||||||
|
|
||||||
if (PWM_PIN(CASE_LIGHT_PIN))
|
if (PWM_PIN(CASE_LIGHT_PIN))
|
||||||
ANALOG_WRITE(CASE_LIGHT_PIN, n10ct);
|
analogWrite(CASE_LIGHT_PIN, n10ct);
|
||||||
else {
|
else {
|
||||||
const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
|
const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
|
||||||
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
|
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
|
||||||
|
|
|
@ -81,7 +81,7 @@ void controllerfan_update() {
|
||||||
|
|
||||||
// allows digital or PWM fan output to be used (see M42 handling)
|
// allows digital or PWM fan output to be used (see M42 handling)
|
||||||
WRITE(CONTROLLER_FAN_PIN, speed);
|
WRITE(CONTROLLER_FAN_PIN, speed);
|
||||||
ANALOG_WRITE(CONTROLLER_FAN_PIN, speed);
|
analogWrite(CONTROLLER_FAN_PIN, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ void LEDLights::set_color(const LEDColor &incol
|
||||||
|
|
||||||
// This variant uses 3-4 separate pins for the RGB(W) components.
|
// This variant uses 3-4 separate pins for the RGB(W) components.
|
||||||
// If the pins can do PWM then their intensity will be set.
|
// 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(R,r);
|
||||||
UPDATE_RGBW(G,g);
|
UPDATE_RGBW(G,g);
|
||||||
UPDATE_RGBW(B,b);
|
UPDATE_RGBW(B,b);
|
||||||
|
|
|
@ -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) {
|
inline void set_spindle_laser_ocr(const uint8_t ocr) {
|
||||||
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
|
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)
|
#if ENABLED(SPINDLE_LASER_PWM)
|
||||||
|
@ -82,7 +82,7 @@ inline void set_spindle_laser_ocr(const uint8_t ocr) {
|
||||||
void update_spindle_laser_power() {
|
void update_spindle_laser_power() {
|
||||||
if (spindle_laser_power == 0) {
|
if (spindle_laser_power == 0) {
|
||||||
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low)
|
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();
|
delay_for_power_down();
|
||||||
}
|
}
|
||||||
else { // Convert RPM to PWM duty cycle
|
else { // Convert RPM to PWM duty cycle
|
||||||
|
|
|
@ -51,7 +51,7 @@ void GcodeSuite::M42() {
|
||||||
|
|
||||||
pinMode(pin, OUTPUT);
|
pinMode(pin, OUTPUT);
|
||||||
extDigitalWrite(pin, pin_status);
|
extDigitalWrite(pin, pin_status);
|
||||||
ANALOG_WRITE(pin, pin_status);
|
analogWrite(pin, pin_status);
|
||||||
|
|
||||||
#if FAN_COUNT > 0
|
#if FAN_COUNT > 0
|
||||||
switch (pin) {
|
switch (pin) {
|
||||||
|
|
|
@ -886,7 +886,7 @@ void Endstops::update() {
|
||||||
ES_REPORT_CHANGE(Z3_MAX);
|
ES_REPORT_CHANGE(Z3_MAX);
|
||||||
#endif
|
#endif
|
||||||
SERIAL_ECHOLNPGM("\n");
|
SERIAL_ECHOLNPGM("\n");
|
||||||
ANALOG_WRITE(LED_PIN, local_LED_status);
|
analogWrite(LED_PIN, local_LED_status);
|
||||||
local_LED_status ^= 255;
|
local_LED_status ^= 255;
|
||||||
old_live_state_local = live_state_local;
|
old_live_state_local = live_state_local;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1290,13 +1290,13 @@ void Planner::check_axes_activity() {
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
ANALOG_WRITE(FAN_PIN, CALC_FAN_SPEED(0));
|
analogWrite(FAN_PIN, CALC_FAN_SPEED(0));
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN1
|
#if HAS_FAN1
|
||||||
ANALOG_WRITE(FAN1_PIN, CALC_FAN_SPEED(1));
|
analogWrite(FAN1_PIN, CALC_FAN_SPEED(1));
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN2
|
#if HAS_FAN2
|
||||||
ANALOG_WRITE(FAN2_PIN, CALC_FAN_SPEED(2));
|
analogWrite(FAN2_PIN, CALC_FAN_SPEED(2));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1308,10 +1308,10 @@ void Planner::check_axes_activity() {
|
||||||
|
|
||||||
#if ENABLED(BARICUDA)
|
#if ENABLED(BARICUDA)
|
||||||
#if HAS_HEATER_1
|
#if HAS_HEATER_1
|
||||||
ANALOG_WRITE(HEATER_1_PIN, tail_valve_pressure);
|
analogWrite(HEATER_1_PIN, tail_valve_pressure);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATER_2
|
#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
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -2510,7 +2510,7 @@ void Stepper::report_positions() {
|
||||||
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
|
if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
|
||||||
motor_current_setting[driver] = current; // update motor_current_setting
|
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) {
|
switch (driver) {
|
||||||
case 0:
|
case 0:
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
|
||||||
|
|
|
@ -657,7 +657,7 @@ int Temperature::getHeaterPower(const int heater) {
|
||||||
|
|
||||||
#define _UPDATE_AUTO_FAN(P,D,A) do{ \
|
#define _UPDATE_AUTO_FAN(P,D,A) do{ \
|
||||||
if (PWM_PIN(P##_AUTO_FAN_PIN) && EXTRUDER_AUTO_FAN_SPEED < 255) \
|
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 \
|
else \
|
||||||
WRITE(P##_AUTO_FAN_PIN, D); \
|
WRITE(P##_AUTO_FAN_PIN, D); \
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
Loading…
Reference in a new issue