From 3a68c22fabf03aa35f92a33338aeabb92e617c47 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Fri, 14 Aug 2015 14:13:52 -0600 Subject: [PATCH] Individual control pin invert compile-option. - Control pins may be individually inverted through a CONTROL_INVERT_MASK macro. This mask is define in the cpu_map.h file. --- doc/log/commit_log_v0.9i.txt | 10 ++++++++++ grbl/config.h | 5 +++-- grbl/cpu_map/cpu_map_atmega2560.h | 1 + grbl/cpu_map/cpu_map_atmega328p.h | 1 + grbl/grbl.h | 2 +- grbl/system.c | 4 ++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/doc/log/commit_log_v0.9i.txt b/doc/log/commit_log_v0.9i.txt index 49d67a7..4208a60 100644 --- a/doc/log/commit_log_v0.9i.txt +++ b/doc/log/commit_log_v0.9i.txt @@ -1,3 +1,13 @@ +---------------- +Date: 2015-07-17 +Author: Sonny Jeon +Subject: Version bump to v0.9j + +- Version bump requested by OEMs to easily determine whether the +firmware supports the new EEPROM reset feature. Other than that, no +significant changes. + + ---------------- Date: 2015-06-25 Author: Sonny Jeon diff --git a/grbl/config.h b/grbl/config.h index 63ee4aa..e8a600b 100644 --- a/grbl/config.h +++ b/grbl/config.h @@ -153,8 +153,9 @@ // Inverts pin logic of the control command pins. This essentially means when this option is enabled // you can use normally-closed switches, rather than the default normally-open switches. -// NOTE: Will eventually be added to Grbl settings in v1.0. -// #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable. +// NOTE: If you require individual control pins inverted, keep this macro disabled and simply alter +// the CONTROL_INVERT_MASK definition in cpu_map.h files. +// #define INVERT_ALL_CONTROL_PINS // Default disabled. Uncomment to enable. // Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful // for some pre-built electronic boards. diff --git a/grbl/cpu_map/cpu_map_atmega2560.h b/grbl/cpu_map/cpu_map_atmega2560.h index 8c2cebc..0287f44 100644 --- a/grbl/cpu_map/cpu_map_atmega2560.h +++ b/grbl/cpu_map/cpu_map_atmega2560.h @@ -108,6 +108,7 @@ #define CONTROL_INT_vect PCINT2_vect #define CONTROL_PCMSK PCMSK2 // Pin change interrupt register #define CONTROL_MASK ((1< diff --git a/grbl/system.c b/grbl/system.c index 1e2ab1b..1a11d3e 100644 --- a/grbl/system.c +++ b/grbl/system.c @@ -41,8 +41,8 @@ void system_init() ISR(CONTROL_INT_vect) { uint8_t pin = (CONTROL_PIN & CONTROL_MASK); - #ifndef INVERT_CONTROL_PIN - pin ^= CONTROL_MASK; + #ifndef INVERT_ALL_CONTROL_PINS + pin ^= CONTROL_INVERT_MASK; #endif // Enter only if any CONTROL pin is detected as active. if (pin) {