Many embedded units that require a setup menu will use a USB serial port which you attach for your favourite terminal emulator. However we not too long ago encountered a generic USB knob that did setup the usage of a textual content editor, like Notepad and even Vim (even though that was once just a little unsightly). An organization known as iWit makes a number of varieties of USB knobs which finally end up in lots of such merchandise.
Those generic USB knobs are generally simply plug-and-play, and are used to keep an eye on your PC’s quantity and muting. Some fashions, just like the iWit, the consumer can configure the mapping throughout the software. For instance, knob rotation may also be set to generate up and down arrow keys, and knob press may well be ENTER. One may do this type of mapping at the PC, however many of those USB knobs can do it for you. The crux of the setup is that this menu (which you’ll be able to see in motion within the first 30 seconds of the video underneath).
- WINDOWS MODE - 1 Clockwise : Up Key 2 Counterclockwise : Down Key 3 Press : Input 4 Press+Clockwise : Subsequent 5 Press+Counterclockwise : Earlier 6 Lengthy Press : Play/Pause [RESTORE DEFAULT] [SAVE & QUIT]
That’s great, after all, however the unexpected level is how the setup menu is carried out within the first position. The knob, already being an HID, spews forth the setup menu as though it have been being typed from a keyboard. Turning the knob to choose an possibility generates ANSI break out sequences for up and down cursor motion and come what may highlights the present line. Having a look on the movement, you’ll be able to see that the menus are proceeded with those codes:
ESC [ 4 ~ Private code? ESC [ 1 ; 2 H Cursor row 1, col 2 ESC [ D Cursor back one column ESC [ 3 ~ Private code?
and item selection is simply the up and down cursor movement codes:
ESC [ A Cursor up one row ESC [ B Cursor down one row
This makes sense, if we were talking to a terminal. But it’s not entirely clear how the typical text editor handles ANSI escape sequences. It’s not a big stretch to imagine that up and down cursor codes would be interpreted as arrow keys by either the operating system or the editor itself, but the highlighting remains a bit of a mystery. If you have any ideas, or have done anything similar yourself, let us know in the comments below.
The video below was found on [Nelson Chu]’s Expresii weblog, an artist who makes a speciality of simulating natural brush strokes in laptop graphics techniques. The specific knob used on this article was once branded DROK, so you’ll have this capacity to your USB knob although it doesn’t say iWit at the label. When you’d like complete keep an eye on of your USB knob, construct your individual as we wrote about in this newsletter from 2020.