DDC
  • Welcome
    • Introduction
    • Supported hardware
  • 1: Project planning
    • Switch inputs
      • Switch table
      • Direct
      • Shift register
      • Port expander
    • Analog inputs
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
    • Processing and memory
  • 2. Wiring
    • Switch inputs
      • Matrix
      • Direct
      • Shift register
      • Port expander
    • Analog
      • Analog switches
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
  • 3. Coding
    • Essentials
      • 02_Board.ino
      • 08_Joystick
      • 10_TableAndAnalog.ino
        • Switch table
        • Analog channels
      • 30_Switches.ino
    • Peripherals
      • RGB LED
        • Firmware control
          • LED functions
          • Color
          • Brightness
          • Presets
        • SimHub control
      • Digital outputs
        • Setup
        • SimHub control
        • Firmware control
      • PWM / Circuit control
        • Setup
        • Calibrate
        • Switch control
        • Trigger control
      • Shift register
      • I2C devices
        • ADS1115
        • PCA9555
        • CAT24C512
    • Advanced
      • Analog inject
      • Conditional coding
        • Triggers
        • Editors
      • Field placement
      • Presets
        • 31_RunningPresets.ino
        • 32_Presets.ino
        • Example
    • Upload
    • Naming the controller
  • 4. Connect to SimHub
    • LED control
    • Controller settings and properties
      • How to connect?
      • How does it work?
      • How to control it?
      • Property list
  • Switch library
    • Pushbutton
    • Function switches
    • Toggle switches
    • Hat switches
    • Car control functions
      • QuickSwitch
      • BrakeMagic
      • ThrottleHold
      • Handbrake
    • Pedals & paddles
      • Brake/throttle
      • Clutch
      • Bite point & launch
      • Filtered curves
      • Shifter
    • Funky switch
      • Directional
      • Center push
    • Encoders
      • rotary2Bit
      • rotary4Bit
      • funkyRotary
      • wildEncoder
      • E18
      • rotaryPulse
      • PEC11
    • Rotary switches
      • rotaryAnalog
      • quickRotary
      • SW1
      • Editing functions
    • Multiswitch complexes
      • Hybrid rotary
      • Multifunction rotary
      • Modded encoder
      • Stacked encoder
    • Preset
    • DDS
    • RGB LED control
    • PWM / Circuit control
    • Utility
  • Fast DDC
    • Buttons and LED
    • 4 encoders, buttons and LED
    • Dual clutches, 4 encoders, buttons and LED
    • Dual clutches, 6 encoders, button matrix and LED
  • CB1
    • Ordering
      • Order together
      • Order yourself
        • 1. Open in EasyEDA
        • 2. Export files
        • 3. Edit Pick&Place
        • 4. Pin headers and jumper
        • 5. Order from JLCPCB
    • Wiring
    • Code
      • Essentials
      • Complete project
      • Settings
    • Circuit
    • Shields
      • Robin
  • Collaboration
Powered by GitBook
On this page
  1. Switch library
  2. Multiswitch complexes

Stacked encoder

PreviousModded encoderNextPreset

Last updated 1 year ago

The idea of the stacked encoder comes from Serkan from . The Spectra XR steering wheel runs a custom DDC firmware, and amongst the functions designed for Soelpec's wheel is the stacked encoders. The function allows you to use a pushbutton to scroll through a stack of button number layers. How many layers you can decide yourself.

For instance, lets say we have a stacked encoder with its stack button on row 3, column 1. We want LEDs 0 to 4 to change color when scrolling through the stack. Writing something like this in 36_LEDtop.ino would work well:

triggerLED(0,4,encoderStack(3,1,0),0x00FF00,25,false);
triggerLED(0,4,encoderStack(3,1,1),0xFF8000,25,false);
triggerLED(0,4,encoderStack(3,1,2),0x08FFA5,25,false);
triggerLED(0,4,encoderStack(3,1,3),0x0000FF,25,false);

rotary2Stack()

void rotary2Stack(int stackButtonRow, int stackButtonColumn, int fieldPlacement, int layers, int row, int column, bool reverse)

Lets say our encoder is on row 3, columns 2+3, and our stackbutton is on row 1, column 5. We want 4 layers and we push the layer number to field placement 1.

rotary2Stack(1, 5, 1, 4, 3, 2, false);

The button numbers used is determined by the number written in the block for the A pin. B pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16 for the first layer, then 17+18, etc. The reverse part of the function will switch the button numbers if set to true.

In this example, we're using field slot 1, and with 4 layers we'll be using 2 bits. So slot 1 and slot 2 will be used. This is reflected by the properties [DahlDesign.DDCR1] and [DahlDesign.DDCR2] properties, which will go 00, 01, 10 and 11 as you scroll through the 4 layers.

  • 2 x layers = button numbers

