• G-Codes
  • Configuration
  • Develop
  • About us
  • Privacy Policy

Repetier-Firmware - Configuration - Pins

Introduction

Many function need digital inputs or outputs or analog inputs. Therefore we have have 3 pin module types:

  • Digital outputs: All modules of this type start with IO_OUTPUT.
  • Digital inputs: All modules of this type start with IO_INPUT.
  • Analog inputs: All modules of this start with IO_ANALOG_INPUT.
  • SPI connection: All modules of this type start with IO_SPI.

Normally all pins can be used as digital input or output. But make sure to define them correctly. Definig a pin as output which gets an input might be a bad idea. Also assign each pin only one function.

Analog inputs are limited and only available on some of the pins. Moreover also watch out with the numbering scheme. If you use a pin as analog input it has a different pin number then the same as digital pin! So digital pin 63 might be analog pin 2.

Digital Outputs

All consumers of the outputs assume sending low to disable and high to enable. Some hardwares require the inverted signal. For example if direction of a motor is wrong, you can invert the direction by inverting the signal to direction pin. In such a case use then the inverted variant of an output.

On board digital output
Description

Sets output state of one pin of the processor.

Syntax
IO_OUTPUT(name, pinNumber)
Parameter
Parameter Function
name The variable name used to reference this pin later.
pinNumber Arduino pin number on the board. For many boards you can get the pinout of all pins. We also provide lots of symbolic names for known boards and pins.
Postprocess

Use the pin in higher leveled modules like stepper drivers.

Inverted on board digital output
Description

Sets output state of one pin of the processor to the opposite signal given.

Syntax
IO_OUTPUT_INVERTED(name, pinNumber)
Parameter
Parameter Function
name The variable name used to reference this pin later.
pinNumber Arduino pin number on the board. For many boards you can get the pinout of all pins. We also provide lots of symbolic names for known boards and pins.
Postprocess

Use the pin in higher leveled modules like stepper drivers.

Faked digital output
Description

Dummy output just to get module compile. Normally used during development or if the output is optional and you do not want to waste a pin for a function you do not need.

Syntax
IO_OUTPUT_FAKE(name)
Parameter
Parameter Function
name The variable name used to reference this pin later.
Postprocess

Use the pin in higher leveled modules like stepper drivers.

Logging digital output
Description

If you are debugging a problem it might be useful to see in hosts console log if a output should be on or off. This output sends all signals through to a real output but logs every call (changesOnly false) or any change in state (changesOnly true). Be careful if you change outputs in an interrupt. This can block and crash firmware if output buffer gets full due to heavy output load.

Syntax
IO_OUTPUT_LOG(name, output, changesOnly)
Parameter
Parameter Function
name The variable name used to reference this pin later.
output Name of the output to forward signals to.
changesOnly True if you only are interested in changes.
Postprocess

Use the pin in higher leveled modules like stepper drivers.

Digital Inputs

Most sensors work on a digital basis. Typical usages are keys, end stops, filament sensors, ...

Digital input
Description

Input pin of the processor. Disables pullup resistor and returns the original signal.

Syntax
IO_INPUT(name, pinNumber)
Parameter
Parameter Function
name The variable name used to reference this pin later.
pinNumber Arduino pin number on the board. For many boards you can get the pinout of all pins. We also provide lots of symbolic names for known boards and pins.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Digital input inverted
Description

Input pin of the processor. Disables pullup resistor and returns the inverted signal.

Syntax
IO_INPUT_INVERTED(name, pinNumber)
Parameter
Parameter Function
name The variable name used to reference this pin later.
pinNumber Arduino pin number on the board. For many boards you can get the pinout of all pins. We also provide lots of symbolic names for known boards and pins.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Digital input with pullup resistor
Description

Input pin of the processor. Enables pullup resistor and returns the original signal.

Syntax
IO_INPUT_PULLUP(name, pinNumber)
Parameter
Parameter Function
name The variable name used to reference this pin later.
pinNumber Arduino pin number on the board. For many boards you can get the pinout of all pins. We also provide lots of symbolic names for known boards and pins.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Digital input inverted with pullup resistor
Description

Input pin of the processor. Enables pullup resistor and returns the inverted signal.

Syntax
IO_INPUT_INVERTED_PULLUP(name, pinNumber)
Parameter
Parameter Function
name The variable name used to reference this pin later.
pinNumber Arduino pin number on the board. For many boards you can get the pinout of all pins. We also provide lots of symbolic names for known boards and pins.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Logging input
Description

Writes input changes or all read inputs to serial connection. Should only be used for debugging input states. Can crash firmware if used for inputs checked in interrupts!

Syntax
IO_INPUT_LOG(name, input, changeOnly)
Parameter
Parameter Function
name The variable name used to reference this input later.
input Name of the real input handler.
changeOnly If true only report sif the value changes. Should be true to reduce messages.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Or Input
Description

Combines 2 input signals into one. Combination is a logical or, so if any of the 2 inputs is high the output will be high as well.

Syntax
IO_INPUT_OR(name, input1, input2)
Parameter
Parameter Function
name The variable name used to reference this input later.
input1 Name of first input to combine.
input2 Name of second input to combine.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Or Input
Description

Combines 2 input signals into one. Combination is a logical and, so only if both of the 2 inputs are high the output will be high as well.

Syntax
IO_INPUT_AND(name, input1, input2)
Parameter
Parameter Function
name The variable name used to reference this input later.
input1 Name of first input to combine.
input2 Name of second input to combine.
Postprocess

Use the pin in higher leveled modules like end stops, filament sensors and more.

Analog inputs

Direct Analog input value
Description

Measures n times the analog value, removes the highest and lowest value and the builds the average. Equation for n is: n = 2 + 2^oversample

Higher values on oversample mean less and even delayed results but also give a more stable value. Normally analog values are only used for temperatures. So it is easy to see if temperature jitters too much. In that case increase oversample. Normally a value of 5 is good compromise. This requires 34 measurements, so lag is neglectible while you get already some smoothing.

Syntax
IO_ANALOG_INPUT(name, channel, oversample)
Parameter
Parameter Function
name The variable name used to reference this pin later.
channel Analog channel of the processor to be used. This is different to pin numbers! Range is 0-15.
oversample Oversample quality (0-7).
Postprocess

Use as input for temperature measurements.

SPI Communication

Hardware SPI
Description

Implements a hardware SPI driver bound to a defined chip select pin.

Syntax
IO_SPI_HW(name, frequency, mode, msbfirst, csPin)
Parameter
Parameter Function
name The variable name used to reference the spi connection.
frequency SPI transfer speed.
mode SPI mode (0-3).
msbmode True to transfer in msb first mode, false for lsb mode.
csPin Chip select pin.
Postprocess

Use as input for devices requiring SPI input.

Software SPI
Description

Implements a software SPI driver bound to a defined chip select pin. On a Due board a delay of 0 results in nearly 4MHz frequency with a delay of 125ns.

Syntax
IO_SPI_SW(name, delayus, mode, msbfirst, csPin, clkPin, misoPin, mosiPin)
Parameter
Parameter Function
name The variable name used to reference the spi connection.
frequency SPI transfer speed.
mode SPI mode (0-3).
msbmode True to transfer in msb first mode, false for lsb mode.
csPin Chip select pin.
clkPin Clock signal pin.
misoPin Input pin connected to DO pin. -1 if not connected.
mosiPin Output pin connected with DI pin. -1 if not connected.
Postprocess

Use as input for devices requiring SPI input.