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
  • ATMEGA 32U4
  • RP2040
  1. 3. Coding

Naming the controller

Naming the controller, or more importantly assigning a VID and PID number to it, is required for SimHub LED control to work. It is also nice to see your computer recognize your controller as "Ferrari 488 EVO" and not "Arduino Pro Micro".

Currently possible for:

  • ATMEGA32U4

  • RP2040

VID/PID

Vendor ID (VID) and Product ID (PID) are USB product indentifiers, where Windows already has a register to look at. If a product, such as a USB keyboard for instance, is registered with a VID/PID, Windows already knows its name when you plug it in. If your computer has never seen this VID/PID, it will take the name you have given it in the firmware. If you then change the name and don't change the VID/PID, your computer will still remember it as the name you first gave it.

VID/PIDs cost a lot of money. Using a random VID/PID for your private projects is fine, but if you're selling a product, you're not entirely lawful if you're using random IDs. What the risk is, I'm not sure, but I can't imagine there is a USB police sniffing out sim gear shops.

Both VID and PID are 16-bit numbers. Commonly typed as a 4-digit hexadecimal number.

DDC has two VID/PID's, one for the 32U4 and one for the RP2040. You're free to use the DDC VID/PIDs for your personal projects:

  • ATMEGA 32U4

    • VID: 0x35f9

    • PID: 0xDDC

  • RP2040

    • VID: 0x2E8A

    • PID: 0x1053

SimHub uses the VID/PID to grab controllers for custom LED protocols, which is why knowing the VID/PID you give your controller is essential for LED setups. Next we'll look at how to do this for ATMEGA 32U4 boards and RP2040 boards.

ATMEGA 32U4

The approach is using a custom boards.txt file, which Arduino IDE will use to flash your controller instead of the Arduino Leonardo / Pro Micro board core.

The DDC folder has these files, you'll have to move them to the right place:

  • Move the folder "hardware" to your Arduino folder in "My Documents".

  • It includes two board files, MyController and DDC.

If you fire up Arduino IDE, you'll see that these are now available as board cores.

You can either use the DDC core, which will give you the DDC VID/PID straight away, and naming your controller "Dahl Design Controller". Or you can customize your own to give the controller any name and PIV/VID you want. In that case, lets have a look at the boards.txt file in the MyController folder:

MyController.name=My Controller
        
MyController.upload.tool=arduino:avrdude
MyController.upload.protocol=avr109
MyController.upload.maximum_size=28672
MyController.upload.maximum_data_size=2560
MyController.upload.speed=57600
MyController.upload.disable_flushing=true
MyController.upload.use_1200bps_touch=true
MyController.upload.wait_for_upload_port=true
MyController.bootloader.tool=arduino:avrdude
MyController.bootloader.low_fuses=0xff
MyController.bootloader.high_fuses=0xd8
MyController.bootloader.extended_fuses=0xcb
MyController.bootloader.file=caterina/Caterina-Leonardo.hex
MyController.bootloader.unlock_bits=0x3F
MyController.bootloader.lock_bits=0x2F     
MyController.build.mcu=atmega32u4
MyController.build.f_cpu=16000000L

MyController.build.vid=0x8123
MyController.build.pid=0x8234
MyController.build.usb_product="My Controller"

MyController.build.usb_manufacturer="Author"
MyController.build.board=AVR_LEONARDO
MyController.build.core=arduino:arduino
MyController.build.variant=arduino:leonardo
MyController.build.extra_flags={build.usb_flags}
  • Anything called "MyController" or similar can be renamed to whatever you want your controller to be named. The actual name that your computer will display is set here:

MyController.build.usb_product="My Controller"
  • VID and PID:

MyController.build.vid=0x8123
MyController.build.pid=0x8234

RP2040

Setting up name and VID/PID for RP2040 is quite simple. Go to 04_USB.ino:

//This only relevant for RP2040 LED support

#define VID_PI 0x2E8A
#define PID_PI 0x1053
#define MAKER "Andreas Dahl"
#define CONTROLLER_NAME "Dahl Design Controller"

This is fairly self explainatory. Default is the DDC VID/PID. If you don't have your own, you can use this.

PreviousUploadNext4. Connect to SimHub

Last updated 5 months ago