rotary4Stack()

void rotary4Stack(int stackButtonRow, int stackButtonColumn, int fieldPlacement, int layers, int row, int column, bool reverse)

Lets say our encoder is on row 3, columns 2+3, and our stackbutton is on row 1, column 5. We want 4 layers and we push the layer number to field placement 1.

rotary4Stack(1, 5, 1, 4, 3, 2, false);

The button numbers used is determined by the number written in the block for the A pin. B pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16 for the first layer, then 17+18, etc. The reverse part of the function will switch the button numbers if set to true.

In this example, we're using field slot 1, and with 4 layers we'll be using 2 bits. So slot 1 and slot 2 will be used. This is reflected by the properties [DahlDesign.DDCR1] and [DahlDesign.DDCR2] properties, which will go 00, 01, 10 and 11 as you scroll through the 4 layers.

  • 2 x layers = button numbers

PEC11Stack()

void PEC11Stack(int stackButtonRow, int stackButtonColumn, int fieldPlacement, int layers, int row, int col, bool reverse)

Lets say our encoder is on row 3, columns 2+3, and our stackbutton is on row 1, column 5. We want 4 layers and we push the layer number to field placement 1.

PEC11Stack(1, 5, 1, 4, 3, 2, false);

The button numbers used is determined by the number written in the block for the A pin. B pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16 for the first layer, then 17+18, etc. The reverse part of the function will switch the button numbers if set to true.

In this example, we're using field slot 1, and with 4 layers we'll be using 2 bits. So slot 1 and slot 2 will be used. This is reflected by the properties [DahlDesign.DDCR1] and [DahlDesign.DDCR2] properties, which will go 00, 01, 10 and 11 as you scroll through the 4 layers.

  • 2 x layers = button numbers

funkyRotaryStack()

void funkyRotaryStack(int stackButtonRow, int stackButtonColumn, int fieldPlacement, int layers, int Arow, int Acol, int Bcol, bool reverse)

Lets say our encoder is on row 3, columns 2+3, and our stackbutton is on row 1, column 5. We want 4 layers and we push the layer number to field placement 1.

funkyRotaryStack(1, 5, 1, 4, 3, 2, 3, false);

The button numbers used is determined by the number written in the block for the A pin. B pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16 for the first layer, then 17+18, etc. The reverse part of the function will switch the button numbers if set to true.

In this example, we're using field slot 1, and with 4 layers we'll be using 2 bits. So slot 1 and slot 2 will be used. This is reflected by the properties [DahlDesign.DDCR1] and [DahlDesign.DDCR2] properties, which will go 00, 01, 10 and 11 as you scroll through the 4 layers.

  • 2 x layers = button numbers

funkyRotaryStackPush()

void funkyRotaryStackPush(int pushButtonRow, int pushButtonColumn, int aButton, int bButton, int cButton, int dButton, int fieldPlacement, int layers, int rotRow, int rotAcol, int rotBcol, bool reverse)

Lets say our encoder is on row 3, columns 2+3, and our funky pushbutton+directional buttons are on row 1, usign columns 3-7, where pushbutton is row 3. We want 4 layers and we push the layer number to field placement 1.

funkyRotaryStackPush(1, 3, 4, 5, 6, 7, 1, 4, 3, 2, 3, false);

The button numbers used is determined by the number written in the block for the A pin. B pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16 for the first layer, then 17+18, etc. The reverse part of the function will switch the button numbers if set to true.

In this example, we're using field slot 1, and with 4 layers we'll be using 2 bits. So slot 1 and slot 2 will be used. This is reflected by the properties [DahlDesign.DDCR1] and [DahlDesign.DDCR2] properties, which will go 00, 01, 10 and 11 as you scroll through the 4 layers.

  • 2 x layers = button numbers

The function will also push the current stack number to the, which in return will give you SimHub properties that you can use to make your dashboard change as you scroll through the stack. With more layers, more bits are used in the field. For instance 7 layers will use 3 bits, since 3 bits are required to get type the number 7 in binary.

In addition, there is a LED function that you can use tos depending on which stack you're currently in.

Stacked encoder in the rotary2bit .

Stacked encoder in the rotary4bit.

Stacked encoder in the PEC11 .

Stacked encoder in the funkyRotary . This is for using a regular pushbutton to change layer, not the funky pushbutton.

Stacked encoder in the funkyRotary . This is for using the funky pushbutton.

rotary field
Soelpec
category
category
category
category
category
trigger LED
encoderStack()
Soelpec Spectra XR uses stacked encoders for its thumb rotaries