Skip to content

Commit

Permalink
Spare pin 18 INT3 demo / FEATURE_USER_INT3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nibbels committed Sep 12, 2017
1 parent 2987b0e commit d9426bf
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Repetier/Configuration.h
Expand Up @@ -946,5 +946,8 @@ and it is elsewise difficult to know, what your reprap is currently doing. */
/** \brief Defines the default z scale */
#define DEFAULT_Z_SCALE_MODE Z_VALUE_MODE_Z_MIN

/** \brief For Nibbels external interrupt 3 button at RF1000 X25.8 und RF2000 X34.2 "EXT_IRQ"/INT3
You can activate this to 1 and connect some Button. If you connect ground to pull the pullup down you will let the firmware jump into interrupt routine */
#define FEATURE_USER_INT3 0 // 0 = OFF, 1 = ON

#endif // CONFIGURATION_H
8 changes: 8 additions & 0 deletions Repetier/HAL.cpp
Expand Up @@ -1207,6 +1207,14 @@ ISR(EXTRUDER_TIMER_VECTOR)
}
#endif // USE_ADVANCE

#if FEATURE_USER_INT3
volatile unsigned long g_uCOUNT_INT3 = 0; //dummy variable for dummy function!

void USER_INTERRUPT3_HOOK(){
g_uCOUNT_INT3++; //dummy function!
}
#endif //FEATURE_USER_INT3

#ifndef EXTERNALSERIAL
// Implement serial communication for one stream only!
/*
Expand Down
8 changes: 7 additions & 1 deletion Repetier/HAL.h
Expand Up @@ -122,6 +122,12 @@ typedef uint8_t flag8_t;

#define FAST_INTEGER_SQRT

#if FEATURE_USER_INT3
extern volatile unsigned long g_uCOUNT_INT3; //dummy variable for dummy function!

void USER_INTERRUPT3_HOOK(); //dummy function!
#endif //FEATURE_USER_INT3

#ifndef EXTERNALSERIAL
// Implement serial communication for one stream only!
/*
Expand Down Expand Up @@ -204,7 +210,7 @@ class RFHardwareSerial : public Print
extern RFHardwareSerial RFSerial;
#define RFSERIAL RFSerial
#define WAIT_OUT_EMPTY while(tx_buffer.head != tx_buffer.tail) {}
#else
#else // EXTERNALSERIAL
#define RFSERIAL Serial
#endif // EXTERNALSERIAL

Expand Down
6 changes: 6 additions & 0 deletions Repetier/Printer.cpp
Expand Up @@ -898,6 +898,12 @@ void Printer::setup()
#endif // Z_MAX_PIN>-1
#endif // MAX_HARDWARE_ENDSTOP_Z

#if FEATURE_USER_INT3
SET_INPUT( RESERVE_DIGITAL_PIN_PD3 );
PULLUP( RESERVE_DIGITAL_PIN_PD3, HIGH );
attachInterrupt( digitalPinToInterrupt(RESERVE_DIGITAL_PIN_PD3) , USER_INTERRUPT3_HOOK, FALLING );
#endif //FEATURE_USER_INT3

#if FAN_PIN>-1
SET_OUTPUT(FAN_PIN);
WRITE(FAN_PIN,LOW);
Expand Down
7 changes: 7 additions & 0 deletions Repetier/RF.cpp
Expand Up @@ -10698,6 +10698,13 @@ void processCommand( GCode* pCommand )
break;
}

#if FEATURE_USER_INT3
case 3989: // M3989 : proof that dummy function/additional hardware button works!
{
Com::printFLN( PSTR( "Request INT3:" ), g_uCOUNT_INT3 ); //evtl. je nach Anwendung entprellen nötig: wenn entprellen nötig, hilft evtl. interrupt nach ausführung sperren und mit dem watchdog-timer erneut entsperren.
break;
}
#endif //FEATURE_USER_INT3
}
}

Expand Down
12 changes: 6 additions & 6 deletions Repetier/pins.h
Expand Up @@ -253,15 +253,15 @@
#define FET3 -1

//http://www.rf1000.de/viewtopic.php?f=24&t=1119 :
#define RESERVE_DIGITAL_PIN_PJ0 15 //RF1000 X25.12 und RF2000 X33.3
#define RESERVE_DIGITAL_PIN_PJ1 14 //RF1000 X25.13 und RF2000 X33.4
#define RESERVE_DIGITAL_PIN_PJ0 15 //RF1000 X25.12 und RF2000 X33.3 //Serial3 RX3
#define RESERVE_DIGITAL_PIN_PJ1 14 //RF1000 X25.13 und RF2000 X33.4 //Serial3 TX3

#define RESERVE_DIGITAL_PIN_PC2 35 //X25.4
#define RESERVE_DIGITAL_PIN_PC4 33 //X25.5
#define RESERVE_DIGITAL_PIN_PC5 32 //X25.6

#define RESERVE_DIGITAL_PIN_PD2 19 //X25.7
#define RESERVE_DIGITAL_PIN_PD3 18 //RF1000 X25.8 und RF2000 X34.2 "EXT_IRQ"
#define RESERVE_DIGITAL_PIN_PD3 18 //RF1000 X25.8 und RF2000 X34.2 "EXT_IRQ"/INT3 -> FEATURE_USER_INT3

#define RESERVE_ANALOG_PIN_PF3 3 //X25.10
#define RESERVE_ANALOG_PIN_PF4 4 //X25.11
Expand Down Expand Up @@ -502,12 +502,12 @@
#define UI_DISPLAY_D7_PIN 98
// PINJ.3, 66, D_D7

#define RESERVE_DIGITAL_PIN_PJ0 15 //RF1000 X25.12 und RF2000 X33.3
#define RESERVE_DIGITAL_PIN_PJ1 14 //RF1000 X25.13 und RF2000 X33.4
#define RESERVE_DIGITAL_PIN_PJ0 15 //RF1000 X25.12 und RF2000 X33.3 //Serial3 RX3
#define RESERVE_DIGITAL_PIN_PJ1 14 //RF1000 X25.13 und RF2000 X33.4 //Serial3 TX3

#define RESERVE_DIGITAL_PIN_PE4 2 //RF2000 X33.5

#define RESERVE_DIGITAL_PIN_PD3 18 //RF1000 X25.8 und RF2000 X34.2 "EXT_IRQ"
#define RESERVE_DIGITAL_PIN_PD3 18 //RF1000 X25.8 und RF2000 X34.2 "EXT_IRQ"/INT3 -> FEATURE_USER_INT3
/* X34.3=SCL und X34.4=SDA ist I²C siehe wire.h. (X34.1=5V und X34.5/X34.6=VSS) An diesem Bus sind auch die DMS und EEPROMs für Geräteidentifikation (EEPROM 2) und das EEPROM für die Z-Matrix (EEPROM 1) angeschlossen. */
#endif // MOTHERBOARD == DEVICE_TYPE_RF2000

Expand Down

0 comments on commit d9426bf

Please sign in to comment.