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.
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -108,6 +108,7 @@
 | 
			
		||||
#define CONTROL_INT_vect  PCINT2_vect
 | 
			
		||||
#define CONTROL_PCMSK     PCMSK2 // Pin change interrupt register
 | 
			
		||||
#define CONTROL_MASK ((1<<RESET_BIT)|(1<<FEED_HOLD_BIT)|(1<<CYCLE_START_BIT)|(1<<SAFETY_DOOR_BIT))
 | 
			
		||||
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
 | 
			
		||||
 | 
			
		||||
// Define probe switch input pin.
 | 
			
		||||
#define PROBE_DDR       DDRK
 | 
			
		||||
 
 | 
			
		||||
@@ -117,6 +117,7 @@
 | 
			
		||||
#define CONTROL_INT_vect  PCINT1_vect
 | 
			
		||||
#define CONTROL_PCMSK     PCMSK1 // Pin change interrupt register
 | 
			
		||||
#define CONTROL_MASK ((1<<RESET_BIT)|(1<<FEED_HOLD_BIT)|(1<<CYCLE_START_BIT)|(1<<SAFETY_DOOR_BIT))
 | 
			
		||||
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
 | 
			
		||||
  
 | 
			
		||||
// Define probe switch input pin.
 | 
			
		||||
#define PROBE_DDR       DDRC
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 | 
			
		||||
// Grbl versioning system
 | 
			
		||||
#define GRBL_VERSION "0.9j"
 | 
			
		||||
#define GRBL_VERSION_BUILD "20150717"
 | 
			
		||||
#define GRBL_VERSION_BUILD "20150811"
 | 
			
		||||
 | 
			
		||||
// Define standard libraries used by Grbl.
 | 
			
		||||
#include <avr/io.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -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) { 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user