Directional Switch (Hat Switch)

The directional switch, or hat switch, or switched joystick, is a navigation type device that uses switches to specify the direction.  They come in 2-way, 4-way and possibly 8-way (I've never seen one, and probably misinterpreted a 4 way which can output 8 values).

A 4-way directional switch, commonly found as hat switches on joysticks and game pads, has 4 switches in the North, South, East, West directions.  When the stick is moved in the North direction, for example, the North switch triggers.  If the stick is moved in the North East direction, both the North and East switches trigger.

A 2-way direction switch is used to specify navigation in either the North South direction, or East West.  Of course, this can be interpreted as up down as a volume control as is required by the application.

The difference between a Directional Switch and a jumble of buttons is the way Generic HID interprets the directional switch.  The 4-way switch will have 9 outputs.  -1 for no selection, and the values 0-7 for the directions N,NW,W,S,SW,S,SE,E,NE.  The application software can then convert these values into a directional angle (0-359°).

The directional switch typically uses mechanical switches, so a pull-up resistor and debouncing should be used.  See Mechanical Switches for more information.



Components can be given an optional name.  This is seen in the Test tab. Not all applications support the name.  Hidcomp/hidconfig supports names.


The UsagePage and Usage of the Directional Switch. See Usages for more information.


The number of directions.

Pull Up

Should the internal pullup resistor of the microcontroller be used. Normally set to true when switching to ground. See Mechnical Switches for more information.

Debounce (ms)

Waits for the mechanical switch stop bouncing before registering a switch closure.  Enter the time to wait in milliseconds. See Mechnical Switches for more information.


Defines the amount of electrical current used by the LED in mA. This is used to estimate the USB power draw.  See the section on Power for more information.

Current drawn by switches is usually insignificant and can be set to 0.